wiki:ARMSimulatorRunning

LAUNCHING

Launch the simulation demo and dashboard:

roslaunch SimRobot SimDemo.launch

CONTROL

The 'Darpa ARM Dashboard' is the default method to control the robot. To be able to interact with the robot, you first have to select the control tabs you want to activate in the Controls drop down menu. Don't select more than the left and right arms and hands and the neck. There is no sensor data at this point, and activating any of the image sensor tabs attempts to draw to the screen and generates a performance hit on the processor.

After enabling the arm tab, the real robot requires the user to go through an interactive sequence to activate the arm. This has been automated in the simulator, and the activation sequence is completed when the menu changes to Trapezoidal Position mode. In position control modes, you can press Fill to fill in current joint angles in radians in the position column of the window, change them, and then press send to move the arm. The Vel and Accel terms are the trapezoidal parameters for these moves, and values for these are sent when the focus leaves those text boxes. Velocity and Torque control modes have similar methods of interaction.

After the arm is activated, the hand will startup. This usually takes a little while to switch mode from Initializing to Idle. After it is in idle, it can be switched to Trapezoidal Position or Velocity mode. Spread positions vary from 0 to -36000 ticks, and finger positions range from 0 to -191111 (although the simulator currently hits a stop at around -160000). Velocities are in ticks/ms, so 30 is slow, and 101 is a good clip.

The neck tab is used to control the two pan/tilt units on the robot. There is both position and velocity control available. Limits in radians are printed on the left of the window. To use the input boxes on the right side of the window, enter a velocity in the appropriate box, hit return. If in position mode, then enter the desired position, and hit return. The Reset/Rehome buttons will send the unit right/left then up/down in timed moves.

Joystick Control

The robot can also be controlled with an Xbox 360 contoller under the Teleop tab. The controller must be located at /dev/input/js0. If it is at /dev/input/js1, then do the following command:

sudo mv /dev/input/js1 /dev/input/js0

After enabling the Teleop control and switching to that tab, using the dropdown menu to select what part of the robot you wish to control. A legend for what axis/button controls what part of the robot is on the right of the control window.

Robot Fault Monitoring

The DARPA ARM robot has safety monitoring mechanisms built-in to ensure the safety of the motors and joints, by limiting motor torque and checking the Cartesian velocity of the elbow and the wrist. If the motor torques or the calculated velocities exceed threshold values, warnings or faults are generated. On the real hardware, the pendant used to start up the system also displays these states. Warnings generate messages on the pendant, while faults also cause the arm to shut down. In the simulator, the warning and fault information is displayed in the large text box in the Test Team tab of the Dashboard. To facilitate testing, faults do not currently cause the system to shut down.

Recording and Replay (for slow machines)

If you would like to record and replay a simulation for any reason, for example if your machine performs the simulations very slowly, you can record and replay the simulation using re2darmGazeboReplay.

Replay requires that gazebo is patched to publish the fully qualified link names. Future ros versions will have this modification, but for now our re2gazeboPatch package should make the necessary modifications to your checked out version of Gazebo in the course of the install procedure. You may need to rebuild re2gazeboPatch and then rebuild gazebo if you are updating to get Replay rather than getting it from a fresh install.

To use simply launch gazebo, and to record:

roslaunch re2darmGazeboReplay record.launch

After launching the record.launch file, start the autonomous behavior you would like to record. When done recording, ctrl-c the recording process.

To replay the action, the simulator must be running and all objects present in the world. Then to replay:

rosrun re2darmGazeboReplay replay.sh

Note that replay is a script unlike record which is a launch file.

By default, the recordings keep overwriting each other in re2darmGazeboReplay/data, but you can either copy that file to another location, or modify the launch files to change the behavior.

The replay may be a bit jerky.

Alternatively recording can be done with a video screen capture application. We have found an acceptable program called recordmydesktop. This can be installed with the following command:

sudo apt-get install recordmydesktop

To use recordmydesktop first load gazebo. With gazebo running, in the terminal run the following and click on the gazebo window.

xwininfo

This will give you gazebo's window ID, which will look like "xwininfo: Window id: 0x6800002 "Gazebo"." Once you have the window ID you can run recordmydesktop in the following way:

recordmydesktop --full-shots --windowid 0x6800002