1. open Turtlesim
1 rosrun turtlesim turtlesim_node
1 rosrun turtlesim turtle_teleop_key
2. rqt_graph
/turtlesim
node is a simple simulator for teaching ROS concepts.
teleop_turtle
node
/turtle1/cmd_vel
topic
3. rosnode list
3. rosnode info
4. rostopic list
5. rostopic pub 1 rostopic pub /turtle1/cmd_vel
click tab
button twice
1 2 3 4 5 6 7 8 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
1 2 3 4 5 6 7 8 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 1 rosmsg show geometry_msgs/Twist
7. rosservice list
8. rosservice call
click tab for 2 times
1 2 3 4 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 1 rosbag record -a -O cmd_record
we can find a new file under current folder has been created
named cmd_record.bag
1 rosbag play cmd_record.bag