[ODE] Angular motor and axis newbie question

Konstantin Voloshin volk-ode at yandex.ru
Fri Nov 19 14:48:28 MST 2004


Hello

Assuming that Java wrappers work correctly ;), the only suspicious thing about your code I see
is that your body's rotation matrix (in global coordinates) could be not identity-matrix at the time
AMotor is created. If so, perhaps you have forgotten that 'setAxis' accepts axes in _global_ coordinates.

Konstantin Voloshin

----- Original Message ----- 
From: <honza at jikos.cz>
To: <ode at q12.org>
Sent: Wednesday, November 17, 2004 9:49 PM
Subject: Re: [ODE] Angular motor and axis newbie question


Ok i reply to myself.

On Tue, 16 Nov 2004 honza at jikos.cz wrote:

> Hello, 
>  i have troubles with angular motors and i didn't find answer to my 
> stupid questions in archives (i bet it is there but ...)
> I am simulating spaceship (so no gravity etc) as one body then i attach 
> angular motor to it. It works just fine but when i rotate the body a 
> little and then i try to rotate it again around another axis it looks like 
> it is trying to rotate it according to "unrotated axis", but i want to 
> rotate relative to body position.
> I'll paste relevant code:
> 
> Initialization:
>     motor = new ode::dAMotorJoint(manager->world->id());
>     motor->attach( body->id(), 0);
>     motor->setNumAxes(3);
>     motor->setAxis(0, 1, 1,0,0);
>     motor->setAxis(1, 1, 0,1,0);
>     motor->setAxis(2, 1, 0,0,1);
>     motor->setParam(ode::dParamFMax, 1);
>     motor->setParam(ode::dParamFMax2, 1);
>     motor->setParam(ode::dParamFMax3, 1);
> 
> When request on motor angular velocities sent:
pseudo_code
rot = body->getRotation();
desiredAngVel = desiredAngVel * rot;
solves given problem.
But shouldn't this rotation by done by ode? It is more then clear that i 
missunderstand something. But what?
Jan Kratochvil

>     motor->setParam(ode::dParamVel, desiredAngVel[0]);
>     motor->setParam(ode::dParamVel2, desiredAngVel[1]);
>     motor->setParam(ode::dParamVel3, desiredAngVel[2]);
> 
> i thought that second parameter in setAxis is telling that axis are 
> relative to the body. (anchored to the body .. as documentation says)
> 
> Can i use dAMotorEuler? I am scared of this line in doc
>  Axis 0 must be anchored to the first body, axis 2 must be anchored to the 
> second body.
> 
> Thanks a lot for your potential advice :)
> Jan Kratochvil
-- 
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list