Tutorials/drcsim/1.3/fake walking teleop


 * 1) DRC Tutorial: Fake walking teleoperation

This tutorial will explain how to drive the simulated DRC Robot around as if it were a wheeled robot (i.e., without walking or balancing).


 * 1) Setup ##

We assume that you've already done the installation step.

If you haven't done so, add the environment setup.sh files to your .bashrc. Check the version of drcsim you have installed, and make sure you reference the correct `drcsim-x.y` revision. For example, if you installed drcsim-1.0.x, then type:

echo 'source /usr/share/drcsim/setup.sh' >> ~/.bashrc source ~/.bashrc

We're going to use the pr2_teleop package to drive the DRC robot around with keyboard commands. Install the Ubuntu package that contains it:

sudo apt-get install ros-fuerte-pr2-teleop-app


 * 1) Background ##

At the time of writing, walking controllers have not yet been developed for the DRC Robot in simulation. We intend for walking controllers to be provided for use in simulation; ideally they will be the same controllers (perhaps with different parameters) that are used on the DRC Robot hardware.

In the meantime, the DRC Simulator includes a model of the DRC Robot in which the robot's hip joint is "pinned" to the world. This pinned joint keeps the robot's feet off the ground and removes the need to balance or walk, as shown in the following image:



Note that, even with this pinned hip joint, all of the robot's joints, including the legs, are physically simulated and actively controlled; see the visualization tutorial and joint control tutorial for examples of moving the arms and legs by providing setpoints to the joints' controllers.

So our simulated robot can't (yet) 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.


 * 1) The code ##

Start the simulator:

roslaunch atlas_utils atlas.launch

In another shell, start `pr2_teleop/pr2_teleop_keyboard`:

rosrun pr2_teleop teleop_pr2_keyboard cmd_vel:=atlas/cmd_vel

You should see something like:

Reading from keyboard ---       Use 'WASD' to translate Use 'QE' to yaw Press 'Shift' to run

Follow the instructions: get the robot moving with those keys. Press any other key to stop. Control-C to stop the teleop utility.

How does that work? The simulated robot is awaiting ROS Twist messages, which specify 6-D velocities, on the `atlas/cmd_vel` topic. Check that with rostopic:

rostopic info atlas/cmd_vel

You should see something like:

Type: geometry_msgs/Twist Publishers: * /pr2_base_keyboard (http://osrf-Latitude-E6420:36506/)

Subscribers: * /gazebo (http://osrf-Latitude-E6420:35339/)

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:

rosmsg show Twist

You should see:

[geometry_msgs/Twist]: geometry_msgs/Vector3 linear float64 x     float64 y      float64 z    geometry_msgs/Vector3 angular float64 x     float64 y      float64 z

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:

rostopic pub 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 } }'

Control-C to stop rostopic. Note that the robot keeps moving; that's because there's no watchdog that requires recent receipt of a velocity command (that may change in the future). You can verify this with the command:

rostopic echo atlas/cmd_vel

To stop the robot, send zero velocities:

rostopic pub 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 } }'

Press `Control-C` to stop rostopic.

From here, you're ready to write code that moves the robot around the world.


 * 1) Next ##

Next: Modify DRC World Contents