[ODE] angular motors

jnilson_99 at yahoo.com jnilson_99 at yahoo.com
Mon Jun 13 20:52:52 MST 2005


jason,

one other thing in addition to setting bounce
correctly.

i also had to create a function:

setBallAndSocketReferenceVectors(shoulders[0])
{
	const dReal* R1 =
dBodyGetRotation(pjoint->body1->bodyID);
	const dReal* R2 =
dBodyGetRotation(pjoint->body2->bodyID);

	//from amotorSetEulerReferenceVectors
    dVector3 r;		// axis[2] and axis[0] in global
coordinates
    dMULTIPLY0_331 (r,R2,axees[2]);
	dMULTIPLY1_331 (pjoint->referenceVector1,R1,r);
    dMULTIPLY0_331 (r,R1,axees[0]);
	dMULTIPLY1_331 (pjoint->referenceVector2,R2,r); 
}

the axis need to be set as well when you call
dJointSetAMotorAxis. i used the following:
axees[0][0] = 1;axees[0][1] = 0;axees[0][2] = 0;
axees[1][0] = 0;axees[1][1] = 1;axees[1][2] = 0;
axees[2][0] = 0;axees[2][1] = 0;axees[2][2] = 1;

this is necessary if you use the code from
amotorComputeEulerAngles to get the angles.


maybe we should add this code to CVS so that when an
amotor is in USER mode you get default angle
measurements that actually work :-).

john

--- Jason Mallios <jmallios at cs.brown.edu> wrote:

> John,
> 
> Did this allow for high and low stops to be set
> along each axis as well?
> 
> Jason
> 
> On Mon, 13 Jun 2005 jnilson_99 at yahoo.com wrote:
> 
> >
> > 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
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> >
> 



More information about the ODE mailing list