Question: issues with angular displacement in given inverse kinematics problem


I was playing around with the example "Simple Inverse Kinematic Problem" and found somethings to be odd:

the angular motion seems to be calculated from between pi and negative pi and this has some effects when using position block to move a joint.

the original angular displacement is graph below

the angular displacement after ik calculations have been performed:

if you run the simulation it seems to copy and mirror the input pendulum, however if you disable one of the IK solutions you see that infact its motion isn't like the input.

this becomes more prevailant when you use a position block to force rotation on a joint instead of using the 'prescribed rotation' blocks that comes with the example.

My question then:
why does this happen?
how do I work around this?

the importance that the motion is follow precisely becomes more prevailent when we want to extract other values such as vel, accel, torque. they are incorrect and very jumpy. Also simply put the angular displacement is wrong, how do I fix it?

(side note: I'm thinking  it has to do with the way arctan is calculated in maple limits it to stay in range -pi to pi
"For real arguments x, y, the two-argument function arctan(y, x), computes the principal value of the argument of the complex number x+Iy, so −π < arctan(y,x) ≤ π." from


Please Wait...