0% found this document useful (0 votes)
47 views10 pages

Ros2 Humble Cheat Sheet

The ROS 2 Commands Cheat Sheet provides a comprehensive overview of the command-line interface (CLI) for ROS 2, detailing various commands, verbs, and their arguments for managing actions, bags, components, controls, daemons, interfaces, nodes, parameters, services, topics, and security. It includes examples for each command to facilitate understanding and usage. Additionally, it covers the colcon tool for building and managing ROS 2 packages.

Uploaded by

jajgeraedts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views10 pages

Ros2 Humble Cheat Sheet

The ROS 2 Commands Cheat Sheet provides a comprehensive overview of the command-line interface (CLI) for ROS 2, detailing various commands, verbs, and their arguments for managing actions, bags, components, controls, daemons, interfaces, nodes, parameters, services, topics, and security. It includes examples for each command to facilitate understanding and usage. Additionally, it covers the colcon tool for building and managing ROS 2 packages.

Uploaded by

jajgeraedts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ROS 2 Commands Cheat Sheet

General Format of ROS 2 CLI:------ Verbs Verbs


The keyword ‘ros2‘ is the unique entry list: identify all the actions in the record <topic_name>: record the
point for the CLI. ROS graph data published to topic
Every ROS 2 command starts with the info <action_name>: introspect info <bag_file_name>: get details
ros2 keyword, followed by a command, about an action about bag file
a verb, and possibly positional/optional send_goal <action_name> play <bag_file_name>: replaying
arguments. <action_type> <values>: send an the bag file
ros2 [command] [verb] action goal Arguments
<positional-argument> Arguments --clock: publish to /clock at a specific
<optional-arguments> -f: echo feedback messages for the frequency in Hz
goal -l: enable loop playback when
For Help on ROS 2 CLI commands-
Examples playing a bag file
$ ros2 [command] --help
$ ros2 action list -r: rate to play back messages
$ ros2 [command] [verb] -h
$ ros2 action info -s: storage identifier to be used,
/turtle1/rotate_absolute defaults to 'sqlite3'
Action—-----------------------------------------
$ ros2 action send_goal --topics: topics to replay, separated
A type of message-based
/turtle1/rotate_absolute by space
communication that allows a client node
turtlesim/action/RotateAbsolute --storage-config-file: path to a yaml
to request a specific goal to be
"{theta: 1.57}" file defining storage specific
achieved by a server node, and receive
$ ros2 interface show configurations
feedback and/or a result from the server
turtlesim/action/RotateAbsolute -a: recording all topics, required if no
node once the goal has been
topics are listed explicitly or through
completed. Bag—------------------------------—----------- a regex
A file format used to record and -e: recording only topics matching
Command playback ROS 2 topics. provided regular expression
ros2 action [verb] <arguments>
-x: exclude topics matching provided
Command regular expression
ros2 bag [verb] <arguments>

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
-o: destination of the bag file to types: output a list of components Verbs
create registered in the ament index list_controller_types: output the
Examples unload: unload a component from a available controller types and their
$ ros2 bag record /turtle1/cmd_vel container node base classes
$ ros2 bag record -o my_bag Arguments list_controllers: output the list of
/turtle1/cmd_vel /turtle1/pose -n: component node name loaded controllers, their type, and
$ ros2 bag info <bag_name.db3> --node-namespace: component status
$ ros2 bag play <bag_name.db3> node namespace list_hardware_interfaces: output
--log-level: component node log the list of loaded controllers, their
Component—--------------------------------- level type and status
A modular unit of software that -r: component node remapping rules, load_controller: load a controller in
encapsulates functionality, data, and in the 'from:=to' form a controller manager
communication. -p: component node parameters, in reload_controller_libraries: reload
the 'name:=value' form controller libraries
**ROS 2 Components ≈ ROS 1
Examples set_controller_state: adjust the
Nodelets
$ ros2 component list state of the controller
$ ros2 component types switch_controllers: switch
Command
$ ros2 component load controllers in a controller manager
ros2 component [verb]
/ComponentManager composition unload_controller: unload a
<arguments>
composition::Talker controller in a controller manager
Verbs
view_controller_chains: generates
list: output a list of running
Control—--------------------------------------- a diagram of the loaded chained
containers and components
A control framework to simplify controllers
load: load a component into a
integrating new hardware and Arguments
container node
overcome some drawbacks. -c: name of the controller manager
standalone: run a component into its
ROS node
own standalone container node Command
ros2 control [verb] <arguments>

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
--claimed-interfaces: list controller's status: output the status of the Extension Points—----------------------—-
claimed interfaces daemon Lists extension points.
--required-state-interfaces: list stop: stop the daemon if it is running
controller's required state interfaces Examples Command
--required-command-interfaces: list $ ros2 daemon start ros2 extension_points
controller's required command $ ros2 daemon status <arguments>
interfaces $ ros2 daemon stop Arguments
Examples --all, -a: show extension points which
$ ros2 control list_controllers Doctor —--------------------------------------- failed to be imported
$ ros2 control Checks all aspects of ROS 2, and --verbose, -v: show more
list_hardware_components -h warns about possible errors and information for each extension point
$ ros2 control reasons for issues. Examples
list_hardware_interfaces $ ros2 extension_points
Command $ ros2 extension_points --all
Daemon—-------------------------------------- ros2 doctor <arguments>
A system-level process that runs in the Arguments Extension—------------------------------------
background and provides various --report: print all warnings Lists extensions of a package.
services to ROS 2 nodes and -rf: print reports of failed checks only
components. -iw: include warnings as failed Command
checks. Warnings are ignored by ros2 extensions <arguments>
**ROS 2 Daemon ≈ ROS 1 Master Arguments
default
Examples -a: show extensions which failed to
Command load or are incompatible
$ ros2 doctor
ros2 daemon [verb] -v: show more information for each
$ ros2 doctor --report
Verbs extension
$ ros2 doctor --include-warnings
start: start the daemon if it isn't Examples
running $ ros2 extensions
$ ros2 extensions --all

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
Interface—------------------------------------- single file, that can launch with only one before all executables. It must be
ROS applications typically communicate command line. wrapped in quotes if it contains
through interfaces of one of three types: spaces (e.g. --launch-prefix 'xterm -e
messages, services, and actions. Command gdb -ex run --args').
ros2 launch [package_name] --launch-prefix-filter
Command [launch_file_name] <arguments> LAUNCH_PREFIX_FILTER: regex
ros2 interface [verb] Argument pattern for filtering which executables
Verbs -n, --noninteractive: run the launch the --launch-prefix is applied to by
list: list all interface types available system non-interactively, with no matching the executable name.
package <package_name>: output terminal associated Examples
a list of available interface types -d, --debug: put the launch system in $ ros2 launch
within one package debug mode, provides more verbose my_first_launch_file.launch.py
packages: output a list of packages output. $ ros2 launch
that provide interfaces -p, --print, --print-description: print my_first_launch_file.launch.py
show <interface_type>: output the the launch description to the console --noninteractive
interface definition without launching it. $ ros2 launch
Examples -s, --show-args, my_first_launch_file.launch.py
$ ros2 interface list --show-arguments: show arguments --show-all-subprocesses-output
$ ros2 interface package turtlesim that may be given to the launch file.
$ ros2 interface show --show-all-subprocesses-output, Lifecycle—-------------------------------------
turtlesim/msg/Pose -a: show all launched subprocesses Manages node containing a state
$ ros2 interface packages output by overriding their output machine with a set of predefined states.
configuration using the These states can be changed by
Launch File—--------------------------------- OVERRIDE_LAUNCH_PROCESS_ invoking a transition id which indicates
Allows to execute multiple nodes with OUTPUT envvar. the succeeding consecutive state.
their own complete configuration --launch-prefix LAUNCH_PREFIX:
(remapping, parameters, etc.) in a prefix command, which should go Command
ros2 lifecycle [verb]

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
Verbs Node—------------------------------------------ Verbs
list <node_name>: output a list of An executable within a ROS 2 package list: gives the names of all running
available transitions that performs computation and uses nodes
get: get lifecycle state for one or client libraries to communicate with info <node_name>: access more
more nodes other nodes information about a node
nodes: output a list of nodes with Examples
lifecycle Command $ ros2 node info /my_turtle
set: trigger lifecycle state transition ros2 run [package_name]
Examples [executable_name] <arguments> Package—--------------------------------------
$ ros2 lifecycle list Arguments An organisational unit for ROS 2 code
$ ros2 lifecycle get --prefix PREFIX: prefix command, and promote software reuse.
before the executable. Must be
Multicast—------------------------------------- wrapped in quotes if it contains Create ROS2 package
In order to communicate successfully spaces $ cd <workspace_name>/src
via DDS, the used network interface –ros-args: pass arguments while Python package
has to be multicast enabled. executing a node $ ros2 pkg create –build-type
–remap: rename topics name while ament_python [package_name]
Command executing node C++ package
ros2 multicast [verb] Examples $ ros2 pkg create –build-type
Verbs $ ros2 run turtlesim turtlesim_node ament_cmake [package_name]
receive: receive a single UDP $ ros2 run turtlesim turtlesim_node
multicast packet --ros-args --remap Parameter—-----------------------------------
send: send a single UDP multicast __node:=my_turtle A list of configuration values attached to
packet a node.
Examples Command
$ ros2 multicast receive ros2 node [command] Command
$ ros2 multicast send ros2 param [verb] <arguments>

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
Verbs $ ros2 param dump /turtlesim > create_permission: create
param list: see the parameters turtlesim.yaml permission
belonging to nodes $ ros2 param load /turtlesim generate_artifacts: generate keys
param get <node_name> turtlesim.yaml and permission files from a list of
<parameter_name>: display the identities and policy files
type and current value of a rqt tools—----------------------------------—- generate_policy: generate XML
parameter The rqt tools allow graphical policy file from ROS graph data
param set <node_name> representations of ROS nodes, topics, list_enclaves: list enclaves in
<parameter_name> <value>: messages, and other information. keystore
change a parameter’s value at Examples
runtime Command $ ros2 security create_keystore
ros2 param dump <node_name>: rqt_graph: view the nodes and demo_keystore
view a node’s current parameter topics that are active $ ros2 security create_enclave
values rqt: brings up a display screen, demo_keystore /talker_listener/talker
ros2 param load <node_name> drop-down menu items to visualize $ ros2 security create_enclave
<parameter_file>: load parameters various sources of data demo_keystore
from a file to a currently running node /talker_listener/listener
Arguments Security—--------------------------------------
--output-dir: the absolute path to The sros2 package provides the tools Service—---------------------------------------
save the generated parameters file and instructions to use ROS 2 on top of Communication-based on a
Examples DDS-Security. call-and-response model, services only
$ ros2 param list provide data when they are specifically
$ ros2 param get /turtlesim Command called by a client.
background_g ros2 security [verb]
$ ros2 param set /turtlesim Verbs Command
background_r 150 create_enclave: create enclave ros2 service [verb] <arguments>
create_keystore: create keystore

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
Verbs Command $ ros2 topic pub --once
list: return a list of all the services ros2 topic [verb] <arguments> /turtle1/cmd_vel
currently active in the system Verbs geometry_msgs/msg/Twist "{linear:
type <service_name>: find out the list: return a list of all the topics {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0,
type of a service info <topic_name>: access more y: 0.0, z: 1.8}}"
find <type_name>: to find all the information about topics $ ros2 topic hz /turtle1/pose
services of a specific type echo <topic_name>: see the data
call <service_name> being published on a topic Workspace—----------------------------------
<service_type> <arguments>: call pub <--once> <topic_name> Directory containing ROS 2 packages.
a service <msg_type> '<args>': publish data
Arguments onto a topic directly from the Create a ROS 2 workspace directory
-r: repeat the call at a specific rate in command line $ mkdir -p <workspace_name>/src
Hz Arguments Build & Source workspace
Examples -r: publishing rate in Hz (default: 1) $ cd <workspace_name>
$ ros2 service list -p: only print every N-th published $ colcon build
$ ros2 service find message $ source install/setup.bash
std_srvs/srv/Empty -1, --once: publish one message and
$ ros2 service call /spawn exit
turtlesim/srv/Spawn "{x: 2, y: 2, theta: -t: publish this number of times and
0.2, name: ''}" exit
$ ros2 interface show --keep-alive: keep publishing node
turtlesim/srv/Spawn alive for N seconds after the last msg
Examples
Topic—------------------------------------------ $ ros2 topic info /turtle1/cmd_vel
Element of the ROS graph that acts as $ ros2 topic echo /turtle1/cmd_vel
a bus for nodes to exchange messages.

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
Colcon Tools—------------------------------- --symlink-install: use symlinks $ colcon build --symlink-install
colcon is a command line tool to instead of copying files from the $ colcon build --executor sequential
improve the workflow of building, testing source $ colcon build --packages-select
and using multiple software packages. --test-result-base my_pkg
Every colcon command starts with the TEST_RESULT_BASE: base path $ colcon build --parallel-workers 5
colcon keyword, followed by a verb and for all test results
possible arguments. --continue-on-error: continue colcon graph----------------------------------
colcon [verb] <argument> building other packages when a Generates a visual representation of the
For Help on colcon CLI commands- package fails to build package dependency graph.
$ colcon --help --executor sequential: process one
$ colcon [verb] -h package at a time Command
–executor parallel: process multiple colcon graph <arguments>
colcon build—---------------------------— jobs in parallel Arguments
Build a set of packages. --packages-select PKG_NAME: –density: output the density of the
select the packages with the passed dependency graph
Command names --legend: output a legend for the
colcon build <arguments> --packages-skip PKG_NAME: skip dependency graph
Arguments the packages with the passed names --dot: output topological graph in
--build-base BUILD_BASE: base --parallel-workers NUMBER: DOT (graph description language)
path for all build directories maximum number of jobs to process --dot-cluster: cluster packages by
--install-base INSTALL_BASE: in parallel. The default value is the their file system path
base path for all install prefixes number of logical CPU cores Examples
--merge-install: install prefix for all Examples $ colcon graph --density
packages instead of a $ colcon build $ colcon graph --legend
package-specific subdirectory in the $ colcon build –build-base build $ colcon graph --dot
install base $ colcon build –install-base install $ colcon graph --dot-cluster
$ colcon build –merge-install

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
colcon info---------------------------------— colcon list—--------------------------------— --install-base INSTALL_BASE:
Shows detailed information about Enumerates a set of packages. base path for all install prefixes
packages. --merge-install: install prefix for all
Command packages instead of a
Command colcon list <arguments> package-specific subdirectory in the
colcon info <arguments> Arguments install base
Arguments --topological-order, -t: order output --test-result-base
PKG_NAME: explicit package based on topological ordering TEST_RESULT_BASE: base path
names to only show their information --names-only, -n: output only the for all test results
--base-paths: the base paths to name of each package but not the --retest-until-fail N: rerun tests up to
recursively crawl for packages path and type N times if they pass.
--paths: the paths to check for a --paths-only, -p: output only the path --retest-until-pass N: rerun failing
package of each package but not the name tests up to N times.
--packages-select: only process a and type --abort-on-error: abort after the first
subset of packages Examples package with any errors.
--packages-skip: skip a set of $ colcon list --topological-order --return-code-on-test-failure: use a
packages $ colcon list --names-only non-zero return code to indicate any
Examples $ colcon list --paths-only test failure.
$ colcon info Examples
$ colcon info --paths ros2_ws/src/* colcon test—---------------------------------- $ colcon test --test-result-base
$ colcon info --packages-select Runs the tests for a set of packages. ./build-test
my_pkg $ colcon test --retest-until-fail 5
$ $ colcon info --base-paths Command $ colcon test --abort-on-error
pkg_dir_name colcon test <arguments> $ colcon test
Arguments --return-code-on-test-failure
--build-base BUILD_BASE: base
path for all build directories

www.theroboticsspace.com
ROS 2 Commands Cheat Sheet
colcon test-result-------------------------—
Summarises the results of previously
run tests.

Command
colcon test-result <arguments>
Arguments
--test-result-base
TEST_RESULT_BASE: base path
for all test results
--all: show all test result files
including the ones without
errors/failures.
--verbose: show additional
information for each error/failure.
--result-files-only: print only the
paths of the result files.
--delete: delete all result files.
--delete-yes: same as –delete
without an interactive confirmation.
Examples
$ colcon test-result --test-result-base
./build-test
$ colcon test-result -all
$ colcon test-result --result-files-only

www.theroboticsspace.com

You might also like