Getting Eigen3 Matrix3f::eulerAngles() values similar to tf2 Matrix3x3f::getRPY() roll, pitch, yaw
I'm extracting euler angles from a Matrix3x3 based off a quaternion, but am having trouble with getting euler from Eigen that has the same behaviour as tf2::Matrix3x3::getRPY().
Using the following code:
Eigen::Quaternionf acOrient(0.991, -0.019, 0.037, 0.127);
Eigen::Vector3f acEuler = Eigen::Matrix3f(acOrient).eulerAngles(0,1,2);
tf2::Quaternion q( -0.019, 0.037, 0.127, 0.991);
tf2::Matrix3x3 m(q);
double r, p, y;
m.getRPY(r, p, y);
ROS_INFO("AC Y %.3f ACtf %.3f",angles.yaw, acEuler.z(), y );
And the Output is:
[ INFO] [1557815455.909538774]: AC Y -2.885 ACtf 0.254
These should the be same, my question is what modifications do I need to do to the euler extraction from Eigen to achieve this, ie is it a matter of different axis ordering etc.
Thanks.
This behaviour is similar to bug reported on eigen http://eigen.tuxfamily.org/bz/show_bu... . As a feature request to switch to tait-bryan angles which apparently start in range [-pi: pi]. currently the eigen implementation works in [0:pi]. This gives errors if assuming a ZYX rotation order as the output yaw is [0:pi]