29 static const bool isDebugTest =
false;
31 static const Key c1 = 1,
c2 = 2, c3 = 3;
33 static const double rankTol = 1.0;
36 template<
class CALIBRATION>
42 Pose3 perturbedCameraPose = cameraPose.
compose(noise_pose);
46 CALIBRATION perturbedCalibration =
camera.calibration().
retract(
d);
56 Camera actualCamera(perturbed_level_pose,
K2);
114 double expectedError = 0.0;
142 double expectedError = 58640;
178 Point2Vector measurements_cam1, measurements_cam2, measurements_cam3;
188 smartFactor1->add(measurements_cam1, views);
189 smartFactor2->add(measurements_cam2, views);
190 smartFactor3->add(measurements_cam3, views);
197 const SharedDiagonal noisePrior = noiseModel::Isotropic::Sigma(6 + 5, 1
e-5);
210 EXPECT(!smartFactor1->point());
211 EXPECT(!smartFactor2->point());
212 EXPECT(!smartFactor3->point());
219 CHECK(smartFactor1->point());
220 CHECK(smartFactor2->point());
221 CHECK(smartFactor3->point());
235 expected << 256, 29, -26, 29, -206, -202;
241 Vector actual = smartFactor1->whitenedError(cameras1,
point1);
277 Point2Vector measurements_cam1, measurements_cam2, measurements_cam3;
285 for (
size_t i = 0;
i < 3; ++
i) {
289 smartFactor1->add(track1);
292 for (
size_t i = 0;
i < 3; ++
i) {
296 smartFactor2->add(track2);
299 smartFactor3->add(measurements_cam3, views);
301 const SharedDiagonal noisePrior = noiseModel::Isotropic::Sigma(6 + 5, 1
e-5);
346 Point2Vector measurements_cam1, measurements_cam2, measurements_cam3,
347 measurements_cam4, measurements_cam5;
359 smartFactor1->add(measurements_cam1, views);
362 smartFactor2->add(measurements_cam2, views);
365 smartFactor3->add(measurements_cam3, views);
368 smartFactor4->add(measurements_cam4, views);
371 smartFactor5->add(measurements_cam5, views);
373 const SharedDiagonal noisePrior = noiseModel::Isotropic::Sigma(6 + 5, 1
e-5);
423 Point2Vector measurements_cam1, measurements_cam2, measurements_cam3,
424 measurements_cam4, measurements_cam5;
436 smartFactor1->add(measurements_cam1, views);
439 smartFactor2->add(measurements_cam2, views);
442 smartFactor3->add(measurements_cam3, views);
445 smartFactor4->add(measurements_cam4, views);
448 smartFactor5->add(measurements_cam5, views);
450 const SharedDiagonal noisePrior = noiseModel::Isotropic::Sigma(9, 1
e-6);
496 Point2Vector measurements_cam1, measurements_cam2, measurements_cam3,
497 measurements_cam4, measurements_cam5;
509 smartFactor1->add(measurements_cam1, views);
512 smartFactor2->add(measurements_cam2, views);
515 smartFactor3->add(measurements_cam3, views);
518 smartFactor4->add(measurements_cam4, views);
521 smartFactor5->add(measurements_cam5, views);
523 const SharedDiagonal noisePrior = noiseModel::Isotropic::Sigma(9, 1
e-6);
578 double expectedError = 0.0;
583 oldPoint = *(
factor1->point());
585 Point3 expectedPoint(0,0,0);
606 double expectedErrorGraph = smartGraph.
error(
values);
607 Point3 expectedPoint(0,0,0);
609 expectedPoint = *(
factor1->point());
622 double actualError = 0.5 * (e1.squaredNorm() + e2.squaredNorm());
623 double actualErrorGraph = generalGraph.
error(
values);
646 Point3 expectedPoint(0,0,0);
648 expectedPoint = *(
factor1->point());
661 Matrix actualHessian = actualFullHessian.block(0, 0, 18, 18)
662 - actualFullHessian.block(0, 18, 18, 3)
663 * (actualFullHessian.block(18, 18, 3, 3)).
inverse()
664 * actualFullHessian.block(18, 0, 3, 18);
665 Vector actualInfoVector = actualFullInfoVector.block(0, 0, 18, 1)
666 - actualFullHessian.block(0, 18, 18, 3)
667 * (actualFullHessian.block(18, 18, 3, 3)).
inverse()
668 * actualFullInfoVector.block(18, 0, 3, 1);
755 Matrix actualVinv = (actualFullHessian.block(18, 18, 3, 3)).
inverse();
757 Matrix3 expectedVinv =
factor1->PointCov(expectedE);
796 implicitFactor->linearize(
values);
797 CHECK(gaussianImplicitSchurFactor);
799 Implicit9& implicitSchurFactor =
800 dynamic_cast<Implicit9&
>(*gaussianImplicitSchurFactor);
803 {
c1, (
Vector(9) << 1, 2, 3, 4, 5, 6, 7, 8, 9).finished()},
804 {
c2, (
Vector(9) << 11, 12, 13, 14, 15, 16, 17, 18, 19).finished()}};
809 implicitSchurFactor.multiplyHessianAdd(
alpha,
x, yExpected);