[ODE] Angular motor and axis newbie question

honza at jikos.cz honza at jikos.cz
Wed Nov 17 19:49:26 MST 2004


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
> 
> 
> 
> 

-- 


More information about the ODE mailing list