How to run the teleop cockpit
The following instructions describe how to set up the PR2 cockpit on the local machine (the master) and on the robot (the slave).
Homing the microscribes
This is a microscribe:
The microscribes must be calibrated. If the LED on the base is green, then the device is already calibrated, but if it is red then we must perform the calibration.
To calibrate the microscribes, place the stylus in the silver hole by bending the arm back on itself. Take note of the joint above the stylus--it may be bent the wrong way. Turn the body of the microscribe all the way clockwise until the base joint hits an end stop. While holding it in this position, press the white button on the back-right of the base of the microscribe.
Configuring the stupid USB devices
Some USB devices are manufactured by morons who don't put serial numbers on the USB device. Do not be one of these morons. Anyone plugging two of your devices into the same computer will have to run an annoying configuration step to determine which device is which.
Go into the teleop_microscribe package and run configure_devices.py:
roscd teleop_microscribe ./configure_devices.py
Press on each pedal type when the script prompts you.
These are "transcription pedals":
These are "rudder pedals":
You must repeat this step every time the USB devices change. The USB devices change when you restart the computer, unplug and plug in one of the devices, or when a hub goes finicky and drops the USB connections for no particular reason.
Running it all
Start the robot with roslaunch /etc/ros/robot.launch. DO NOT USE sudo robot start
You may want to check that the controller was found:
$ rosrun pr2_controller_manager pr2_controller_manager list-types | grep JTTeleopController JTTeleopController
First we'll launch the camera view to make certain that everything is working. All of these scripts are in teleop_microscribe and can (should) be launched locally.
ROBOT=prX roslaunch view.launch
Four windows should appear. One for the wide stereo, one for the narrow stereo, and one for each forearm camera. This step may complain about audio_capture--ignore this.
Next we'll bring up the devices and control the head. Launch the devices:
You should now be able to move the head with the left rudder pedals. Turning them left or right turns the head left or right. Pressing the left pedal tilts the head up and pressing the right pedal tilts the head down.
Next we will open and close the grippers. Point the head so that the grippers are visible. The right transcription pedals control both grippers, with the left pedal controlling the left gripper and the right pedal controlling the right gripper (the middle pedal does nothing). Press and hold the pedal to close the gripper, then press and hold again to open it.
Next we will launch the controllers and move the arms around. Launch the J-transpose controllers with the provided launch script:
The grippers should remain where they are, but the elbows may move.
We will now move the microscribe into position and engage it to move the arm.
Each microscribe has a set of two buttons attached to it by a cable. Press either button once to engage the microscribe and again to disengage.
Pick up the stylus of the microscribe and hold it so it is aligned with the robot's gripper. Then engage the microscribe by pressing on either button. You should now be able to move the stylus around and have the arm follow you.
If you reach the end of the microscribe's workspace, disengage the microscribe (by pressing either button), move the stylus to a convenient location, and reengage the microscribe.