48 gtsam::Vector
evaluateError(
const gtsam::Pose3& robotPose, gtsam::OptionalMatrixType H_Ptr = OptionalNone)
const override {
50 if (std::abs(robotPose.rotation().pitch()) >= M_PI / 2.0 - 0.1) {
52 (*H_Ptr) = gtsam::Matrix::Zero(1, 6);
54 return gtsam::Vector1::Zero();
58 gtsam::Matrix13 H_rot;
59 const double estimatedPitch = H_Ptr ? robotPose.rotation().pitch(H_rot) : robotPose.rotation().pitch();
62 double pitchError = estimatedPitch -
pitch_;
65 while (pitchError < -M_PI) pitchError += 2 * M_PI;
66 while (pitchError > M_PI) pitchError -= 2 * M_PI;
70 (*H_Ptr) = gtsam::Matrix::Zero(1, 6);
71 H_Ptr->block<1, 3>(0, 0) = H_rot;
74 return gtsam::Vector1(pitchError);