[Documentation] [TitleIndex] [WordIndex

rostopic command-line tool

The rostopic command-line tool displays information about ROS topics. Currently, it can display a list of active topics, the publishers and subscribers of a specific topic, the publishing rate of a topic, the bandwidth of a topic, and messages published to a topic. The display of messages is configurable to output in a plotting-friendly format.

rostopic, like several other ROS tools, uses YAML-syntax at the command line for representing the contents of a message. For information on how to use this YAML syntax for commands like rostopic pub, please see the YAML command line guide.

This is the current list of supported commands:

rostopic bw     display bandwidth used by topic
rostopic delay display delay for topic which has header
rostopic echo   print messages to screen
rostopic find   find topics by type
rostopic hz     display publishing rate of topic
rostopic info   print information about active topic
rostopic list   print information about active topics
rostopic pub    publish data to topic
rostopic type   print topic type

These are described in greater detail in the following sections.

rostopic bw

rostopic delay

See also a related question thread.

rostopic echo

rostopic find

rostopic hz

rostopic info (ROS 0.10)

rostopic list

rostopic pub

There are three ways to specify the message fields:

There are three modes that rostopic can publish in:

Options:

Data types are be interpreted using YAML-syntax, e.g. 1 is an integer, 1.0 is a float, and foo is a string.

For example:

$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

or on Windows, replace single quotes with double quotes New in Melodic

$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  "{linear:  {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0, z: 0.0}}"

Publish a geometry_msgs/Twist message with a rate of 10Hz. For more a description of the YAML format and some tips for using it on the command-line with ROS, please see YAML command line.

rostopic type

Roadmap

rostopic is a stable command-line tool within the ROS core toolchain. The underlying code may undergo refactoring for easier library use, but the external API is expected to be fairly stable.

One area in which rostopic is expected to see development is with the output format of rostopic echo and input format of rostopic pub. The planned feature is to make both compatible with YAML syntax, which will enable

This feature is currently not scheduled.


2024-06-15 13:47