You are on page 1of 2

ROS Cheat Sheet rosrun Examples:

rosrun allows you to run an executable in an arbitrary package Publish hello at 10 Hz:
Filesystem Command-line Tools without having to cd (or roscd) there first. $ rostopic pub -r 10 /topic name std msgs/String hello
Clear the screen after each message is published:
rospack/rosstack A tool inspecting packages/stacks. $ rostopic echo -c /topic name
roscd Changes directories to a package or Usage: Display messages that match a given Python expression:
stack. $ rosrun package executable $ rostopic echo --filter "m.data==’foo’" /topic name
rosls Lists package or stack information. Pipe the output of rostopic to rosmsg to view the msg type:
roscreate-pkg Creates a new ROS package. Example: $ rostopic type /topic name | rosmsg show
roscreate-stack Creates a new ROS stack. Run turtlesim:
rosdep Installs ROS package system dependen- $ rosrun turtlesim turtlesim node
cies. rosparam
rosmake Builds a ROS package.
roswtf Displays a errors and warnings about a rosnode A tool for getting and setting ROS parameters on the
running ROS system or launch file. parameter server using YAML-encoded files.
rxdeps Displays package structure and depen- Displays debugging information about ROS nodes, including
dencies. publications, subscriptions and connections. Commands:
rosparam set Set a parameter.
Usage: Commands: rosparam get Get a parameter.
rosnode ping Test connectivity to node. rosparam load Load parameters from a file.
$ rospack find [package] rosnode list List active nodes.
$ roscd [package[/subdir]] rosparam dump Dump parameters to a file.
rosnode info Print information about a node. rosparam delete Delete a parameter.
$ rosls [package[/subdir]] rosnode machine List nodes running on a particular ma-
$ roscreate-pkg [package name] rosparam list List parameter names.
chine.
$ rosmake [package] rosnode kill Kills a running node.
$ rosdep install [package]
$ roswtf or roswtf [file] Examples:
Examples:
$ rxdeps [options] List all the parameters in a namespace:
Kill all nodes:
$ rosnode kill -a $ rosparam list /namespace
Common Command-line Tools List nodes on a machine: Setting a list with one as a string, integer, and float:
roscore $ rosnode machine aqy.local $ rosparam set /foo "[’1’, 1, 1.0]"
A collection of nodes and programs that are pre-requisites of a Ping all nodes: Dump only the parameters in a specific namespace to file:
ROS-based system. You must have a roscore running in order $ rosnode ping --all $ rosparam dump dump.yaml /namespace
for ROS nodes to communicate.
roslaunch
roscore is currently defined as: rosservice
master Starts ROS nodes locally and remotely via SSH, as well as
parameter server setting parameters on the parameter server.
A tool for listing and querying ROS services.
rosout
Examples: Commands:
Usage: Launch on a different port: rosservice list Print information about active services.
$ roscore $ roslaunch -p 1234 package filename.launch rosservice node Print the name of the node providing a
Launch a file in a package: service.
rosmsg/rossrv $ roslaunch package filename.launch rosservice call Call the service with the given args.
rosmsg/rossrv displays Message/Service (msg/srv) data Launch on the local nodes: rosservice args List the arguments of a service.
structure definitions. $ roslaunch --local package filename.launch rosservice type Print the service type.
Commands: rosservice uri Print the service ROSRPC uri.
rosmsg show Display the fields in the msg. rosservice find Find services by service type.
rosmsg users Search for code using the msg. rostopic
rosmsg md5 Display the msg md5 sum. A tool for displaying debug information about ROS topics,
rosmsg package List all the messages in a package. including publishers, subscribers, publishing rate, and
rosnode packages List all the packages with messages. messages. Examples:
Call a service from the command-line:
Examples: Commands:
rostopic bw Display bandwidth used by topic. $ rosservice call /add two ints 1 2
Display the Pose msg:
rostopic echo Print messages to screen. Pipe the output of rosservice to rossrv to view the srv type:
$ rosmsg show Pose
rostopic hz Display publishing rate of topic. $ rosservice type add two ints | rossrv show
List the messages in nav msgs:
rostopic list Print information about active topics. Display all services of a particular type:
$ rosmsg package nav msgs
rostopic pub Publish data to topic. $ rosservice find rospy tutorials/AddTwoInts
List the files using sensor msgs/CameraInfo:
$ rosmsg users sensor msgs/CameraInfo rostopic type Print topic type.
rostopic find Find topics by type.
Logging Command-line Tools rxbag
rosbag A tool for visualizing, inspecting, and replaying histories (bag
This is a set of tools for recording from and playing back to files) of ROS messages.
ROS topics. It is intended to be high performance and avoids
deserialization and reserializationof the messages.
rosbag record will generate a “.bag” file (so named for
historical reasons) with the contents of all topics that you pass
to it.
Examples:
Record all topics:
$ rosbag record -a
Record select topics:
$ rosbag record topic1 topic2

rosbag play will take the contents of one or more bag file, Usage:
and play them back in a time-synchronized fashion. $ rxbag bag file.bag
Examples:
Replay all messages without waiting: rxconsole
$ rosbag play -a demo log.bag A tool for displaying and filtering messages published on
Replay several bag files at once: rosout.
$ rosbag play demo1.bag demo2.bag

Graphical Tools
rxgraph
Displays a graph of the ROS nodes that are currently running,
as well as the ROS topics that connect them.

Usage:
$ rxconsole

Usage: tf Command-line Tools


$ rxgraph
tf echo
A tool that prints the information about a particular
rxplot transformation between a source frame and a target frame.
A tool for plotting data from one or more ROS topic fields
using matplotlib.
Usage:
$ rosrun tf tf echo <source frame> <target frame>

Examples:
To echo the transform between /map and /odom:
$ rosrun tf tf echo /map /odom

view frames
Examples:
To graph the data in different plots: A tool for visualizing the full tree of coordinate transforms.
$ rxplot /topic1/field1 /topic2/field2
To graph the data all on the same plot: Usage:
$ rxplot /topic1/field1,/topic2/field2 $ rosrun tf view frames
To graph multiple fields of a message: $ evince frames.pdf
$ rxplot /topic1/field1:field2:field3
Copyright
c 2010 Willow Garage

You might also like