我需要从旋转矩阵中提取滚动俯仰偏航角,并且我想确保我所做的是正确的。
Eigen::Matrix< simFloat, 3, 1> rpy = orientation.toRotationMatrix().eulerAngles(0,1,2);
const double r = ((double)rpy(0));
const double p = ((double)rpy(1));
const double y = ((double)rpy(2));
这样对吗?因为我在这里阅读: http://eigen.tuxfamily.org/dox/group__Geometry__Module.html#gad118fececd448d7485ffea4858775e5a
当它在描述的末尾说,其中定义了角度的间隔时,我有点困惑。
最佳答案
我想这就是您要找的。取决于我们如何使用
m.eulerAngles(0, 1, 2)
;
这是使用 rotx*roty*rotz
Matrix3f m;
m = AngleAxisf(0.25*M_PI, Vector3f::UnitX())
* AngleAxisf(0.5*M_PI, Vector3f::UnitY())
* AngleAxisf(0.33*M_PI, Vector3f::UnitZ());
cout << "original rotation:" << endl;
cout << m << endl << endl;
Vector3f ea = m.eulerAngles(0, 1, 2);
cout << "to Euler angles:" << endl;
cout << ea << endl << endl;
Matrix3f n;
n = AngleAxisf(ea[0], Vector3f::UnitX())
* AngleAxisf(ea[1], Vector3f::UnitY())
* AngleAxisf(ea[2], Vector3f::UnitZ());
cout << "recalc original rotation:" << endl;
cout << n << endl;
感谢您的引用!我也是先用Eigen。简直省事多了!
关于c++ - 使用 Eigen 库从旋转矩阵滚动俯仰和偏航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27508242/