Skip to content

Commit 752cf0b

Browse files
committed
Merged in drcsim_walking (pull request #45)
DRCSim fake walking tutorial.
2 parents dd25a9b + bc9ca9b commit 752cf0b

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed
Loading

drcsim_fakewalking/tutorial.md

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Overview
2+
3+
**IMPORTANT: This tutorial only works with ROS Groovy.**
4+
5+
This tutorial will explain how to drive simulated Atlas around as if it were a wheeled robot (i.e., without walking or balancing).
6+
7+
## Setup
8+
9+
We assume that you've already done the [installation step](http://gazebosim.org/tutorials/?tut=drcsim_install).
10+
11+
If you haven't done so, add the environment setup.sh files to your .bashrc.
12+
13+
~~~
14+
echo 'source /usr/share/drcsim/setup.sh' >> ~/.bashrc
15+
source ~/.bashrc
16+
~~~
17+
18+
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:
19+
20+
~~~
21+
sudo apt-get install ros-groovy-pr2-teleop-app
22+
~~~
23+
24+
## Background
25+
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:
27+
28+
[[file:files/Gazebo_with_drc_robot.png|640px]]
29+
30+
Note that all of the robot's joints, including the legs, are physically simulated and actively controlled.
31+
32+
So the simulated robot in this tutorial can't walk, but we still want to move it around in the world. Fortunately, the simulated robot accepts velocity commands via ROS to translate and rotate in the plane, as if it were a wheeled robot.
33+
34+
## The code
35+
36+
1. Start the simulator:
37+
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.
49+
50+
2. In another shell, start `pr2_teleop/pr2_teleop_keyboard`:
51+
52+
~~~
53+
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
63+
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.
65+
66+
## How does that work?
67+
68+
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):
70+
71+
~~~
72+
rostopic info atlas/cmd_vel
73+
~~~
74+
75+
You should see something like:
76+
77+
~~~
78+
Type: geometry_msgs/Twist
79+
80+
Publishers:
81+
* /pr2_base_keyboard (http://osrf-Latitude-E6420:36506/)
82+
83+
Subscribers:
84+
* /gazebo (http://osrf-Latitude-E6420:35339/)
85+
~~~
86+
87+
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):
88+
89+
~~~
90+
rosmsg show Twist
91+
~~~
92+
93+
You should see:
94+
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+
~~~
106+
107+
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:
108+
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+
~~~
112+
113+
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:
114+
115+
~~~
116+
rostopic echo atlas/cmd_vel
117+
~~~
118+
119+
To stop the robot, send zero velocities:
120+
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+
~~~
124+
125+
From here, you're ready to write code that moves the robot around the world.

manifest.xml

+7
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@
313313
<skill>intermediate</skill>
314314
</tutorial>
315315

316+
<tutorial title="Atlas fake walking" ref='drcsim_fakewalking'>
317+
<markdown version="1.9+">drcsim_fakewalking/tutorial.md</markdown>
318+
<description>How to drive a simulated Atlas as if it were a wheeled robot.</description>
319+
<skill>intermediate</skill>
320+
</tutorial>
321+
316322
<tutorial title="Modify environment" ref='drcsim_modify_world'>
317323
<markdown version="2.0+">drcsim_modify_world/tutorial.md</markdown>
318324
<description>How to modify the simulated Atlas' environment, such as adding objects to the world.</description>
@@ -478,6 +484,7 @@
478484
<tutorial>drcsim_visualization</tutorial>
479485
<tutorial>drcsim_multisense</tutorial>
480486
<tutorial>drcsim_modify_world</tutorial>
487+
<tutorial>drcsim_fakewalking</tutorial>
481488
</tutorials>
482489
</category>
483490

0 commit comments

Comments
 (0)