点击上方蓝字,关注本公众号,获得更多资源
上一篇文章介绍了四元数、欧拉角、旋转矩阵、轴角如何相互转换,本篇文章介绍如何用eigen来实现。
旋转向量
1,初始化旋转向量: 旋转角为alpha,旋转轴为(x,y,z)Eigen::AngleAxisd rotation_vector(alpha,Vector3d(x,y,z))
2,旋转向量转旋转矩阵
Eigen::Matrix3d rotation_matrix;rotation_matrix=rotation_vector.matrix();Eigen::Matrix3d rotation_matrix;rotation_matrix=rotation_vector.toRotationMatrix();
3,旋转向量转欧拉角(Z-Y-X,即RPY)
Eigen::Vector3d eulerAngle=rotation_vector.matrix().eulerAngles(2,1,0);
4,旋转向量转四元数