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.
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.")
Most helpful comment
Noticing = several hours of work to find out why an existing test wasn't passing with new PR!