imrasp / LearnVI_Drone

7 stars 1 forks source link

Eigen #28

Open imrasp opened 6 years ago

imrasp commented 6 years ago

Beside Eigens eulerAngles() method, you can also use the matrixToYawPitchRoll() method:

include <math/YawPitchRoll.h>

float yaw,pitch,roll; boost::tie(yaw,pitch,roll) = matrixToYawPitchRoll(R);

All available conversions are:

Yaw,Pitch,Roll --> Quaterion:

Eigen::Quaternionf q = quaternionFromYawPitchRoll(yaw,pitch,roll);

Quaterion --> Yaw,Pitch,Roll:

boost::tie(yaw,pitch,roll) = quaternionToYawPitchRoll(q);

Yaw,Pitch,Roll --> Rotation matrix:

Eigen::Matrix3f R = matrixFromYawPitchRoll(yaw,pitch,roll);

Rotation matrix --> Yaw,Pitch,Roll:

boost::tie(yaw,pitch,roll) = matrixToYawPitchRoll(R);

http://www.mira-project.org/osqa/questions/50/how-do-i-extract-yawpitch-and-roll-out-of-a-rotation-matrix