Wiki
Clone wikipr2_pretouch_sensor_optical / Home
PR2 Optical (IR) Beam Sensor
This is an instruction of setting up the optical (IR) beam sensor, for both hardware and software, on an actual PR2 robot.
Hardware Setup
Attach the sensor according to the following photo:
Several important things:
- When the LED on the gripper is facing up, the emitter (with 4 transparent diodes) should be installed on the left finger, and the receiver (with 4 black diodes) is on the right finger.
- The emitter should be installed before the receiver on each gripper. This is to make sure the emitter can draw enough power from the motor control board. If later on you found the sensors are not working correctly, you may want to try doing this in the correct order again.
- Remember to insert the FFC cable into the connector on the sensor.
Software Setup (Fuerte)
###Clone and compile the required packages * pr2_pretouch_sensor_optical * pr2_ethercat_drivers * pr2_robot
using rosinstall:
cd ~ rosinstall optical_ws /opt/ros/fuerte/ https://bitbucket.org/uwsensors/pr2_pretouch_sensor_optical/raw/fuerte-dev/pr2_sensor_optical.rosinstall source optical_ws/setup.bash rosmake pr2_robot rosmake pr2_ethercat_drivers rosmake pr2_pretouch_sensor_optical
Overlay this workspace on top of your environment automatically on new terminals by adding this to your .bashrc:
source $HOME/optical_ws/setup.bash
Software Setup (Hydro)
- Running ROS Hydro on the PR2 (instruction)
- Build system: catkin
###Clone and compile the required packages * pr2_pretouch_sensor_optical * pr2_ethercat_drivers * pr2_robot
using wstool:
cd ~ mkdir optical_ws && cd optical_ws wstool init src https://bitbucket.org/uwsensors/pr2_pretouch_sensor_optical/raw/hydro-dev/pr2_sensor_optical.rosinstall cd src && wstool update -j8 cd .. && rosdep install --from-paths src -i -y catkin_make
Overlay this workspace on top of your environment or add this to your .bashrc file:
source $HOME/optical_ws/devel/setup.bash
Upgrade the gripper (WG006) firmware (Do it only once)
Important: this step only needs to be done once on each PR2 robot. The upgrade will be persistent. Please make sure the robot is not running (robot stop), and the robot's power cable is plugged into the outlet. Otherwise this firmware upgrade may brick the gripper's motor control board.
./pr2_ethercat_drivers/wg006_fingertip_dev/upgrade_wg006_firmware.sh
Power cycle the PR2 to make this upgrade effective.
Upload the Picoblaze firmware for the gripper’s FPGA (Do it everytime the robot is power-cycled)
If this is the first time you do this, you need to compile the picoasm binary:
cd pr2_ethercat_drivers/wg006_fingertip_dev/picoasm
make
./pr2_ethercat_drivers/wg006_fingertip_dev/upload_optical_firmware.sh
Run this bash script to upload the firmware for the standard pressure sensors which came with the PR2:
./pr2_ethercat_drivers/wg006_fingertip_dev/upload_pressure_firmware.sh
The firmware is not persistent, and will be lost if the robot is power-cycled. To make it persistent, one way is to call the above script into the system startup script.
Start the Optical Sensor Publisher
Start the Robot, and verify the raw data is published.
robot start
rostopic list | grep raw_pressure
/raw_pressure/l_gripper_motor
/raw_pressure/r_gripper_motor
Start the optical sensor publisher:
roslaunch pr2_pretouch_sensor_optical optical_pretouch_both_gripper.launch
rostopic echo /optical/right
header: seq: 809 stamp: secs: 1396376917 nsecs: 471429109 frame_id: '' data: [768, 780, 744, 792] broken: [False, False, False, False]
Verify the sensor data for the left gripper in the same way:
rostopic echo /optical/left
Visualize the sensor readings
Run a realtime visualization of the sensor readings for verifying the sensor. The photo below shows the suitable configuration for testing. You may want to run this program on a workstation other than the robot and set the ROS_MASTER_URI to the robot. Alternatively you can run it in a ssh -X
session.
rosrun pr2_pretouch_sensor_optical visualizer.py
How to use the sensor data
The sensor data is published to the /optical/right
and /optical/left
topics as a OpticalBeams message.
Header header uint16[] data bool[] broken
You can simply subscribe to the topics to receive the data. The data rate is 500 Hz.
Updated