3
\$\begingroup\$

Hello everyone and thanks in advance to anyone who'll help me through this !

I am currently working on the Kinect V2 (for XBox One) to interact with an avatar. I'd like to use the rotation quaternion that the SDK 2.0 give for each joint of the Skeleton. My avatar (virtual avatar of NAO robot) communicates through nautical angles, yaw, ptich and roll. There's no problem to convert quaternions into nautical angles, but here's my problem :

Let's take the shoulder as an example of joint; Where the Kinect express the rotation of my shoulder as a 3-axes rotation, I need to convert it into a 2-axes rotation. Yaw, pitch and roll So for my shoulder I have a [Yaw, Pitch, Roll] from the Kinect, which I want to convert into a [Pitch, Roll] for NAO's avatar

NAO's shoulder

At the beginning, I didn't see the problem; I just ignored the Yaw angle. But I rapidly noticed that the movement was not the same than in the Kinect (and it makes sense).

Can someone help me ? How can I convert a 3D 3-axes rotation into a 3D 2-axes rotation ?

\$\endgroup\$
3
  • \$\begingroup\$ Are the angles you're talking about absolute or relative to the thing the arm is attached to? I'm having some trouble visualising how the two things you want to convert between differ. \$\endgroup\$
    – Anko
    Aug 29, 2015 at 18:16
  • \$\begingroup\$ Yes they are relative. Take a look at the NAO's arm picture. The angles are relative to a "standard position" at 0° yaw and 0° Pitch. If your concerned about the standard positions of the Kinect, it's not a problem, for some joints you have to invert an axis or add a 90° somewhere, but it is easily done. My real problem is to get the right move with NAO using two axes in my rotation \$\endgroup\$
    – Angeall
    Aug 29, 2015 at 23:28
  • \$\begingroup\$ upload.wikimedia.org/wikipedia/commons/3/3e/… that's the three angles the human shoulder can rotate with. Tha NAO can move with only two of them \$\endgroup\$
    – Angeall
    Aug 30, 2015 at 6:54

1 Answer 1

1
\$\begingroup\$

What you want to do here is preserve the direction that the upper arm points. So let's first get that direction (relative to the parent bone's space)

localArmDirection = kinectJointQuaternion * neutralArmdirection;

Now that you have a unit vector describing the 3D direction that you want the arm to point (relative to the torso), you can convert it into spherical coordinates to get the corresponding pitch and roll angles.

Here I'll make some assumptions about your torso coordinate system, but these are easy to convert if your conventions are different. Let's say...

  • x+ points to the right (ie. out like a T-pose for the right arm, or into the chest for the left arm)
  • y+ points straight up
  • z+ points forward / ventrally

Then your angles (in radians) are:

pitch = atan2(localArmDirection.y, localArmDirection.z)

roll = asin(localArmDirection.x) * (isLeftArm ? -1.0 : 1.0)
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .