# Problem: DriverPos's of spherical joint don't agree with AnySeg initial Axes0

Hi,

I’m dealing with that problem:

I have an AnySeg (seg1) linked to GlobalRef with a spherical joint (joint1).
I would set seg1 as initially rotated about 10, 20 and 25 degrees around x, y and z consecutively.
So in AnySeg seg1 I set:
Axes0 = RotMat(10*pi/180, x)RotMat(20pi/180, y)RotMat(25pi/180, z);

Then I write joint1:

``````     AnySphericalJoint joint1 =
{
};
``````

And the Driver (driver1) just imposing DriverPos to be equal to Axes0 configuration (avoiding movements so DriverVel=0 for all axes):

``````      AnyKinEqSimpleDriver driver1 =
{
AnySphericalJoint &joint = .joint1;
DriverPos = {10*pi/180, 20*pi/180, 25*pi/180};
DriverVel = {0,0,0};
MeasureOrganizer = {0,1,2};
};
``````

The problem is that the appearence of seg1 in the 3D space after loading the model looks visually and numerically different when running InitialCondition in MyStudy folder. It seems that when AnyBody loads DriverPos calculatin the starting configuration, the angles are managed differently from that in Axes0.
I know that the order given to define Axes0 is fundamental but how is possible to compute the correct DriverPos from the rotations used to define Axes0?

Tito

P.S. using AnyBody v.6

Hi Tito

I think your confusion is caused by the fact that the default output of the sphericaljoint is a cartisian rotation vector and not euler/bryan angles ( which is called RotAxesAngles in AnyBody).

So when you add a driver with euler angles to a spherical joint you get something completely wrong.

You can just change the behavior to be RotAxesAngles with the rotation sequence you expect.

``````AnySphericalJoint joint1 =
{
Orientation.Type = RotAxesAngles ;
Orientation.Axis1 = x;
Orientation.Axis2 = y;
Orientation.Axis3 = z;

};
``````

That should give you the same sequence you used to create the Axes0 rotation matrix (x,y,z). Note that there are 12 different rotation sequences, that could be used to give the same rotation. See the http://en.wikipedia.org/wiki/Euler_angles

/Morten

Thank you very much! it works!!

Tito