# [ODE] what is wrong with amotor joint?

Bram Stolk bram at sara.nl
Tue Dec 5 07:36:10 MST 2006

```Krystian Ligenza wrote:
> why posts regarding AMotor joint are left without answer? Please, if the
> problem of AMotor joint is not with it's implementation, but in bad
> understading of using it, then tell me, and I will be sure that it can
> work good. But if there is no way to make it work good I would like to
> know that and leave it.

amotors are usually used in combination with another joint.

E.g. a Hinge and AMotor on the same two bodies is very common.

Then just read the Hinge angle.

This is e.g. some sample code:

hinge = dJointCreateHinge(world, 0);
dJointAttach(hinge, hull_body, turret_body);
dJointSetHingeAnchor(hinge, initialpos[0]-0.95, initialpos[1],initialpos[2]+0.
2);
dJointSetHingeAxis(hinge, 0,1,0);
dJointSetHingeParam(hinge, dParamLoStop, 0.00*M_PI);
dJointSetHingeParam(hinge, dParamHiStop, 0.50*M_PI);
dJointSetHingeParam(hinge, dParamCFM,    0.0005);

amotor = dJointCreateAMotor(world, 0);
dJointAttach(amotor, hull_body, turret_body);
dJointSetAMotorNumAxes(amotor, 1);
dJointSetAMotorAxis(amotor, 0, 1, 0,1,0);
dJointSetAMotorParam(amotor, dParamVel, 0.0);
dJointSetAMotorParam(amotor, dParamFMax, 10000);

Bram

>
> Thanks,
> Krystian
>
>> Hi,
>>
>> don't know what to do. I have set a ragdoll with only few joint that are
>> ball with AMotor to limit its rotation. Limit's don't work on
>> AMotor....there are no dJointGetAMotorAngleRate() function
>> implementation.... OK, I could live with that... But now it's looking that
>>  dJointGetAMotorAngle() return strange angles. I have tried to setup
>> PD-controller to get my ragdoll to certain position and all joint (hinge
>> and universal) work ok, but for AMotor joint it simply don't work good.
>> What is with this joint?
>>
>> Thanks,
>> Krystian
>>
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

--
Bram Stolk, VR Engineer SARA, Amsterdam.   tel +31 20 592 3000

"Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit
operating system originally coded for a 4-bit microprocessor by a 2-bit
company that can't stand 1 bit of competition."
```