1 #include2 #include 3 using namespace std; 4 5 #include 6 // Eigen 几何模块 7 #include 8 9 10 int main ( int argc, char** argv )11 {12 13 //旋转矩阵R14 //3X3的旋转矩阵可以用Matrix3d,也Matrix3f15 Eigen::Matrix3d R=Eigen::Matrix3d::Identity();//将其赋值为单位矩阵16 // Eigen::Matrix3d R;17 // R.setIdentity(); //也是将旋转矩阵赋值为单位矩阵,与上面效果一样18 cout<<"R= \n"< <
运行结果:R=
1 0 00 1 00 0 1rotation vector: Angle is: 45 Axis is: 0 0 1R= 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1q= 0 00.382683 0.92388q=000.3826830.92388q= 0 00.382683 0.92388yaw(Z) pitch(Y) roll(X)=0.785398 -0 0R= 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1