Skip to content

Commit b6eb95f

Browse files
committed
Updated tutorial
1 parent d41107b commit b6eb95f

File tree

1 file changed

+69
-54
lines changed

1 file changed

+69
-54
lines changed

drcsim_fakewalking/tutorial.md

+69-54
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Overview
22

3+
**IMPORTANT: This tutorial only works with ROS Groovy.**
4+
35
This tutorial will explain how to drive simulated Atlas around as if it were a wheeled robot (i.e., without walking or balancing).
46

57
## Setup
@@ -8,26 +10,20 @@ We assume that you've already done the [installation step](http://gazebosim.org/
810

911
If you haven't done so, add the environment setup.sh files to your .bashrc.
1012

11-
echo 'source /usr/share/drcsim/setup.sh' >> ~/.bashrc
12-
source ~/.bashrc
13+
~~~
14+
echo 'source /usr/share/drcsim/setup.sh' >> ~/.bashrc
15+
source ~/.bashrc
16+
~~~
1317

1418
We're going to use the [pr2_teleop](http://ros.org/wiki/pr2_teleop) package to drive Atlas around with keyboard commands. Install the Ubuntu package that contains it:
1519

16-
**Ubuntu 12.04 (precise) and ROS Groovy**
17-
18-
sudo apt-get install ros-groovy-pr2-teleop-app
19-
20-
**Ubuntu 12.04 (precise) and ROS Hydro**
21-
22-
sudo apt-get install ros-hydro-pr2-teleop-app
23-
24-
**Ubuntu 14.04 (trusty) and ROS Indigo**
25-
26-
sudo apt-get install ros-indigo-pr2-teleop-app
20+
~~~
21+
sudo apt-get install ros-groovy-pr2-teleop-app
22+
~~~
2723

2824
## Background
2925

30-
Note that this tutorial does not use the [walking controller](http://gazebosim.org/tutorials/?tut=drcsim_walking). It simply spawns Atlas with position controllers enabled that keep it standing upright, as shown in the following image:
26+
Note that this tutorial does not use the [walking controller](http://gazebosim.org/tutorials/?tut=drcsim_walking&cat=drcsim). It simply spawns Atlas with position controllers enabled that keep it standing upright, as shown in the following image:
3127

3228
[[file:files/Gazebo_with_drc_robot.png|640px]]
3329

@@ -37,74 +33,93 @@ So the simulated robot in this tutorial can't walk, but we still want to move it
3733

3834
## The code
3935

40-
Start the simulator:
36+
1. Start the simulator:
4137

42-
VRC_CHEATS_ENABLED=1 roslaunch drcsim_gazebo atlas.launch
38+
~~~
39+
VRC_CHEATS_ENABLED=1 roslaunch drcsim_gazebo atlas.launch
40+
~~~
41+
42+
>**For drcsim < 3.1.0**: The package and launch file had a different name:
43+
44+
>~~~
45+
VRC_CHEATS_ENABLED=1 roslaunch atlas_utils atlas.launch
46+
>~~~
47+
48+
Note: Setting the variable `VRC_CHEATS_ENABLED=1` exposes several development aid topics including `/atlas/cmd_vel`, which are by default disabled for the VRC competition.
4349
44-
**For drcsim < 3.1.0**: The package and launch file had a different name:
45-
46-
VRC_CHEATS_ENABLED=1 roslaunch atlas_utils atlas.launch
47-
48-
Note: Setting the variable `VRC_CHEATS_ENABLED=1` exposes several development aid topics including `/atlas/cmd_vel`, which are by default disabled for the VRC competition.
49-
50-
In another shell, start `pr2_teleop/pr2_teleop_keyboard`:
50+
2. In another shell, start `pr2_teleop/pr2_teleop_keyboard`:
5151
52+
~~~
5253
rosrun pr2_teleop teleop_pr2_keyboard cmd_vel:=atlas/cmd_vel
54+
~~~
55+
56+
You should see something like:
57+
58+
Reading from keyboard
59+
---------------------------
60+
Use 'WASD' to translate
61+
Use 'QE' to yaw
62+
Press 'Shift' to run
5363
54-
You should see something like:
64+
3. Follow the instructions: get the robot moving with those keys. Press any other key to stop. Control-C to stop the teleop utility.
5565
56-
Reading from keyboard
57-
---------------------------
58-
Use 'WASD' to translate
59-
Use 'QE' to yaw
60-
Press 'Shift' to run
66+
## How does that work?
6167
62-
Follow the instructions: get the robot moving with those keys. Press any other key to stop. Control-C to stop the teleop utility.
6368
64-
How does that work? The simulated robot is awaiting [ROS Twist](http://ros.org/doc/api/geometry_msgs/html/msg/Twist.html) messages, which specify 6-D velocities, on the `atlas/cmd_vel` topic. Check that with [rostopic](http://ros.org/wiki/rostopic):
69+
The simulated robot is awaiting [ROS Twist](http://ros.org/doc/api/geometry_msgs/html/msg/Twist.html) messages, which specify 6-D velocities, on the `atlas/cmd_vel` topic. Check that with [rostopic](http://ros.org/wiki/rostopic):
6570
66-
rostopic info atlas/cmd_vel
71+
~~~
72+
rostopic info atlas/cmd_vel
73+
~~~
6774
6875
You should see something like:
6976
70-
Type: geometry_msgs/Twist
77+
~~~
78+
Type: geometry_msgs/Twist
7179

72-
Publishers:
73-
* /pr2_base_keyboard (http://osrf-Latitude-E6420:36506/)
80+
Publishers:
81+
* /pr2_base_keyboard (http://osrf-Latitude-E6420:36506/)
7482

75-
Subscribers:
76-
* /gazebo (http://osrf-Latitude-E6420:35339/)
83+
Subscribers:
84+
* /gazebo (http://osrf-Latitude-E6420:35339/)
85+
~~~
7786
7887
The teleop utility is simply converting your keyboard input to messages of that type and publishing them to that topic. You can publish such messages from anywhere, including from the command line, using rostopic. First, let's see what's in a Twist message, using [rosmsg](http://ros.org/wiki/rosmsg):
7988
80-
rosmsg show Twist
89+
~~~
90+
rosmsg show Twist
91+
~~~
8192
8293
You should see:
8394
84-
[geometry_msgs/Twist]:
85-
geometry_msgs/Vector3 linear
86-
float64 x
87-
float64 y
88-
float64 z
89-
geometry_msgs/Vector3 angular
90-
float64 x
91-
float64 y
92-
float64 z
95+
~~~
96+
[geometry_msgs/Twist]:
97+
geometry_msgs/Vector3 linear
98+
float64 x
99+
float64 y
100+
float64 z
101+
geometry_msgs/Vector3 angular
102+
float64 x
103+
float64 y
104+
float64 z
105+
~~~
93106
94107
It's a 6-D velocity: 3 linear velocities (X, Y, and Z) and 3 angular velocities (rotations about X, Y, Z, also called roll, pitch, and yaw). Our robot is constrained to move in the plane, so we only care about X, Y, and yaw (rotation about Z). Make the robot drive counter-clockwise in a circle:
95108
96-
rostopic pub --once atlas/cmd_vel geometry_msgs/Twist '{ linear: { x: 0.5, y: 0.0, z: 0.0 }, angular: { x: 0.0, y: 0.0, z: 0.5 } }'
109+
~~~
110+
rostopic pub --once atlas/cmd_vel geometry_msgs/Twist '{ linear: { x: 0.5, y: 0.0, z: 0.0 }, angular: { x: 0.0, y: 0.0, z: 0.5 } }'
111+
~~~
97112
98113
Note that the robot keeps moving after rostopic exits; that's because there's no watchdog that requires recent receipt of a velocity command (that may change in the future). You can verify that no commands are being sent with this with the command:
99114
100-
rostopic echo atlas/cmd_vel
115+
~~~
116+
rostopic echo atlas/cmd_vel
117+
~~~
101118
102119
To stop the robot, send zero velocities:
103120
104-
rostopic pub --once atlas/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 } }'
121+
~~~
122+
rostopic pub --once atlas/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 } }'
123+
~~~
105124
106125
From here, you're ready to write code that moves the robot around the world.
107-
108-
## Next
109-
110-
[Next: Modifying the contents of the simulated world](http://gazebosim.org/tutorials/?tut=drcsim_modify_world)

0 commit comments

Comments
 (0)