Where can I find the imlementation of the Graph API in ros 2 ? Is it in the DDS layers or rclcpp layers ?
We have some ROS graph information available through our C++ and Python API’s:
- http://docs.ros2.org/ardent/api/rclcpp/index.html (search for “introspecting the ROS graph”)
- https://github.com/ros2/rclpy/blob/5b219126664ee4bed352aa9ebd15e92d93d0f69c/rclpy/rclpy/node.py#L290-L297 (sorry no docs for these yet)
Thanks for the link. I have some doubt about this Graph API. Does it maintain any kind of Graph Data strucutre which stores all the ros 2 nodes created in the memory ? Can I obtain information regarding nodes created using these ?
You can get the names of the nodes on the system with this method:
That is part of our generic C api, unfortunately we don’t have that exposed in our C++ API yet, but we will in the future.
As for an “object-oriented” data structure with nodes and all of their properties, we don’t have that yet either, though there’s nothing preventing us from doing that. We haven’t exchanged a lot of information about nodes yet, other than what we can collect from DDS already, because we’ve still got some design work to do on ensuring node name uniqueness and that will impact how we communicate other details about nodes across the graph.