博主在进行旋转矩阵转换成四元数时使用了Eigen库的函数: Eigen::Quaterniond quaternion(RotationMatrix);
它是直接将RotationMatrix(旋转矩阵)转为RotationMatrix(四元数),我之后直接拿着RotationMatrix(四元数)就用在了后续的计算中,结果在编译时就报错:
error:C2338:THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_ OPERATOR_INSTEAD
解决办法,拿个Eigen::Quaterniond变量接住,用这个变量做后续处理:
Eigen::Quaterniond quaternion(RotationMatrix);
Eigen::Quaterniond Quaternion;
Quaternion = RotationMatrix;