Class RuntimeDiscoveryStrategy
Defined in File runtime_discovery.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public ros2_medkit_gateway::discovery::DiscoveryStrategy(Class DiscoveryStrategy)
Class Documentation
-
class RuntimeDiscoveryStrategy : public ros2_medkit_gateway::discovery::DiscoveryStrategy
Runtime discovery strategy using ROS 2 graph introspection.
This is the current discovery behavior extracted into a strategy class. It discovers entities by querying the ROS 2 node graph at runtime.
Features:
Discovers Functions from node namespaces (functional grouping)
Exposes nodes as Apps
Enriches apps with services, actions, and topics
Note: Synthetic/heuristic Area and Component creation has been removed. Areas come from manifest only. Components come from HostInfoProvider or manifest. Namespaces create Function entities.
Public Functions
-
explicit RuntimeDiscoveryStrategy(rclcpp::Node *node)
Construct runtime discovery strategy.
- Parameters:
node – ROS 2 node for graph introspection (must outlive this strategy)
-
void set_config(const RuntimeConfig &config)
Set runtime discovery configuration.
- Parameters:
config – Runtime options from DiscoveryConfig
-
virtual std::vector<Area> discover_areas() override
Discover all areas.
Note
Always returns empty - Areas come from manifest only
-
virtual std::vector<Component> discover_components() override
Discover all components.
Note
Always returns empty - Components come from HostInfoProvider or manifest
-
virtual std::vector<App> discover_apps() override
Discover all apps (empty for runtime-only strategy)
Note
Returns nodes as Apps in runtime discovery
-
virtual std::vector<Function> discover_functions() override
Discover all functions (empty for runtime-only strategy)
Note
Creates Function entities from namespace grouping when enabled
-
std::vector<Function> discover_functions(const std::vector<App> &apps)
Create Function entities from pre-discovered apps.
Avoids redundant ROS 2 graph introspection when apps have already been discovered in the same refresh cycle (e.g., refresh_cache() calls discover_apps() before discover_functions()).
- Parameters:
apps – Pre-discovered apps to group by namespace
- Returns:
Vector of Function entities
-
inline virtual std::string get_name() const override
Get strategy name for logging.
-
std::vector<ServiceInfo> discover_services()
Discover all services in the system with their types.
- Returns:
Vector of ServiceInfo with schema information
-
std::vector<ActionInfo> discover_actions()
Discover all actions in the system with their types.
- Returns:
Vector of ActionInfo with schema information
-
std::optional<ServiceInfo> find_service(const std::string &component_ns, const std::string &operation_name) const
Find a service by component namespace and operation name.
- Parameters:
component_ns – Component namespace
operation_name – Service name
- Returns:
ServiceInfo if found, nullopt otherwise
-
std::optional<ActionInfo> find_action(const std::string &component_ns, const std::string &operation_name) const
Find an action by component namespace and operation name.
- Parameters:
component_ns – Component namespace
operation_name – Action name
- Returns:
ActionInfo if found, nullopt otherwise
-
void set_topic_sampler(NativeTopicSampler *sampler)
Set the topic sampler for component-topic mapping.
- Parameters:
sampler – Pointer to NativeTopicSampler (must outlive this strategy)
-
void set_type_introspection(TypeIntrospection *introspection)
Set the type introspection for operation schema enrichment.
- Parameters:
introspection – Pointer to TypeIntrospection (must outlive this strategy)
-
void refresh_topic_map()
Refresh the cached topic map.
-
bool is_topic_map_ready() const
Check if topic map has been built at least once.
- Returns:
true if topic map is ready, false if not yet built