I'm writing code to implement rotation matrix/Direction Cosine Matrix (DCM).
I know the rotation angle at compile time, so in-order to save on execution time, I wish to initialize the rotation matrix at compile time. but I'm getting the bellow mentioned errors.
Code:
Eigen::Matrix3d lcs_rotation_matrix (
-1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, 1.0
);
Code:
Eigen::Matrix3d rotation_matrix {
-1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, 1.0
};
Code:
const Eigen::Matrix3d lcs_rotation_matrix {
-1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, 1.0
};
Code:
static const Eigen::Matrix3d lcs_rotation_matrix {
-1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, 1.0
};
Error:
Eigen/src/Core/PlainObjectBase.h:538:7: error: static assertion failed due to requirement 'PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3>>::IsVectorAtCompileTime': THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE
Matrix3d
constructor expects vectors, not scalars:
Eigen::Matrix3d lcs_rotation_matrix{
{-1.0, 0.0, 0.0},
{ 0.0, -1.0, 0.0},
{ 0.0, 0.0, 1.0},
};