ROS tools in Linux by command line


ROS tools in Linux

1. open Turtlesim

roscore # start the ROS Master
rosrun turtlesim turtlesim_node # start the turtlesim
rosrun turtlesim turtle_teleop_key # start turtle control node

image-20220529151250691

2. rqt_graph

rqt_graph

image-20220529151602659

  • /turtlesim node is a simple simulator for teaching ROS concepts.
  • teleop_turtle node
  • /turtle1/cmd_vel topic

3. rosnode list

rosnode list # show the current nodes

image-20220529173940604

3. rosnode info

rosnode info somenode # check somenode's information

image-20220529181619612

4. rostopic list

rostopic list # show the current topic

image-20220529182106662

5. rostopic pub

rostopic pub /turtle1/cmd_vel # 

click tab button twice

rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear: 
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0" 

image-20220529182504985

  • we can find turtle move
  • but only move once
  • it is because pub instruction only publish one time
rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
  x: 1.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"

add -r 10 after pub,

  • -r means rate,
  • 10 means 10 times per second

image-20220529182826228

6. rosmsg show

rosmsg show geometry_msgs/Twist

image-20220529184730763

7. rosservice list

rosservice list # show all service

image-20220529185604586

8. rosservice call

rosservice call /spawn 

click tab for 2 times

rosservice call /spawn "x: 2.0
y: 2.0
theta: 0.0
name: 'turtle2'" 

image-20220529190116119

we create another turtle

now we call rostopic list again, we can find we have turtle2 here

image-20220529190225390

9. rosbag record

rosbag record -a -O cmd_record # record the data into cmd_record file
  • we can find a new file under current folder has been created
  • named cmd_record.bag
rosbag play cmd_record.bag # play the data(the cmd_record file)

Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC