ROS Cheat Code..!

ROS Cheat Code

roswtf - example

  1. File system Command-line Tools

rospack/rosstack - A tool inspecting packages/stacks

roscd - Changes directories to a package or stack.

rosls - Lists package or stack information.

roscreate-pkg - Create a new ROS package.

roscreate-stack - Create a new ROS stack

rosdep - Installs ROS package system dependencies.

rosmake - Builds a ROS package.

roswtf - Displays errors and warning about a running ROS system or launch file. (Really Helped me some time I get my ROS window close without any warning).


rxdeps - Displays package structure and dependencies.

eg:-
$rospack find [package]

$roscd [package[/subdir]]

$rosls [package[/subdie]]

$roscreate-pkg [package_name]

$rosmake [package]

$rosdep install [package]

$roswtf or roswtf [file]

$rxdeps [options]

  1. Common Command-line Tools

  • roscore (collection of nodes & lib) [master,parameter server, rosout]

  • rosmsg/rossrv (Displays Messages/Services) [rosmsg show (Display fields in the msg.)/users (Search for code) / md5 (Disply message in md5 sum) / pacakge (list all messages in the package)], rosnode packages (List all the package with message

  • rosrun [rosrun pacakge executable eg:- rosrun turtlesim turtlesim_node

  • rosnode
    rosnode ping -
    Test connectivity to node

rosnode list - List active node

rosnode info - info about node

rosnode machine - list running node in the machine

rosnode kill - Kills a running node.

  • roslaunch -starting node remotelly or locally

roslaunch -p 1238 package filename.launch (Launch in a different port)

roslaunch pacakge filename.launch (Launch file in a package)

roslaunch --local package filename.launch (Launch on the local nodes)

  • rostopic (Debug [ROStopic, publishers, subscribers, publishing rate, message])

rostopic bw (Display bandwidth)

rostopic echo (Print messages in the screen)
rostopic hz (
Display publishing rate frequency)

rostopic list (Print active topics)

rostopic pub (Publish data to topic)

rostopic type (Print topic type ..! )

rostopic find (Find topic type)

Eg:-
Publish hello at 10 Hz:- $rostopic pub -r 10 /topic_name std_msg/String hello

Clear screen after publishing message : $rostopic echo -c /topic_name

Display message that match a given Python expression : $rostopic echo --filter "m.data == 'foo'"/topic_name

Pipe the output of rostopic to rosmsg to view the mesg type: $rostopic type ?topic_name | rosmsg show

  • rosparam (Tool for getting and setting ROS parameters on parameters server using YAML-encoded files)

rosparam ser/get/load/dump/delete/list (Hope you got from the meaning of commands)

Eg:

List all parameters in the namespace : $rosparam list /namespace

Setting a list with one as a string , integer, and float : $rosparam set /foo "['1',1,1.0]"

Dump only the parameters in a specific namespace to file: $rosparam dump dump.yaml /namespace

  • rosservice (Tool for listing and querying ROS services)

rosservice list/node/call/arg/type/uri/find .......... :)

Eg:

Call a service from the command-line : $ rosservice call /add_two_int 1 2

Pipe the output of rosservice to rossrv to view the service type: $rosservice type add_two_ints | rossrv show
Display all services of particular type: $ rosservice find rospy_tutorials/AddTwoInts

  1. Logging Command-Line tools

  • rosbag .......!
    This is a set of tool for recording from and playing back to ROS topics. It is intended to be high perfomance and avoids deserialization and reserialization of 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.

Example:

Record all topics: $rosbag record -a

Record selected topics: $rosbag record topic1 topic2


rosbag play will take the contents of one or more bag file, and play them back in a time-synchronized fasion.

Example


Replay all message without waiting: $rosbag play -a demo_log.bag

Replay several bag file at once: $rosbag play demo1.bag demo2.bag


  1. Graphical Tools

  • rxgraph

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

Usage : $rxgraph

  • rxplot

A tool for plotting data from one or more ROS topic fileds using matplotlib

Ex:

To graph the data in a different plane: $rxplot /topic1/field1 /topic2/field2

To graph the data all on the same plot: $rxplot /topic1/field1, /topic2/field2

To graph the multiple fields of a message: $rxplot /topic1/field1 : field2 :field3

  • rxbag

A tool to visualizing, inspecting, and replaying histories (bag files) of ROS messages.

Usage:

$rxbag bag_file.bag

  • rxconsole

A tool for displaying and filtering messages published on rosout.
Usage:
$rxconsole

tf Command-line Tools

tf_echo
A tool that prints the information about a particular transformation between a source_frame and a target_frame.


Usage: $rosrun tf tf_echo <source_frame> <target_frame>

Examples:

To echo the transformation between /map and /odom: $rosrun tf tf_echo /map/odem

view frame

A tool for visualizing the full tree of co-ordinate tranformations.

Ex:

$rosrun tf view_Frames

$evince frames.pdf