[Robotics] Computing IK Joint Angles Pt.3

Florian Lier blender at icram.de
Thu Jul 16 20:50:53 CEST 2009


Hey all and especially Benoit,

i've implemented Benoits approach for computing joint angles (in degrees)

To recapitulate the problem:

I've modelled a robot arm with 5 joints (all joints are revolute 
joints). The arm is
driven by an "empty" target to an IK solver on top of the bone chain. I 
need to
get the joint angles in degrees or rad. Those joint angles are in range 
of the X,Y,Z
limits of the bones which form the chain.

The approach:

*relativePose[n] = inverse(poseMatrixTail[n-1])*poseMatrix[n]

"where n is the bone for which you compute the joint values and
poseMatrixTail is simply poseMatrix where the 4th column is replaced by
tail. For the root bone, poseMatrixTail is the identity matrix."

*As far as I've tested the setup all angles are computed correctly. The only problem is, that
I need to convert the angles from poseMatrix -> toEuler(). That's the last pitfall. Euler angles
are a bit tricky because the represent [yaw, pitch, bank]. By rotating some (or one) of the
parent bone/s the YAW, PITCH, BANK locally changes for the "target bone" [n] (for which I want to
compute the joint angle) so the resulting angle is either positive or negative - what's not THAT bad. 
The biggest problem is - an euler angle is represented like [x (yaw),z (pitch),y (bank)]. 
Let's assume a bone rotates about the x axis (its' DoF). If all bones are in rest position the output when 
rotation the bone is like: [100, x, x] after rotation one of it's parents the result is maybe: [x,x,100]. 
To me there's so predictable coherence whether the result can be found in x y or z.

*How can someone solve this problem?*

I've digged deep in the blender source code especially in armature.c and the IK_Solver sources.
The angle I need is represented as a float value in there :/.  

[blender source from svn]

blender/intern/iksolver/intern/IK_QSegment.cpp [line 602]

BUT wrapping this code to Python, making the code invokable and finally extending the Python API 
seems a little to exaggerated to me ... 

So having the feature to extract several angles from an IK chain would be great in case of using blender
for robotics.

It would be great if someone can help me out - or if we can solve this problem in a more general manner
like really extending the python API ? I'll attach the appropriate blend file so everybody can play around
or visualize the problem. Most of the code is documented.

You can find the blend file here: *http://www.icram.de/BpyJointAngles.blend*

Cheers, Florian


P.S. Sorry for crossposting this, but this is / maybe / not only a robotics issue...



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/robotics/attachments/20090716/0ff1a321/attachment.htm 


More information about the Robotics mailing list