52 gtsam::Vector
evaluateError(
const gtsam::Pose3& T_W_I, gtsam::OptionalMatrixType H_Ptr = OptionalNone)
const override {
53 gtsam::Matrix33 H_compose;
54 const gtsam::Rot3 R_W_S = H_Ptr ? T_W_I.rotation().compose(
R_I_S_, H_compose) : T_W_I.rotation().compose(
R_I_S_);
57 if (std::abs(R_W_S.pitch()) >= M_PI / 2.0 - 0.1) {
59 (*H_Ptr) = gtsam::Matrix::Zero(1, 6);
61 return gtsam::Vector1::Zero();
65 gtsam::Matrix13 H_yaw;
66 const double estimatedYaw = H_Ptr ? R_W_S.yaw(H_yaw) : R_W_S.yaw();
69 double yawError = estimatedYaw -
yaw_W_S_;
72 while (yawError < -M_PI) yawError += 2 * M_PI;
73 while (yawError > M_PI) yawError -= 2 * M_PI;
77 (*H_Ptr) = gtsam::Matrix::Zero(1, 6);
78 H_Ptr->block<1, 3>(0, 0) = H_yaw * H_compose;
81 return gtsam::Vector1(yawError);