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

How to find list of messages published on particular topic?

asked 2016-05-31 10:38:22 -0500

siddhesh gravatar image

updated 2016-05-31 10:39:09 -0500

I am using turtlebot in gazebo which uses "scan" message for publishing laser scan data, by using rostopic type scan command I can find out type of the message i.e. sensor_msgs/LaserScan , Is there way to find names of all the messages published on particular topic ?

For example, Is there any way to find out that message named "scan" is published by turtlebot knowing only the topic name i.e. sensor_msgs/LaserScan ?

Thanks in advance.

edit retag flag offensive close merge delete


I'm a little confused. Scan is the topic name, sensor_msgs/LaserScan is the message type. Are you asking if there is a way to search for topic names based on message type?

Icehawk101 gravatar image Icehawk101  ( 2016-05-31 12:22:36 -0500 )edit

Also, only one type of message can be published to a particular topic.

Icehawk101 gravatar image Icehawk101  ( 2016-05-31 12:26:45 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-05-31 12:24:59 -0500

If you are trying to do what I think you are, find all of the topics publishing or subscribing sensor_msgs/LaserScan messages, then the answer is yes. Enter rostopic find sensor_msgs/LaserScan in a terminal window and it will list the topics using the sensor_msgs/LaserScan message.

edit flag offensive delete link more


@Icehawk : Thanks. That's exactly what I needed. Sorry for poor wording.

siddhesh gravatar image siddhesh  ( 2016-05-31 22:56:19 -0500 )edit

Not a problem. The nomenclature takes a bit of getting used to. Every time I write a paper or document about ROS the first section is always a glossary :P

Icehawk101 gravatar image Icehawk101  ( 2016-06-01 07:14:48 -0500 )edit

answered 2016-05-31 10:57:23 -0500

MarkyMark2012 gravatar image

rostopic list

This will list all topics that are being broadcast


edit flag offensive delete link more


@ Mark : Yes, but I want to know the name by which the message is published, if I use rostopic list it shows sensor_msgs//LaserScan not name of the message ("scan").

siddhesh gravatar image siddhesh  ( 2016-05-31 11:31:52 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-31 10:38:22 -0500

Seen: 1,189 times

Last updated: May 31 '16