使用 Eigen 创建具有俯仰、偏航、滚动的旋转矩阵

2022-01-16 00:00:00 matrix math rotation c++ eigen

如何通过 Eigen 库使用俯仰、偏航、滚动创建旋转矩阵?

解决方案

看到我怎么找不到可以做到这一点的预建函数,我构建了一个,以防将来有人发现这个问题

p>

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

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

解决方案

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<double> q = rollAngle * yawAngle * pitchAngle;

Eigen::Matrix3d rotationMatrix = q.matrix();

相关文章