RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/jazzy/Concepts/Basic/About-Client-Libraries.html#community-maintained
Apache License 2.0
335 stars 72 forks source link

A way to get the list of topics and their types #816

Closed RalphCodesTheInternet closed 3 years ago

RalphCodesTheInternet commented 3 years ago

With rclpy and rclcpp there are ways you can get a list of all the topics and their types. I could not find a way of doing it with rclnodejs. It would be a great feature to add

wayneparrott commented 3 years ago

See the Node#getTopicNamesAndTypes() method http://robotwebtools.org/rclnodejs/docs/0.20.0/Node.html

I believe this is equivalent to using ros2 cli: ros2 topic list ros2 topic info <topic> ros2 topic type <typename>

//edited Also check out this example for exposure to additional useful api: https://github.com/RobotWebTools/rclnodejs/blob/develop/example/ros-graph-example.js I confirmed that while this example includes it's own publishers, subscribers and services, the api provides access to the full ros graph.

RalphCodesTheInternet commented 3 years ago

This is exactly what I was looking for. Thank you so much!