google / brax

Massively parallel rigidbody physics simulation on accelerator hardware.
Apache License 2.0
2.25k stars 249 forks source link

Radians vs degrees in quaternion logic #305

Open andrewwarrington opened 1 year ago

andrewwarrington commented 1 year ago

Hi Brax,

When converting between quaternions and Euler angles, the function euler_to_quat takes the Euler angles in degrees, but the inverse function, quat_to_euler, returns the Euler angles in radians.

It is documented, and it is a relatively small fix to make in your own code to wrap one of these functions to work either exclusively in degrees or radians; but the code is not really self-consistent (and cost me a day's head-scratching, although I suppose I should have read the docstring...!).

Changing this interface would be a wildly breaking change, so I don't know if there is a quick-fix -- maybe explicitly adding wrapped pairs functions that work in exclusively radians or degrees? Maybe this is something for a later release?

Thanks, Andy

varshneydevansh commented 1 year ago

Can I look into this? Please =)