ROS 2 Command-line Cheatsheet

If you’re a casual ROS 2 user, or haven’t quite got everything command-line quite at your fingertips yet, this cheatsheet may help with a bunch of the commonly used command-line operations. We have been keeping track of these for ourselves, but figured they might be useful for the community at large as well!

ROSDEP INSTALL

Used to install all the dependencies for packages you are about to build. From the root of your workspace:

rosdep install --from-paths src --ignore-src

ROS PACKAGE CREATION

Used to create a new package inside a workspace.

PYTHON:

ros2 pkg create --build-type ament_python

ROS TOPICS

To list all published ROS topics:

ros2 topic list

To get information about a specific ROS topic:

ros2 topic info <topic>

ROS SERVICES

To list all published ROS services:

ros2 service list

To get type information about a specific ROS service:

ros2 service type <service>

To call a service:

ros2 service call /service_name service_type "{parameter1: value1, parameter2: value2}"

ROS MESSAGES

To get info about a message type:

ros2 interface show <package_name>/<message_type>