Add get_node_names and get_subscriptions_info_by_topic#126
Open
kristophM wants to merge 1 commit into
Open
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two safe wrappers on
r2r::Nodeto complete the graph-introspection surface alongside the existingget_topic_names_and_typesandget_publishers_info_by_topic:Node::get_subscriptions_info_by_topic(topic, no_mangle)— wrapsrcl_get_subscriptions_info_by_topic. ReturnsVec<TopicEndpointInfo>for the subscriber side, structurally identical to the existing publisher-side method.Node::get_node_names()— wrapsrcl_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,finithe 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_handleispub(crate).This is shipped under a temporary fork pin on our side; we'd much rather depend on the upstream crate.
Test plan
r2r::Nodeshows up inget_node_names()output; topic-graph snapshots now carry subscriber endpoint info matchingros2 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.