Skip to content

Add get_node_names and get_subscriptions_info_by_topic#126

Open
kristophM wants to merge 1 commit into
sequenceplanner:masterfrom
RobotOpsInc:feat/graph-introspection-wrappers
Open

Add get_node_names and get_subscriptions_info_by_topic#126
kristophM wants to merge 1 commit into
sequenceplanner:masterfrom
RobotOpsInc:feat/graph-introspection-wrappers

Conversation

@kristophM

Copy link
Copy Markdown

Adds two safe wrappers on r2r::Node to complete the graph-introspection surface alongside the existing get_topic_names_and_types and get_publishers_info_by_topic:

  • Node::get_subscriptions_info_by_topic(topic, no_mangle) — wraps rcl_get_subscriptions_info_by_topic. Returns Vec<TopicEndpointInfo> for the subscriber side, structurally identical to the existing publisher-side method.
  • Node::get_node_names() — wraps rcl_get_node_names. Returns fully-qualified node names (<namespace>/<name>, with / for the root namespace).

Both follow the structural pattern set by get_publishers_info_by_topic (#80): zero-init the rcl/rmw struct, call the C function, convert, fini the array regardless of success.

Why

Without these two wrappers, r2r downstream code that does graph discovery (e.g. introspection agents, topic-graph dashboards) can see publishers per topic but cannot see subscribers, and cannot enumerate which nodes are running. We have hit this in our own ROS2 telemetry agent (RobotOpsInc/robot_agent) — the missing wrappers were the only gap stopping us from delivering a complete node-graph snapshot, and there is no obvious workaround because node_handle is pub(crate).

This is shipped under a temporary fork pin on our side; we'd much rather depend on the upstream crate.

Test plan

  • Builds against ROS2 Jazzy via the same r2r build path as existing graph methods.
  • Smoke-tested downstream: a freshly-created r2r::Node shows up in get_node_names() output; topic-graph snapshots now carry subscriber endpoint info matching ros2 topic info -v <topic> (verified at downstream consumer side under RobotOpsInc/robot_agent#81).

Happy to add r2r-internal tests or adjust the style/naming if helpful.

These complete the graph-introspection surface alongside the existing
get_topic_names_and_types and get_publishers_info_by_topic. Patterns
mirror get_publishers_info_by_topic for the subscriber-side wrapper
and the rcl_get_node_names + rcutils_string_array_fini lifecycle for
the node-list wrapper.

Refs sequenceplanner#80 (publisher-info, same shape).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant