Skip to content

Commit cc347f8

Browse files
Use stamped messages for Jazzy keyboard teleop example (#28)
* Change the teleop_twist_keyboard launch command so it uses stamped messages * Fix the cmd_vel pub for Jazzy
1 parent f59428c commit cc347f8

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

tutorials/driving.md

+54-3
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,40 @@ You can install the `teleop_twist_keyboard` package on your PC by running the fo
2828
```bash
2929
sudo apt install ros-galactic-teleop-twist-keyboard
3030
```
31+
32+
Once installed, run the node by calling:
33+
34+
```bash
35+
ros2 run teleop_twist_keyboard teleop_twist_keyboard
36+
```
3137
{% endtab %}
3238
{% tab install_apt humble %}
3339
```bash
3440
sudo apt install ros-humble-teleop-twist-keyboard
3541
```
42+
43+
Once installed, run the node by calling:
44+
45+
```bash
46+
ros2 run teleop_twist_keyboard teleop_twist_keyboard
47+
```
3648
{% endtab %}
3749
{% tab install_apt jazzy %}
3850
```bash
3951
sudo apt install ros-jazzy-teleop-twist-keyboard
4052
```
41-
{% endtab %}
42-
{% endtabs %}
4353

4454
Once installed, run the node by calling:
4555

4656
```bash
47-
ros2 run teleop_twist_keyboard teleop_twist_keyboard
57+
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -p stamped:=true
58+
```
59+
60+
```note
61+
In Jazzy onwards, the preference is to use stamped messages for control. By default the `teleop_twist_keyboard` package uses unstamped messages. Therefore the `stamped` parameter must be set to `true` manually when starting the node.
4862
```
63+
{% endtab %}
64+
{% endtabs %}
4965

5066
This will start a CLI interface which allows you to press keys to command the robot to drive.
5167

@@ -84,6 +100,25 @@ Both the keyboard and joystick teleop methods work by sending velocity commands
84100

85101
You can manually publish to this topic through the command line by calling:
86102

103+
{% tabs manual_pub %}
104+
{% tab manual_pub galactic %}
105+
```warning
106+
**ROS 2 Galactic is no longer supported.** Please consider upgrading to a newer release
107+
```
108+
109+
```bash
110+
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist \
111+
"linear:
112+
x: 0.0
113+
y: 0.0
114+
z: 0.0
115+
angular:
116+
x: 0.0
117+
y: 0.0
118+
z: 0.0"
119+
```
120+
{% endtab %}
121+
{% tab manual_pub humble %}
87122
```bash
88123
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist \
89124
"linear:
@@ -95,6 +130,22 @@ angular:
95130
y: 0.0
96131
z: 0.0"
97132
```
133+
{% endtab %}
134+
{% tab manual_pub jazzy %}
135+
```bash
136+
ros2 topic pub /cmd_vel geometry_msgs/msg/TwistStamped \
137+
"twist:
138+
linear:
139+
x: 0.0
140+
y: 0.0
141+
z: 0.0
142+
angular:
143+
x: 0.0
144+
y: 0.0
145+
z: 0.0"
146+
```
147+
{% endtab %}
148+
{% endtabs %}
98149

99150
Set the `linear.x` value to drive the robot forwards or backwards, and the `angular.z` value to rotate left or right.
100151

0 commit comments

Comments
 (0)