-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Summary
Cyclic subscriptions are currently hard-coded to work only with /data/ resources. Any other SOVD resource collection (faults, operations, configurations, communication-logs) or vendor extension (x-medkit-*) is rejected.
This means vendor resources registered by plugins via register_capability() can't be subscribed to, even though SOVD treats cyclic subscriptions as a generic mechanism for any resource on an entity path.
What's hard-coded
Three places in cyclic_subscription_handlers.cpp restrict subscriptions to /data/:
-
parse_resource_uri()regex (line 442) - only matches/api/v1/{apps|components}/{id}/data/{path}:static const std::regex resource_regex(R"(^/api/v1/(?:apps|components)/[^/]+/data(/.*))")
-
Prefix validation (line 118) - rejects any resource URI that doesn't start with
/data/:std::string expected_prefix = "/api/v1/" + entity_type + "/" + entity_id + "/data/";
-
Entity type restriction - routes are only registered for
appsandcomponents, notfunctions.
Additionally, subscription_manager.hpp uses topic_name for the extracted resource path, which assumes the resource is always a ROS 2 topic.
Proposed solution (optional)
Make the subscription handler resource-agnostic:
parse_resource_uri()should extract both the collection name and the resource path from the URI, not assume/data/- Prefix validation should check that the resource URI matches the entity from the route, without assuming which collection it belongs to
- Validation: use
EntityCapabilities::supports_collection()(for standard collections) or check registered plugin capabilities (for vendor extensions) to determine if the resource is subscribable - Rename
topic_nametoresource_pathinCyclicSubscriptionInfofor clarity - Route registration should cover all entity types that support cyclic subscriptions per SOVD Table 8
The SSE streaming logic itself (set_chunked_content_provider, EventEnvelope format, replay buffer) is generic and shouldn't need changes - only the resource resolution and validation layer.
Additional context (optional)
SOVD spec (ISO 17978-3, Section 7 - cyclic subscriptions) defines cyclic subscriptions as applicable to any resource on an entity, with x-sovd-cyclic-subscription-supported: true in the capability description indicating support. The current implementation doesn't check this flag or delegate to the resource handler for data retrieval - it goes directly to NativeTopicSampler, which only works for /data/ (ROS 2 topics).
For non-data resources, the streaming callback would need to delegate to the appropriate handler/manager (e.g., FaultManager for faults, ConfigurationManager for configurations, plugin routes for vendor extensions) instead of sampling a ROS 2 topic directly.