mathnet / mathnet-spatial

Math.NET Spatial
http://spatial.mathdotnet.com
MIT License
376 stars 132 forks source link

Fix order of YPR (yaw-pitch-roll) transformation #194

Closed jakehedlund closed 1 year ago

jakehedlund commented 2 years ago

See https://en.wikipedia.org/wiki/Rotation_matrix#General_rotations for correct order of application.

Counterintuitively, the YPR rotations must be applied in reverse order to be correct. The resultant rotation matrix should be Rz(Ry(Rx)) instead of Rx(Ry(Rz)) where z is yaw, y is pitch, and x is roll. This is the correct intrinsic spatial rotation as shown in the Wikipedia link above.

Fixes #180.

For easy verification, an excel file to compute the correct rotation matrix is attached. rotationmatrix.xlsx

cdrnet commented 1 year ago

Thank you!

Looks like I first need to upgrade the SDK to fix CI build before I can merge.

jkalias commented 1 year ago

SDK has been updated to 5.0.200, so the CI build runs through.

jkalias commented 1 year ago

Please merge the master branch in your branch, so that you also gain from the passing CI build. Otherwise we cannot merge this.