1米/秒往前走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 1, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'
原地打转
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0, y: 0, z: 0}, angular: {x: 0, y: 0, z: 6.28}}'
1米/秒往后走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: -1, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'
1. Start ros
roscore
- 1
2. Start the little turtle
To open a terminal separately, you can use the command ctrl+shift+t to open a new terminal in the same window. input the command:
rosrun turtlesim turtlesim_node
- 1
A small turtle window will appear:
The format of the rosrun command is: rosrun [package name] [node name]. turtlesim is a function package, and turtlesim_node is a node in the function package.
3. Keyboard control
And this time open a new terminal to run another node
rosrun turtlesim turtle_teleop_key
- 1
The movement of the turtle is controlled by the four arrows of the keyboard.
Note that the cursor must be placed on this terminal for the turtle to move.
4. Command control
1米/秒往前走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: 1, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 0}}'
原地打转
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: 0, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 6.28}}'
1米/秒往后走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: -1, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 0}}'
- 1
- 2
- 3
- 4
- 5
- 6
</article>
1. Start ros
roscore
- 1
2. Start the little turtle
To open a terminal separately, you can use the command ctrl+shift+t to open a new terminal in the same window. input the command:
rosrun turtlesim turtlesim_node
- 1
A small turtle window will appear:
The format of the rosrun command is: rosrun [package name] [node name]. turtlesim is a function package, and turtlesim_node is a node in the function package.
3. Keyboard control
And this time open a new terminal to run another node
rosrun turtlesim turtle_teleop_key
- 1
The movement of the turtle is controlled by the four arrows of the keyboard.
Note that the cursor must be placed on this terminal for the turtle to move.
4. Command control
1米/秒往前走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: 1, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 0}}'
原地打转
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: 0, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 6.28}}'
1米/秒往后走
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{
linear: {
x: -1, y: 0, z: 0}, angular: {
x: 0, y: 0, z: 0}}'
- 1
- 2
- 3
- 4
- 5
- 6