Reference Blog: http://blog.csdn.net/u011092188/article/details/77430988
The representations of the various forms in the Eigen library are as follows:
1: Rotation matrix (3x3): eigen::matrix3d--uses a matrix to represent the rotation transformation relationships in space
2: Rotation vector (3X1): eigen::angleaxisd--with a rotating axis and a rotation angle to represent rotation
3: Four Yuan (4X1): eigen::quaterniond--with 4 variables to represent rotation, can avoid universal joint lock phenomenon
4: Euler angle (3X1): eigen::vector3d--can be rotated around an axis to represent
5: Transform Matrix (4x4): Eigen::isometry3d
Define variables
ANGLEAXISD t_v;
Matrix3D T_r;
Quaterniond t_q;
The three methods of assigning values to rotation vectors are//1. Initializes the ANGLEAXISD V1 (M_PI/4, Vector3D (0, 0, 1) using the rotated angle and rotation axis vectors;
cout << "Rotation_vector1" << Endl << V1.matrix () << Endl;
2. Use the rotation matrix to rotate the vector//2.1 ANGLEAXISD V2;
V2.fromrotationmatrix (T_r);
cout << "Rotation_vector2" << Endl << V2.matrix () << Endl;
2.2 ANGLEAXISD V3;
V3 = T_r;
cout << "Rotation_vector3" << Endl << V3.matrix () << Endl;
2.3 ANGLEAXISD V4 (T_r);
cout << "Rotation_vector4" << Endl << V4.matrix () << Endl; 3.
The rotation vector is assigned a value of//3.1 ANGLEAXISD V5 using four yuan;
V5 = t_q;
cout << "Rotation_vector5" << Endl << V5.matrix () << Endl;
3.2 ANGLEAXISD V6 (T_Q);
cout << "Rotation_vector6" << Endl << V6.matrix () << Endl;
------------------------------------------------------////1 of the three methods to assign a value of four yuan. Quaterniond Q1 (cos (M_PI/4)/2), 0 * sin ((M_PI/4)/2), 0 * sin ((M_PI/4)/2), 1 * sin ((M_PI/4)/2)),//With (0,0,1) for rotary axis, rotation 45 degrees//first type of output
Four-dollar way cout << "Quaternion1" << Endl << q1.coeffs () << Endl;
The second way to output four of dollars cout << q1.x () << Endl << Endl;
cout << q1.y () << Endl << Endl;
cout << q1.z () << Endl << Endl;
cout << q1.w () << Endl << Endl; 2.
The rotation matrix is used to turn four elements//2.1 Quaterniond Q2;
Q2 = T_r;
cout << "Quaternion2" << Endl << q2.coeffs () << Endl;
2.2 Quaterniond Q3 (T_R);
cout << "Quaternion3" << Endl << q3.coeffs () << Endl; 3.
Use the rotation vector to assign a value of four//3.1 Quaterniond Q4;
Q4 = T_v;
cout << "Quaternion4" << Endl << q4.coeffs () << Endl;
3.2 Quaterniond Q5 (T_V);
cout << "Quaternion5" << Endl << q5.coeffs () << Endl; //----------------------------------------------------//The three methods of assigning values to a rotation matrix//1. Initializes the rotation matrix with a function of the rotation matrix Matrix3D r1=matrix3d
:: Identity ();
cout << "rotation_matrix1" << endl << R1 << Endl; 2.
The rotation matrix is used to assign a value of//2.1 Matrix3D R2 by using the rotation vector rotation matrix;
R2 = T_v.matrix ();
cout << "rotation_matrix2" << endl << R2 << Endl;
2.2 Matrix3D R3;
R3 = T_v.torotationmatrix ();
cout << "Rotation_matrix3" << endl << R3 << Endl; 3.
The rotation matrix is assigned//3.1 Matrix3D R4 using four-yuan-rotation matrix;
R4 = T_q.matrix ();
cout << "rotation_matrix4" << endl << R4 << Endl;
3.2 Matrix3D R5;
R5 = T_q.torotationmatrix (); cout << "rotation_matrix5" << endl << R5 << Endl;