【问题标题】:Roll pitch and yaw from Rotation matrix with Eigen Library带有特征库的旋转矩阵的滚动俯仰和偏航
【发布时间】:2014-12-16 15:38:02
【问题描述】:

我需要从旋转矩阵中提取滚动俯仰偏航角,并且我想确保我所做的事情是正确的。

    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

当它在描述的末尾说定义角度时,我有点困惑。

【问题讨论】:

    标签: c++ matrix eigen rotational-matrices euler-angles


    【解决方案1】:

    我认为这就是您要寻找的。取决于我们如何使用 m.eulerAngles(0, 1, 2); 这是用rotx*roty*rotz重构的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。简直是省了不少功夫!

    【讨论】:

      【解决方案2】:

      Shawn Le 的答案是正确的,但我认为应该是

      Vector3f ea = m.eulerAngles(2, 1, 0);
      

      然后ea 将按该顺序保存偏航俯仰和滚动值。 ZYX欧拉角旋转相当于XYZ定轴旋转,只不过是roll pitch和yaw。

      【讨论】:

      • 也许这可以更好地解释,因为如果那条线改变了,那么重新计算旋转矩阵会产生一个不同于最初计算的旋转矩阵。除非单位矩阵的顺序发生变化,否则我认为“m.eulerAngles(0, 1, 2);”是正确的。
      • 不,我很确定应该是 (2,1,0) 上面的矩阵乘法不是传统的滚动俯仰偏航。旋转应该是 R_yaw * R_pitch * R_roll 而不是相反。
      • 它是m.eulerAngles(2,1,0)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-20
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多