testSimulated3D.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
18 #include <tests/simulated3D.h>
19 #include <gtsam/inference/Symbol.h>
20 #include <gtsam/geometry/Pose3.h>
21 #include <gtsam/base/Testable.h>
23 
25 
26 #include <iostream>
27 
28 using namespace std::placeholders;
29 using namespace gtsam;
30 
31 // Convenience for named keys
34 
35 /* ************************************************************************* */
36 TEST( simulated3D, Values )
37 {
38  Values actual;
39  actual.insert(L(1),Point3(1,1,1));
40  actual.insert(X(2),Point3(2,2,2));
41  EXPECT(assert_equal(actual,actual,1e-9));
42 }
43 
44 /* ************************************************************************* */
45 TEST( simulated3D, Dprior )
46 {
47  Point3 x(1,-9, 7);
48  Matrix numerical = numericalDerivative11<Point3, Point3>(std::bind(simulated3D::prior, std::placeholders::_1, nullptr),x);
49  Matrix computed;
50  simulated3D::prior(x,computed);
51  EXPECT(assert_equal(numerical,computed,1e-9));
52 }
53 
54 /* ************************************************************************* */
55 TEST( simulated3D, DOdo )
56 {
57  Point3 x1(1, -9, 7), x2(-5, 6, 7);
58  Matrix H1, H2;
59  simulated3D::odo(x1, x2, H1, H2);
60  Matrix A1 = numericalDerivative21<Point3, Point3, Point3>(
61  std::bind(simulated3D::odo, std::placeholders::_1, std::placeholders::_2,
62  nullptr, nullptr),
63  x1, x2);
64  EXPECT(assert_equal(A1, H1, 1e-9));
65  Matrix A2 = numericalDerivative22<Point3, Point3, Point3>(
66  std::bind(simulated3D::odo, std::placeholders::_1, std::placeholders::_2,
67  nullptr, nullptr),
68  x1, x2);
69  EXPECT(assert_equal(A2, H2, 1e-9));
70 }
71 
72 
73 /* ************************************************************************* */
74 int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
75 /* ************************************************************************* */
static Matrix A1
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
Point2 prior(const Point2 &x)
Prior on a single pose.
Definition: simulated2D.h:88
Point2 odo(const Point2 &x1, const Point2 &x2)
odometry between two poses
Definition: simulated2D.h:99
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
MatrixXd L
Definition: LLT_example.cpp:6
Some functions to compute numerical derivatives.
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
int main()
#define EXPECT(condition)
Definition: Test.h:150
Array< double, 1, 3 > e(1./3., 0.5, 2.)
TEST(simulated3D, Values)
traits
Definition: chartTesting.h:28
Pose3 x1
Definition: testPose3.cpp:663
void insert(Key j, const Value &val)
Definition: Values.cpp:155
Vector3 Point3
Definition: Point3.h:38
#define X
Definition: icosphere.cpp:20
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
3D Pose


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:39:31