Drake: quaternion.h quat2rotmat() normalizes the quaternion (when it shouldn't)

Created on 27 Jan 2017  路  6Comments  路  Source: RobotLocomotion/drake

quat2rotmat() normalizes quaternions on entry; the function specification indicates that the quaternion input should be normalized on entry, but then goes ahead and normalizes the quaternion anyway.

This subtle issue results in derivatives of functions that use quaternions to be computed incorrectly. For example, the time derivative of Xq is different than the time derivative of Xq/norm(q).

We expect this issue to be fixed automatically by the introduction of MultibodyTree.

dynamics

Most helpful comment

Noticing = several hours of work to find out why an existing test wasn't passing with new PR!

All 6 comments

Thank you for noticing this issue @edrumwri. I also hope that when we start adding well documented implementations plus unit tests we will get rid of this kind of problems.
I am not working on the new quaternion implementation yet but I will for sure ping you on this when I start that work.

Noticing = several hours of work to find out why an existing test wasn't passing with new PR!

We have Eigen's Quaternion<T>::toRotationMatrix(). I wonder if it has the same issue.

No, Eigen's method doesn't normalize so it is OK.

@mitiguy Has this issue been fixed already?

quat2rotmat() has been deprecated.
This issue can be closed.

DRAKE_DEPRECATED("Use math::RotationMatrix(Eigen::Quaternion). "
"Code will be deleted after February 5, 2019.")

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EricCousineau-TRI picture EricCousineau-TRI  路  3Comments

mntan3 picture mntan3  路  4Comments

Islam0mar picture Islam0mar  路  4Comments

jwnimmer-tri picture jwnimmer-tri  路  4Comments

SeanCurtis-TRI picture SeanCurtis-TRI  路  4Comments