1.1.3 ROS Topics

Course subject(s) Module 1. ROS Essentials

After learning about nodes, it’s important to know how topics work. Topics are the information highway of ROS. In this lesson, we will learn more about how they are structured and how we can inspect them using the same approach as with nodes.

Note: You can try all the commands in this video after building your own ROS application at a slightly later point this week. These commands will only work when you have a “running ROS application”.

Summary:

Ros topics transport information between nodes. This information is organized as a data structure and can have different data types. Topics can be identified by their name and their type. You can think of topics as strongly typed message buses. Any node can connect to it to send or receive data, as long as they are the right type.

As with nodes, there are three ways to inspect topics:

Don’t forget to source your workspace if you want to use ROS commands! If you’ve followed the procedure under the Course Standards section correctly, you only need to execute the following in the shell:
$ source $HOME/hrwros_ws/devel/setup.bash

  • Display a list of all topics that are currently being exchanged between active nodes
    rostopic list
  • Display information about the data structure of a specific topic
    rostopic info <topic_name>
  • Print the current content of a topic in the terminal
    rostopic echo <topic_name>

Important detail: Do not forget the “/” before node and topic names!

Creative Commons License
Hello (Real) World with ROS - Robot Operating System by TU Delft OpenCourseWare is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://online-learning.tudelft.nl/courses/hello-real-world-with-ros-robot-operating-systems//.
Back to top