30 using namespace gtsam;
69 #ifdef GTSAM_SLOW_BUT_CORRECT_EXPMAP
101 0.0, 0.0, 0.0).finished();
184 Vector xiprime2 =
T.Adjoint(xi2);
198 Matrix3 expected2 =
T.matrix() * hat(xi2) *
T.matrix().inverse();
199 Matrix3 xiprime2 = hat(
T.Adjoint(xi2));
207 #ifdef GTSAM_SLOW_BUT_CORRECT_EXPMAP
279 (
Matrix(2, 3) << -1.0, 0.0, 2.0, 0.0, -1.0, -2.0).finished();
280 Matrix expectedH2 = (
Matrix(2, 2) << 0.0, 1.0, -1.0, 0.0).finished();
283 Matrix actualH1, actualH2;
310 Matrix H1_expected = (
Matrix(2, 3) << 0., -1., -2., 1., 0., -1.).finished();
311 Matrix H2_expected = (
Matrix(2, 2) << 0., -1., 1., 0.).finished();
340 Matrix expectedH2 = I_3x3;
349 Point2 expected_point(-1.0, -1.0);
365 Matrix actualDcompose1, actualDcompose2;
386 Matrix actualDcompose1, actualDcompose2;
422 return (
Vector(3) <<
p.x(),
p.y(), 1.0).finished();
430 gRl(0, 0), gRl(0, 1), gt.x(),
431 gRl(1, 0), gRl(1, 1), gt.y(),
432 0.0, 0.0, 1.0).finished();
445 0.0, 0.0, 1.0).finished(),
449 Point2 x_axis(1,0), y_axis(0,1);
452 1.0, 0.0).finished(),
464 0.0, 0.0, 1.0).finished(),
487 Matrix numericalH = numericalDerivative11<Point2, Pose2>(
f,
pose);
498 std::function<
Rot2(
const Pose2&)>
f = [](
const Pose2&
T) {
return T.rotation(); };
499 Matrix numericalH = numericalDerivative11<Rot2, Pose2>(
f,
pose);
552 p1.between(
p2,actualH1,actualH2);
567 p1.between(
p2,actualH1,actualH2);
597 Matrix expectedH1, actualH1, expectedH2, actualH2;
635 Pose2 xl1(1, 0,
M_PI/2.0),
xl2(1, 1,
M_PI),
xl3(2.0, 2.0,-
M_PI/2.0),
xl4(1, 3, 0);
637 Matrix expectedH1, actualH1, expectedH2, actualH2;
674 Matrix expectedH1, actualH1, expectedH2, actualH2;
683 double actual23 =
x2.
range(
l3, actualH1, actualH2);
693 double actual34 =
x3.
range(
l4, actualH1, actualH2);
711 Pose2 xl1(1, 0,
M_PI/2.0),
xl2(1, 1,
M_PI),
xl3(2.0, 2.0,-
M_PI/2.0),
xl4(1, 3, 0);
713 Matrix expectedH1, actualH1, expectedH2, actualH2;
722 double actual23 =
x2.
range(
xl3, actualH1, actualH2);
732 double actual34 =
x3.
range(
xl4, actualH1, actualH2);
790 struct Triangle {
size_t i_, j_, k_;};
793 const pair<Triangle, Triangle>& trianglePair) {
794 const Triangle& t1 = trianglePair.first, t2 = trianglePair.second;
796 {as[t1.j_], bs[t2.j_]},
797 {as[t1.k_], bs[t2.k_]}};
807 Triangle t1; t1.i_=0; t1.j_=1; t1.k_=2;
808 Triangle t2; t2.i_=1; t2.j_=2; t2.k_=0;
810 std::optional<Pose2> actual = align2(as, bs, {t1, t2});
823 EXPECT(check_group_invariants(
id,
id));
824 EXPECT(check_group_invariants(
id,
T1));
825 EXPECT(check_group_invariants(
T2,
id));
828 EXPECT(check_manifold_invariants(
id,
id));
829 EXPECT(check_manifold_invariants(
id,
T1));
830 EXPECT(check_manifold_invariants(
T2,
id));
860 auto cov = FullCovarianceFromSigmas<Pose2>({0.1, 0.3, 0.7});
864 Vector3{cov(1, 1), cov(0, 0), cov(2, 2)},
865 Vector3{transformed.diagonal()}));
867 Vector3{-cov(1, 0), -cov(2, 1), cov(2, 0)},
868 Vector3{transformed(1, 0), transformed(2, 0), transformed(2, 1)}));
873 auto cov = SingleVariableCovarianceFromSigma<Pose2>(0, 0.1);
881 auto cov = SingleVariableCovarianceFromSigma<Pose2>(1, 0.1);
889 auto cov = SingleVariableCovarianceFromSigma<Pose2>(2, 0.1);
892 Vector3{0., 0.1 * 0.1 * 20. * 20., 0.1 * 0.1},
893 Vector3{transformed.diagonal()}));
895 Vector3{0., 0., -0.1 * 0.1 * 20.},
896 Vector3{transformed(1, 0), transformed(2, 0), transformed(2, 1)}));
901 auto cov = SingleVariableCovarianceFromSigma<Pose2>(0, 0.1);
905 Vector3{cov(1, 1), cov(0, 0), cov(2, 2)},
906 Vector3{transformed.diagonal()}));
909 Vector3{transformed(1, 0), transformed(2, 0), transformed(2, 1)}));
914 auto cov = SingleVariableCovarianceFromSigma<Pose2>(2, 0.1);
917 Vector3{0., 0.1 * 0.1 * 20. * 20., 0.1 * 0.1},
918 Vector3{transformed.diagonal()}));
920 Vector3{0., 0., -0.1 * 0.1 * 20.},
921 Vector3{transformed(1, 0), transformed(2, 0), transformed(2, 1)}));
930 string s =
"Planar Pose";
931 string expected_stdout =
"(1, 2, 0)";
932 string expected1 = expected_stdout +
"\n";
933 string expected2 =
s +
" " + expected1;