ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

why do pr2 joints have values that are outside of [-pi,pi]?

asked 2011-06-17 16:42:51 -0500

liuhuanjim013 gravatar image

updated 2014-11-22 17:05:06 -0500

ngrennan gravatar image

Hi,

Some pr2 joints have values that are outside of [-pi, pi]. I guess for circular joints they are still correct, buy why? Is it for computation reason?

Thanks!

Huan

a snapshot of /joint_states

['fl_caster_rotation_joint', 'fl_caster_l_wheel_joint', 'fl_caster_r_wheel_joint', 'fr_caster_rotation_joint', 'fr_caster_l_wheel_joint', 'fr_caster_r_wheel_joint', 'bl_caster_rotation_joint', 'bl_caster_l_wheel_joint', 'bl_caster_r_wheel_joint', 'br_caster_rotation_joint', 'br_caster_l_wheel_joint', 'br_caster_r_wheel_joint', 'torso_lift_joint', 'head_pan_joint', 'head_tilt_joint', 'laser_tilt_mount_joint', 'r_upper_arm_roll_joint', 'r_shoulder_pan_joint', 'r_shoulder_lift_joint', 'r_forearm_roll_joint', 'r_elbow_flex_joint', 'r_wrist_flex_joint', 'r_wrist_roll_joint', 'r_gripper_joint', 'r_gripper_l_finger_joint', 'r_gripper_r_finger_joint', 'r_gripper_r_finger_tip_joint', 'r_gripper_l_finger_tip_joint', 'l_upper_arm_roll_joint', 'l_shoulder_pan_joint', 'l_shoulder_lift_joint', 'l_forearm_roll_joint', 'l_elbow_flex_joint', 'l_wrist_flex_joint', 'l_wrist_roll_joint', 'l_gripper_joint', 'l_gripper_l_finger_joint', 'l_gripper_r_finger_joint', 'l_gripper_r_finger_tip_joint', 'l_gripper_l_finger_tip_joint'] position: [-25.136960855868342, 68.472956500630374, 37.068301183569631, -31.409328058537294, -18.933136634743402, -57.517624429059097, -3.1284428982839643, 5.3914657553882392, -3.4942005574043051, -3.1604912968985568, 66.832474966597601, 59.113304284203849, 0.026767435883175424, -0.24270374158698663, -0.3933274002294424, 0.11195493820065446, -0.04203930185080762, -1.1389219022208392, -0.16382612058401533, 18.714694016914294, -1.7741163973815695, -2.0013098063511703, -23.417522242391954, 0.0026491546994614605, 0.016610319039379901, 0.016610319039379901, 0.016610319039379901, 0.016610319039379901, 2.5979006159333666, 0.34758495267680961, -0.35116719220802289, 9.4771049134843661, -2.0293996340100984, -1.4185019236812049, 13.025351396232255, 0.079504039480693636, 0.46000185795463722, 0.46000185795463722, 0.46000185795463722, 0.46000185795463722]

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2011-06-18 10:22:44 -0500

dornhege gravatar image

I don't know why exactly this is for PR2, but there are a couple of reasons for this behaviour in general.

For things like caster wheels, it should be easier to compute odometry and such as you don't need to take care of "backjumps" when you go out of [-pi,pi]. It is also intuitively more correct (at least in my intuition).

In addition to that, depending on the robot, a larger interval is indeed necessary to model the robot correctly as it might represent the real values of the robot. Imagine a lower arm roll joint that can from its zero position rotate +- 210 degrees (so more than 360 degrees), but it can't rotate continuously (e.g. because of cables inside that would be torn). So being at +180 the arm is in the same position as in -180 degree, but in can only turn +30 more, while being at -180 it could turn +390 degree (and vice versa in the other direction).

Although for transformations this is the same value, for things like motion planning this does make a difference, and thus it is modelled that way.

And finally there is a very pragmatic reason, that might be, that those are just the raw values the robot puts out.

edit flag offensive delete link more

Comments

The values in joint_states are converted directly from the raw joint encoder values.
hsu gravatar image hsu  ( 2011-06-18 13:25:57 -0500 )edit
i see. thanks john!
liuhuanjim013 gravatar image liuhuanjim013  ( 2011-06-18 14:30:42 -0500 )edit
I don't think that there is a semantic difference between +180° and -180° (or, to be more clear, +90° and -270°) in the JointStates message, and if you pass a JointState somewhere into the arm navigation pipeline, you cannot rely on the fact that it won't be normalized between (-pi, pi) somewhere.
Martin Günther gravatar image Martin Günther  ( 2011-06-19 21:53:41 -0500 )edit
Just to add: I completely agree that in the example you mentioned, there *should* be a difference. My point is just that the specification of JointState doesn't differentiate, so you shouldn't get (or expect) different behaviour whether you normalize your angles or not.
Martin Günther gravatar image Martin Günther  ( 2011-06-19 21:59:24 -0500 )edit
btw, John: where can I learn more about how the joint encoder works? e.g. when do they stop counting and how big can they count?
liuhuanjim013 gravatar image liuhuanjim013  ( 2011-06-20 08:02:24 -0500 )edit
0

answered 2011-06-18 11:03:44 -0500

liuhuanjim013 gravatar image

Hi dornhege,

Thanks for your answer! What you said makes sense. I do realize that if I want to control a joint of the robot to turn more than 180 degrees, it would be much easier to specify the goal angle this way without worrying about the wrapping problem. For example, if I want the robot to use a screw driver and make two full turns, I would just command its arm roll joint angle to be alpha+4*pi.

Problem solved. Thanks again for your help!

Huan

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-06-17 16:42:51 -0500

Seen: 322 times

Last updated: Jun 18 '11