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
2. rqt_graph
rqt_graph
/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
3. rosnode info
rosnode info somenode # check somenode's information
4. rostopic list
rostopic list # show the current topic
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"
- 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
6. rosmsg show
rosmsg show geometry_msgs/Twist
7. rosservice list
rosservice list # show all service
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'"
we create another turtle
now we call rostopic list
again, we can find we have turtle2 here
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)