[ODE] angular motors

jnilson_99 at yahoo.com jnilson_99 at yahoo.com
Mon Jun 13 00:42:30 MST 2005


for what it's worth, i recently posted numerous
questions asking how to set the amotor angles of a
ball and socket joint.

hold your applause, but i did finally find the answer,

i grabbed the code from the existing function:

amotorComputeEulerAngles

to wit:

  // get q perpendicular to both ax[0] and ref1, get
first euler angle
  dVector3 q;
  dCROSS (q,=,ax[0],ref1);
  joint->angle[0] = -dAtan2
(dDOT(ax[2],q),dDOT(ax[2],ref1));

  // get q perpendicular to both ax[0] and ax[1], get
second euler angle
  dCROSS (q,=,ax[0],ax[1]);
  joint->angle[1] = -dAtan2
(dDOT(ax[2],ax[0]),dDOT(ax[2],q));

  // get q perpendicular to both ax[1] and ax[2], get
third euler angle
  dCROSS (q,=,ax[1],ax[2]);
  joint->angle[2] = -dAtan2 (dDOT(ref2,ax[1]),
dDOT(ref2,q));


you might ask yourselve why didn't i just make my
joint a euler joint, the answer is i wanted to control
all 3 axis. a euler joint restricts 1 of the axis for
some god forsaken reason which i haven't figured out
yet...

anyway....i used the preceding code to tell the amotor
joint in USER mode what the angle is....


hope this helps someone,

john


More information about the ODE mailing list