iCub Eye - How to get eye pose from encoder values #158
Replies: 8 comments
-
Hi Claudio! Thanks for this "tutorial" ;) I have an issue related to the torso joints update. Usually, when I use the iCubArm chain (similar to the iCubEye, I suppose), I need to update the torso joints in the reverse order. armKin.releaseLink(0);
armKin.releaseLink(1);
armKin.releaseLink(2);
armKin.blockLink(0,CTRL_DEG2RAD*encodersTorso[2]);
armKin.blockLink(1,CTRL_DEG2RAD*encodersTorso[1]);
armKin.blockLink(2,CTRL_DEG2RAD*encodersTorso[0]); Can you confirm that for the iCubEye we don't need to reverse the joint order? Thanks in advance, |
Beta Was this translation helpful? Give feedback.
-
Hi @vicentepedro :-) For "historical" reasons, the iCub torso joints are reversed, see here, i.e., (Yaw, Roll, Pitch). Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Thanks, @claudiofantacci. Now, I think the tutorial it's perfect. Hope it helps the iCub community ;) |
Beta Was this translation helpful? Give feedback.
-
Cool, thanks @vicentepedro ! |
Beta Was this translation helpful? Give feedback.
-
Interestingly, the same recipe is also valid to correctly populate other |
Beta Was this translation helpful? Give feedback.
-
Should I open another QA, say, |
Beta Was this translation helpful? Give feedback.
-
@claudiofantacci I don't believe it's really necessary. Later searches through GitHub will catch your nice instructions anyway 😉 |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
this a small, self-contained, "tutorial" on how to jointly use iCub joint values with
iCubEye
class to get, either left or right one, eye pose ✏️Assume that you store/read encoder values from the iCub torso and head through either
/icub/torso/state:o
and/icub/head/state:o
/icub/torso/stateExt:o
and/icub/head/stateExt:o
IEncoders
classyou will find yourself with 3 values for the torso and 6 values for the head 🤔
According to the iCub reference frames (click on the following image for details)
you have 3 joints for the torso, and three for the neck.
So what are the other 3 values found reading head encoders? 🤔
They are, of course, related to the eyes!
Let's see what they are: vergence, version and disparity!
The following image depicts version (Vs) and vergence (Vg) which are of use for our purposes.
To get the an eye pose, we need to feed the
iCubEye
interface with the encoders from the ROOT to the desired eye, plus the L or R value (see previous picture) if you either need the left or the right eye pose.As a result, the values to be passed to
iCubEye
are:/icub/torso/state:o
)/icub/head/state:o
)/icub/head/state:o
)/icub/head/state:o
)The L|R value can be evaluated from the version and vergence following the linear relationship reported here:
We now have all the values we need! We are ready to use
iCubEye
class to get the desired eye pose.Here is a (almost) ready-to-use code snippet:
Let's now dig into the detail!
First and foremost:
iCubEye
class is fully documented here ✌️releases the constraint of all chain links so that, even if any of the encoder goes beyond the default encoder constrained value, the encoders are not saturated to their constraints. If you feel uncomfortable with this, you can use
alignJointsBounds
member function to properly set the encoder limits.releases the first three links of the chain from the ROOT to the eye, i.e. the 3 DOF of the torso. By doing so, we are telling the interface to use the first 3 values of vector
⚠️ Beware: by not releasing the first three links while having used them, will most likely produce wrong/unwanted results!
q
as torso encoders.
EndEffPose(CTRL_DEG2RAD * q)
finally gives us the pose of the eye. The output vector is, by default, a 7x1 vector with
⚠️ Beware: a common pitfall is to forget to convert the encoder values, expressed in angle degrees, in radians multiplying by
xyz
coordinates plus a 4-component axis/angle vector. If you prefer RPY angles, you just need to providefalse
as a second argument. Documentation of the member function can be found here.CTRL_DEG2RAD
.If you went up through here, well, congratulations 🎉 you now have the eye pose at your preferred use!
Beta Was this translation helpful? Give feedback.
All reactions