27 cout << (
s.empty() ?
"" :
s +
" ") <<
"GPSFactor on " << keyFormatter(
key())
29 cout <<
" GPS measurement: " << nT_ <<
"\n";
30 noiseModel_->print(
" noise model: ");
42 return p.translation(
H) -nT_;
46 pair<Pose3, Vector3> GPSFactor::EstimateState(
double t1,
const Point3& NED1,
47 double t2,
const Point3& NED2,
double timestamp) {
53 Point3 nT = NED1 + nV * (timestamp - t1);
56 double yaw =
atan2(nV.y(), nV.x());
57 Rot3 nRy = Rot3::Yaw(yaw);
59 double pitch = -
atan2(yV.z(), yV.x()), roll = 0;
60 Rot3 nRb = Rot3::Ypr(yaw, pitch, roll);
65 return make_pair(nTb, nV);
70 cout <<
s <<
"GPSFactorArm on " << keyFormatter(
key()) <<
"\n";
71 cout <<
" GPS measurement: " << nT_.transpose() <<
"\n";
72 cout <<
" Lever arm: " << bL_.transpose() <<
"\n";
73 noiseModel_->print(
" noise model: ");
79 return e !=
nullptr && Base::equals(*
e,
tol) &&
87 const Matrix3
nRb =
p.rotation().matrix();
92 H->block<3, 3>(0, 3) =
nRb;
95 return p.translation() +
nRb * bL_ - nT_;
100 cout <<
s <<
"GPSFactorArmCalib on " << keyFormatter(
key()) <<
"\n";
101 cout <<
" GPS measurement: " << nT_.transpose() <<
"\n";
102 noiseModel_->print(
" noise model: ");
108 return e !=
nullptr && Base::equals(*
e,
tol) &&
115 const Matrix3
nRb =
p.rotation().matrix();
120 H1->block<3, 3>(0, 3) =
nRb;
127 return p.translation() +
nRb * bL - nT_;
132 cout <<
s <<
"GPSFactor2 on " << keyFormatter(
key()) <<
"\n";
133 cout <<
" GPS measurement: " << nT_.transpose() << endl;
134 noiseModel_->print(
" noise model: ");
140 return e !=
nullptr && Base::equals(*
e,
tol) &&
147 return p.position(
H) -nT_;
152 cout <<
s <<
"GPSFactor2Arm on " << keyFormatter(
key()) <<
"\n";
153 cout <<
" GPS measurement: " << nT_.transpose() <<
"\n";
154 cout <<
" Lever arm: " << bL_.transpose() <<
"\n";
155 noiseModel_->print(
" noise model: ");
161 return e !=
nullptr && Base::equals(*
e,
tol) &&
169 const Matrix3
nRb =
p.attitude().matrix();
174 H->block<3, 3>(0, 3) =
nRb;
178 return p.position() +
nRb * bL_ - nT_;
183 cout <<
s <<
"GPSFactor2ArmCalib on " << keyFormatter(
key()) <<
"\n";
184 cout <<
" GPS measurement: " << nT_.transpose() <<
"\n";
185 noiseModel_->print(
" noise model: ");
191 return e !=
nullptr && Base::equals(*
e,
tol) &&
198 const Matrix3
nRb =
p.attitude().matrix();
203 H1->block<3, 3>(0, 3) =
nRb;
204 H1->block<3, 3>(0, 6).
setZero();
211 return p.position() +
nRb * bL - nT_;