Running with Belt Compensation
This page describes how to run with the new control code that compensates for the effects of the belts in the PR2.
The procedure is:
- Check out the beltcomp branch of pr2_mechanism, pr2_common, and pr2_robot
- Generate a new robot.xml
- Launch from a new robot.launch
- (Optional) Copy over calibration offsets
All of these steps should be performed on the robot.
Contents
Checking out branches
The belt compensation transmissions are implemented in the beltcomp branches of the pr2_mechanism, pr2_common, and pr2_robot stacks. You should check out the following (and make sure they are early in the ROS_PACKAGE_PATH):
svn co https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_mechanism/branches/beltcomp_cturtle pr2_mechanism svn co https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_common/branches/beltcomp pr2_common svn co https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_robot/branches/beltcomp pr2_robot
New robot description
Convert the existing description (Recommended)
Because the belt compensation uses different transmissions from the standard ones, you must create a new robot description. These steps describe how to convert an existing urdf robot description to use the belt transmissions.
First, get the xslt conversion script: belt_transmissions.xslt
Now, transform the existing urdf:
xsltproc belt_transmissions.xslt /etc/ros/urdf/robot.xml > robot_belt.xml
You may need to install xsltproc: sudo apt-get install xsltproc
Alternate: Generate a new robot description (not recommended)
Because the belt compensation uses different transmissions from the standard ones, you must create a new robot description. The beltcomp branch of pr2_description contains the new xacro macros with the new transmissions. Generate a description as follows:
rosrun xacro xacro.py `rospack find pr2_description`/robots/pr2.urdf.xacro > ~/robot_belt.xml
Check the new robot description. It should have a section that looks like this:
<transmission name="r_shoulder_pan_trans" type="pr2_mechanism_model/PR2BeltCompensatorTransmission"> <actuator name="r_shoulder_pan_motor"/> <joint name="r_shoulder_pan_joint"/> <mechanicalReduction>63.1552452977</mechanicalReduction> <compensator k_belt="4000.0" kd_motor="15.0" lambda_combined="20.0" lambda_joint="50.0" lambda_motor="30.0" mass_motor="0.05"/> </transmission>
New robot.launch
Copy the robot.launch to your home directory so we can modify which robot description it uses.
cp /etc/ros/robot.launch .
Modify it to point to the new description:
<launch> <!-- Robot Description --> <param name="robot_description" textfile="/u/***USER***/robot_belt.xml" /> <!-- Robot Analyzer --> <rosparam command="load" file="$(find pr2_bringup)/config/pr2_analyzers.yaml" ns="diag_agg" /> <!-- Robot bringup --> <include file="$(find pr2_bringup)/pr2.launch" /> </launch>
Calibration offsets
The new robot description is uncalibrated. You may want to copy over the calibration offsets from the calibrated robot description.