ROS: Basic Commands / Cheat Sheet


There are several commands that can help you navigate different pieces of ROS. Like an operating system, ROS sets up services that communicate between each other. Some are setup to communicate, but only if someone wants to listen. These communication channels go by the name of “topics”.

Initially, this robot operating system is not working. You need to run roslaunch first. This command requires you to specify the robot type and then the set of services to launch. For the turtlebot, one such example is

> roslaunch turtlebot_bringup minimal.launch

which says that the robot to bring online is the turtlebot one and that the minimal amount of services necessary should be run. The minimal.launch file has been pre-specified for you. It is possible to write your own with a custom set of robot services.

Once you've launched ROS, then you can access the services (e.g. topics) by using the rostopic command. For example

> rostopic list

will list all of the topics available. For the turtlebot, you should see that one such service is /mobile_base/events/bumper which communicates whenever the front bumper is triggered. Running the command

> rostopic echo /mobile_base/events/bumper

and then hitting the front bumpers will output a message whenever that bumper is hit. Running the command

> rostopic type /mobile_base/events/bumper

will output the different fields of the bumper event notification structure. If you write code to listen to this topic and get messages from it, the messages will take the fields specified in the rostopic type output.

The rostopic command has several other options described in the documentation.