# I'm having trouble getting the angle of MFR-LQ Project.

22 views

### takai hironori

Sep 11, 2020, 7:06:04 PM9/11/20
to ode-users
MFR-LQ is a my project.
I'm having trouble getting the angle.

dJointGetHingeAngle()

The angle range is from -pi to +pi. Is it possible to obtain the relative angle from  -infinite to +infinite ?

dBodyGetRotation()

Is it possible to get the absolute angles  -infinite to  +infinite directly instead of the rotation matrix?

In the code of demura.net, it is calculated by atan2 (), so when the angle exceeds 90 degrees, the calculation will be defective. Is there a way to solve it?

### Bill Sellers

Sep 12, 2020, 8:45:54 AM9/12/20
to ode-users
Angles are a huge pain in the neck, and to do what you want I think you will have to maintain a local state and record the angular change at each time step (and do something sensible with the -pi to +pi transition). Or you can return the angular velocity and maintain your own sum of the integral. ODE doesn't store anything other than the rotation matrix (which it converts into a quaternion if you ask for that) so it cannot return the total rotation of a body from it's starting pose unless that rotation is within the range of -pi to +pi. If you have things like a wheel spinning then ODE knows nothing about that (which is also why the simulation will go wrong if the angular change is too large in a single time step). It would be possible to modify things like the hinge joint to have an accumulated angle but I'm pretty sure it does not do that out of the box.

I've often thought that there must be other ways of representing angles that get around some of these issues but I've not come across them. Quaternions, matrices and Euler angles all have these same limitations of domain.

Cheers
Bill
> --
> You received this message because you are subscribed to the Google Groups "ode-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+...@googlegroups.com <mailto:ode-users+...@googlegroups.com>.