[ODE] Ball and Socket or (Universal +Hinge)

Jason Mallios jmallios at cs.brown.edu
Mon Apr 10 14:48:53 MST 2006


In user mode, I believe you have to set both the axes and the angles every
frame.  See section 7.3.8 of the documentation in the table describing
dAMotorUser.  No one I know of has succesfully implemented reliable (meaning
predictable) AMotors for 3 rotational degrees of freedom with stops in
conjunction with a ball joint.  In this forum they have typically been used
for 2-dof situations like keeping a capsule upright.  Also, the AMotor is
quite good at keeping a joint fixed when all dParam**Stop* parameters are
set to 0.0f.

I worked on AMotors for several months and switched to a custom 3-dof joint
that doesn't rely on ODE at all, so it doesn't have the benefit of seeing
forward in time as does the constraint equation.  As I recall, my main
issues with AMotors were maintaining orthogonality of the axes in either
mode.  I remember a user mode ambiguity regarding which axis should be
applied to which body (or the "global frame") and the euler mode habit of
destroying orthogonality when rotating about the mysterious, automatically
computed, a1 axis.  This included the UNSTABLE branch as of two or three
months ago.

You should search the archives for more info.

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of Jaap
Stolk
Sent: Monday, April 10, 2006 4:23 PM
To: ode at q12.org
Subject: Re: [ODE] Ball and Socket or (Universal +Hinge)

On 4/10/06, Jaap Stolk <jwstolk at gmail.com> wrote:
> I get no errors for dJointGetAMotorAngle(), but the result is always 
> zero. is this one also not implemented for dAMotorUser ?

maybe i always get a zero angle because i set the motor up wrong ?
setting the directly seems to have the expected effect in the simulation, so
the motor is doing "something". My code looks about like this: (joints are
actually stored in an array)

#define AXIS_GLOBAL      0
#define AXIS_FIRST_BODY  1
#define AXIS_SECOND_BODY 2
  dBodyID  body0, body1;
  dJointID joint, jointMot;

  // ball joint:
  joint = dJointCreateBall(world,0);
  dJointAttach(joint, body0, body1);
  dJointSetBallAnchor(joint, joint_x, joint_y, joint_z);
  // add a motor to contol the 3 axes of rotation:
  jointMot = dJointCreateAMotor(world,0);
  dJointAttach(jointMot, body0, body1);
  dJointSetAMotorMode(   jointMot, dAMotorUser);
  dJointSetAMotorNumAxes(jointMot, 3);
  dJointSetAMotorAxis(   jointMot, 0, AXIS_FIRST_BODY, 1,0,0);
  dJointSetAMotorAxis(   jointMot, 1, AXIS_SECOND_BODY,0,1,0);
  dJointSetAMotorAxis(   jointMot, 2, AXIS_SECOND_BODY,0,0,1);
  dJointSetAMotorAngle(  jointMot, 0, 0.0);
  dJointSetAMotorAngle(  jointMot, 1, 0.0);
  dJointSetAMotorAngle(  jointMot, 2, 0.0);

  //then before each simulation step:
  ang_x  = dJointGetAMotorAngle(    jointMot,0); // (always zero ?)
  angv_x = dJointGetAMotorAngleRate(jointMot,0); // (not implemented)
  ang_y  = dJointGetAMotorAngle(    jointMot,1); // etc.
  angv_y = dJointGetAMotorAngleRate(jointMot,1);
  ang_z  = dJointGetAMotorAngle(    jointMot,2);
  angv_z = dJointGetAMotorAngleRate(jointMot,2);

  dJointAddAMotorTorques(jointMot, torque_x, torque_y, torque_z);

is there something missing in the motor initialization ?

Jaap

_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list