Euler parameters

Hi,

I need to view a rotation in terms of an axis-angle representation. To achieve this, I use the euler parameter method, as follows :

AnyKinRotational GHRot2 = {
AnyRefNode &scapula = .RightScapula.GH;
AnyRefNode &humerus = .RightHumerus.GH;
Type = EulerParam;
};

AnyDrawVector GHRot2Vec = {
AnyRefFrame &ref = .RightScapula.GH;
AnyVar phi = 2acos(.GHRot2.Pos[0]);
AnyVec3 n = 2
{.GHRot2.Pos[1],.GHRot2.Pos[2],.GHRot2.Pos[3]}.GHRot2.Pos[0]/sin(phi);
Vec = n
0.1;
Line.Thickness = 0.005;
Line.RGB = {1,0,0};
};

Maybe I’m doing something wrong here, but why the result does not seem right ? I’m doing a rotation of the humerus in the scapular plane but the unique axis appears to be far from normal to the scapular plane.

Can you tell me if my computation of the unique vector ‘n’ from the four parameters (e0 = GHRot2.Pos[0], e1 = GHRot2.Pos[1], e2 = GHRot2.Pos[2], e3 = GHRot2.Pos[3]) is ok ?

Thank you.

Pierre

Hi Pierre,

I would suggest you to use another AnyKinRotational measure with the type of ‘RotVector’.

The unit vector of this measure will be the direction of axis of rotation,
and the size of this vector will be the rotation angle.

Best regards,
Moonki

Hi Moonki,

Thank you for your quick reply. I recheck my measure and the documentation of the function. I remembered that sometimes, although we provide the measure with local reference frames, the final measure is given with respect to the global reference frame. This is the case with those measures RotVector and EulerParameters, right ?

Thus, in order to obtain the right rotation axis, I just have to put back the global measure in local measure by multiplying it by the transpose of the rotation matrix of the local reference frame (scapula.GH), as follows:

AnyKinRotational GHRot2 = {
AnyRefNode &scapula = .RightScapula.GH;
AnyRefNode &humerus = .RightHumerus.GH;
// Type= RotVector;
Type = EulerParam;
};

AnyDrawVector GHRot2Vec = {
AnyRefFrame &ref = .GHRot2.scapula;
AnyVar phi = 2acos(.GHRot2.Pos[0]);
AnyVec3 n = 2
{.GHRot2.Pos[1],.GHRot2.Pos[2],.GHRot2.Pos[3]}.GHRot2.Pos[0]/sin(phi);
Vec = n
ref.Axes’*0.1;
Line.Thickness = 0.005;
Line.RGB = {1,0,0};
};

This both works with the RotVector and EulerParameters measures.

Does it make sense for you ?

Pierre

Hi Pierre,

I’ve just test the concept using RotVector type AnyKinRotational.

AnyKinRotational GHRot2 = {
  AnyRefNode &scapula  = .RightScapula.GH;
  AnyRefNode &humerus = .RightHumerus.GH;
Type= RotVector;
AnyVar RotAngle = vnorm(Pos);
AnyVar RotAngleInDegree = RotAngle * (180/pi); 
        
AnyVec3 RotAxis = Pos / iffun( gtfun(abs(RotAngle), 0.0), RotAngle, 10e10) ;
};

AnyDrawVector GHRot2Vec = {
  AnyRefFrame &ref = .GHRot2.scapula;
Vec = .GHRot2.RotAxis;
PointAway = On;
GlobalCoord = Off;
  Line.Thickness = 0.005;
  Line.RGB = {1,0,0};
};

Because the orientation of rotational axis from AnyKinRotational is a local one, you should specify ‘GlobalCoord=Off’ when you use that axis in your AnyDrawVector object.

Best regards,
Moonki

Hi again,

I read from the ref manual that it is risky but still possible to drive a motion with Euler parameters. I have a situation in which I must pass in a singularity, which fails to work when I use any Euler rotation sequence. I also tried it with the rotation vector, without success.

Thus, I would like to know how I can drive my measure using the Euler parameters. When I try it, it does fails to apply the initial conditions.

Thank you.

Pierre

Hi Pierre,

If you want to drive your segments using euler parameters,
I would suggest you to convert the constraint type(CType) of your drivers as soft.

If it does not work, you can consider to upload your model on the debug section.

Best regards,
Moonki