To start master node:
roscore- To run a node:
rosrun <package> <nodetype>- To run a node with a custom name
rosrun <package> <node> __name:=<nodename>- To list registered nodes:
rosnode list- To check whether a registered node is available:
rosnode ping <nodename>- To check a node info:
rosnode info /<nodename>- To check nodes/topics graph:
rosrun rqt_graph rqt_graph- To interact with topics via command line:
rostopic <cmd>- To list possible rostopic commands:
rostopic -h
- Listing available topics (optional argument shows more data)
rostopic list [-v]- Printing messages published on a topic
rostopic echo <topic>- Printing message types in a topic
rostopic type <topic>- Check the structure of a message type
rosmsg show <type>- Show directly topic message structure
rosmsg show $(rostopic type <topic>)- Alternative
rostopic type <type> | rosmsg show- Publish manually content
rostopic pub -1 <topic> <msg_type> -- <args>In previous command
- The
-1option indicates that only one message should be sent on the topic. - The
--option tells rostopic pub that the followingargis not an option for itself, but it's some argument of themsg_type. - Slightly more complex syntax that is less error-prone (you avoid typing message type by hand)
rostopic pub -1 <topic> $(rostopic type <topic>) -- <args>- Quick example:
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'- Publish content over and over at a fixed rate
rostopic pub -r <rate> <topic> <msg_type> -- <args>In previous command, rate argument is a number expressed in Hz that shall be greater than zero.
Quick example (with rate 1 Hz)
rostopic pub -r 1 /turtle1/cmd_vel $(rostopic type /turtle1/cmd_vel) -- '[2.0, 0, 0]' '[0, 0, -1.8]'- Estimate publication rate on a given topic
rostopic hz <topic>