I am getting different results when trying to calculate the Euler angles when
using
AnyKinRotational, type = RotAxesAngles.
Below is some code that I wrote to test this, but what I am trying to do is:
define three angles : {1.5103, 0.2263, 2.3537};
construct an original rotation matrix using those angles
calculate three angles (they may not be the same as the original three) from the
rotation
matrix
calculate a new rotation matrix.
the original rotation matrix should be the same as the new rotation
matrix…this is not
happening for the sequence I have defined:
Thanks for your help. Am I doing something wrong?
-David
Here is the code:
// Todo: Write a small description of your model here
//Load and run set Initial conditions.
//It will fail, but not before it calculates the values of
//tempMatrix, and tempMatric_calc
//
//I think they should be the same…but they are not.
//The tempAngles and tempAngles_calc should be the same and seem to be
//different by a factor of 180 (pi)…when if they are different , I think they
should
//be by a factor of 360 degrees (2*pi)
//Thoughts? Am I doing something wrong here?
Main = {
// The actual body model goes in this folder
AnyFolder MyModel = {
// Global Reference Frame
AnyFixedRefFrame GlobalRef = {
// Todo: Add points for grounding of the model here
}; // Global reference frame
// Todo. Add the model elements such as
// segments, joints, and muscles here.
AnyVector tempAngles = {1.5103, 0.2263, 2.3537};
AnyMatrix tempMatrix = RotMat( tempAngles[0] ,z)*
RotMat( tempAngles[1] ,y)*
RotMat( tempAngles[2] ,x);
AnySeg tempSeg =
{
//r0 = {0, 0, 0};
//rDot0 = {0, 0, 0};
Axes0 = .tempMatrix;
//omega0 = {0, 0, 0};
Mass = 0;
Jii = {0, 0, 0};
//Jij = {0, 0, 0};
//sCoM = {0, 0, 0};
};
AnyKinRotational tempAngles_calc ={
AnyRefFrame &ref1 = .GlobalRef;
AnySeg &ref2 = .tempSeg;
Type=RotAxesAngles;
//DW added code
Axis1 = z;
Axis2 = y;
Axis3 = x;
//finished DW added code
};
AnyMatrix tempMatrix_calc = RotMat( tempAngles_calc.Pos[0] ,z)*
RotMat( tempAngles_calc.Pos[1] ,y)*
RotMat( tempAngles_calc.Pos[2] ,x);
}; // MyModel
// The study: Operations to be performed on the model
AnyBodyStudy MyStudy = {
AnyFolder &Model = .MyModel;
RecruitmentSolver = MinMaxSimplex;
Gravity = {0.0, -9.81, 0.0};
};
}; // Main