Eigen: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUME

使用eigen时要确保数据类型一致

Eigen::Quaterniond quaternion(imu->orientation.w, imu->orientation.x, imu->orientation.y, imu->orientation.z);
Eigen::Matrix3f rotation_matrix = quaternion.toRotationMatrix();

法一:将第一行的double类型改为float

Eigen::Quaternionf quaternion(imu->orientation.w, imu->orientation.x, imu->orientation.y, imu->orientation.z);
Eigen::Matrix3f rotation_matrix = quaternion.toRotationMatrix();

法二:通过.cast()改为相应类型

Eigen::Quaternionf quaternion(imu->orientation.w, imu->orientation.x, imu->orientation.y, imu->orientation.z);
Eigen::Matrix3f rotation_matrix = quaternion.toRotationMatrix().cast();

你可能感兴趣的:(eigen)