Creating a rotation matrix with pitch, yaw, roll using Eigen

后端 未结 5 1875
挽巷
挽巷 2020-12-24 14:56

How do I create a rotation matrix using pitch, yaw, roll with Eigen library?

5条回答
  •  难免孤独
    2020-12-24 15:53

    Seeing as how I couldn't find a prebuilt function that does this, I built one and here it is in case someone finds this question in the future

    Eigen::AngleAxisd rollAngle(roll, Eigen::Vector3d::UnitZ());
    Eigen::AngleAxisd yawAngle(yaw, Eigen::Vector3d::UnitY());
    Eigen::AngleAxisd pitchAngle(pitch, Eigen::Vector3d::UnitX());
    
    Eigen::Quaternion q = rollAngle * yawAngle * pitchAngle;
    
    Eigen::Matrix3d rotationMatrix = q.matrix();
    

提交回复
热议问题