Class Ros2RuntimeIntrospection

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class Ros2RuntimeIntrospection : public ros2_medkit_gateway::IntrospectionProvider

rclcpp adapter implementing IntrospectionProvider via ROS 2 graph queries.

Owns the introspection of the live ROS 2 graph (node names, services, actions, topics) that previously lived inside RuntimeDiscoveryStrategy. Exposes the IntrospectionProvider::introspect() contract used by the merge pipeline so built-in graph queries are treated identically to plugin-provided introspection.

In addition to the IntrospectionProvider contract, this class exposes the service/action discovery and topic-map management methods that the gateway’s data, operation, and discovery layers consume directly (independent of the merge pipeline).

Threading: the underlying rclcpp graph queries are not thread-safe across concurrent introspection. Callers (DiscoveryManager / RuntimeLayer) serialize access via the gateway’s refresh lock.

Public Functions

explicit Ros2RuntimeIntrospection(rclcpp::Node *node)
Parameters:

node – Non-owning ROS node used for graph queries.

~Ros2RuntimeIntrospection() override = default
Ros2RuntimeIntrospection(const Ros2RuntimeIntrospection&) = delete
Ros2RuntimeIntrospection &operator=(const Ros2RuntimeIntrospection&) = delete
Ros2RuntimeIntrospection(Ros2RuntimeIntrospection&&) = delete
Ros2RuntimeIntrospection &operator=(Ros2RuntimeIntrospection&&) = delete
void set_config(const RuntimeConfig &config)

Update runtime introspection configuration.

virtual IntrospectionResult introspect(const IntrospectionInput &input) override

Build new entities from the current ROS 2 graph.

Returns Apps (one per node) and Functions (one per namespace) as new_entities. Areas and Components are intentionally never produced by runtime introspection - they come from the manifest layer or the HostInfoProvider.

std::vector<App> discover_apps()

Discover the live nodes as Apps. Always queries the ROS 2 graph; do not call from hot paths.

std::vector<Function> discover_functions(const std::vector<App> &apps)

Group nodes by namespace into Function entities (no graph query).

std::vector<Function> discover_functions()

Group nodes by namespace into Function entities (queries the graph).

std::vector<ServiceInfo> discover_services()

Discover all services in the ROS 2 graph with schema enrichment.

std::vector<ActionInfo> discover_actions()

Discover all actions (synthesised from /_action/send_goal services).

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 (cache lookup).

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 (cache lookup).

void set_topic_data_provider(TopicDataProvider *provider)

Provide the topic data provider used to enrich Apps with publish/subscribe topics. Pointer must outlive this provider.

void set_type_introspection(ros2_medkit_serialization::TypeIntrospection *introspection)

Provide the type introspection used to enrich service/action schemas. Pointer must outlive this provider.

void refresh_topic_map()

Rebuild the cached <node_fqn> -> ComponentTopics map from the topic data provider. Called by the gateway’s refresh path.

bool is_topic_map_ready() const

True once the topic map has been built at least once.

struct RuntimeConfig

Per-introspection configuration knobs.

Public Members

bool create_functions_from_namespaces = {true}

Map ROS 2 namespaces to Function entities when true.