[ODE] sigh
jnilson_99 at yahoo.com
jnilson_99 at yahoo.com
Sun May 8 13:09:04 MST 2005
here are the questions that weigh on my mind about
amotor using a ball/socket in dAMotorUser mode:
i'm using the ball/socket/amotor on the shoulders of a
biped. i create the two joints,specify the axis for
the amotor and attach them just fine.
the problem arises when i try to move the arms which
makes me think i don't understand how to set the axis
and find the angles between them.
1. when setting the axis for the amotor, do i just set
it ONCE during creating. for example:
dJointSetAMotorAxis (constraint->constraintID,0,2,
1,0,0);
dJointSetAMotorAxis (constraint->constraintID,1,2,
0,1,0);
dJointSetAMotorAxis (constraint->constraintID,2,2,
0,0,1);
or do i update the axis every time step? i thought
this might work because as the biped moves around (and
moves the orientation of the torso and upper arms
around) the joint axis needs to be updated. i tried
the following every time step:
//const dReal* R1 =
dBodyGetRotation(bodyParts[BODY_TYPE_TORSO]->bodyID);
const dReal* R2 =
dBodyGetRotation(bodyParts[BODY_TYPE_LEFT_UPPER_ARM]->bodyID);
dJointSetAMotorAxis
(joints[JOINT_TYPE_LEFT_SHOULDER]->constraintID,0,2,
R2[0],R2[4],R2[8]);
dJointSetAMotorAxis
(joints[JOINT_TYPE_LEFT_SHOULDER]->constraintID,1,2,
R2[1],R2[5],R2[9]);
dJointSetAMotorAxis
(joints[JOINT_TYPE_LEFT_SHOULDER]->constraintID,2,2,
R2[2],R2[6],R2[10]);
2. in calling dJointSetAMotorAngle, i assume i send
the angle between each axis of the torso and shoulders
respectively. rather than the angle between my
shoulder and the world, which wouldn't make sense
because hi/lo stops wouldn't make sense as the arm in
relation to the world will have a far greater angle
difference than the arm and the torso.
3. in finding the angle to send to
dJointSetAMotorAngle i use the dot product between the
two axis respectively. however the sign (+or-) is not
incorporated because i havn't used the cross product
to find the direction/winding order of the two axis
vectors. do you know the correct way to use the cross
product to find the correct sign of the angle returned
by the dot product?
const dReal* R1 =
dBodyGetRotation(bodyParts[BODY_TYPE_TORSO]->bodyID);
const dReal* R2 =
dBodyGetRotation(bodyParts[BODY_TYPE_LEFT_UPPER_ARM]->bodyID);
dVector3 xa1 = {R1[0],R1[4],R1[8]};
dVector3 xa2 = {R2[0],R2[4],R2[8]};
dVector3 ya1 = {R1[1],R1[5],R1[9]};
dVector3 ya2 = {R2[1],R2[5],R2[9]};
dVector3 za1 = {R1[2],R1[6],R1[10]};
dVector3 za2 = {R2[2],R2[6],R2[10]};
dNormalize3 (xa1);
dNormalize3 (xa2);
dNormalize3 (ya1);
dNormalize3 (ya2);
dNormalize3 (za1);
dNormalize3 (za2);
dReal xDotAngle = dDOT(xa1,xa2);
dReal yDotAngle = dDOT(ya1,ya2);
dReal zDotAngle = dDOT(za1,za2);
thanks,
john nilson
More information about the ODE
mailing list