ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ROS2 list publishers and subscribers

asked 2021-10-02 08:24:59 -0500

Darkproduct gravatar image

updated 2021-10-02 08:27:08 -0500

When you do rostopic info /some/topic in ROS1 it lists all the nodes that publish or subscribe to this topic.

ROS2 does the same, except it only output how many publisher or subscribers are on this topic. Is it somehow possible to get the full list of all publishers and subscribers?

$ ros2 topic info /odom
Type: nav_msgs/msg/Odometry
Publisher count: 0
Subscription count: 1

I mean it is possible to use ros2 node info on all nodes an see if they are subscribed, but this is tedious if you have a large number of nodes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-10-02 08:31:27 -0500

Darkproduct gravatar image

Just found the solution.

Use --verbose like this:

$ ros2 topic info --verbose /odom
Type: nav_msgs/msg/Odometry

Publisher count: 0

Subscription count: 1

Node name: controller_server
Node namespace: /
Topic type: nav_msgs/msg/Odometry
Endpoint type: SUBSCRIPTION
GID: 01.0f.17.62.fa.9e.00.00.01.00.00.00.00.00.8d.04.00.00.00.00.00.00.00.00
QoS profile:
  Reliability: RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT
  Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
  Liveliness lease duration: 2147483651294967295 nanoseconds
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-10-02 08:24:59 -0500

Seen: 13,826 times

Last updated: Oct 02 '21