gtsam
geometry
tests
testBearingRange.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
19
#include <
gtsam/geometry/BearingRange.h
>
20
#include <
gtsam/geometry/Pose2.h
>
21
#include <
gtsam/geometry/Pose3.h
>
22
#include <
gtsam/base/serializationTestHelpers.h
>
23
24
#include <
CppUnitLite/TestHarness.h
>
25
26
using namespace
std
;
27
using namespace
gtsam
;
28
29
typedef
BearingRange<Pose2, Point2>
BearingRange2D
;
30
BearingRange2D
br2D
(1, 2);
31
32
typedef
BearingRange<Pose3, Point3>
BearingRange3D
;
33
BearingRange3D
br3D
(
Pose3
().bearing(
Point3
(1, 0, 0)), 1);
34
35
//******************************************************************************
36
TEST
(
BearingRange2D
, Concept) {
37
GTSAM_CONCEPT_ASSERT
(IsManifold<BearingRange2D>);
38
}
39
40
/* ************************************************************************* */
41
TEST
(
BearingRange
, 2
D
) {
42
BearingRange2D
expected
(0, 1);
43
BearingRange2D
actual =
BearingRange2D::Measure
(
Pose2
(),
Point2
(1, 0));
44
EXPECT
(
assert_equal
(
expected
, actual));
45
}
46
47
//******************************************************************************
48
TEST
(
BearingRange3D
, Concept) {
49
GTSAM_CONCEPT_ASSERT
(IsManifold<BearingRange3D>);
50
}
51
52
/* ************************************************************************* */
53
TEST
(
BearingRange
, 3
D
) {
54
BearingRange3D
expected
(
Unit3
(), 1);
55
BearingRange3D
actual =
BearingRange3D::Measure
(
Pose3
(),
Point3
(1, 0, 0));
56
EXPECT
(
assert_equal
(
expected
, actual));
57
}
58
59
#ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
60
using namespace
serializationTestHelpers;
61
/* ************************************************************************* */
62
TEST
(
BearingRange
, Serialization2D) {
63
EXPECT
(equalsObj<BearingRange2D>(
br2D
));
64
EXPECT
(equalsXML<BearingRange2D>(
br2D
));
65
EXPECT
(equalsBinary<BearingRange2D>(
br2D
));
66
}
67
68
/* ************************************************************************* */
69
TEST
(
BearingRange
, Serialization3D) {
70
EXPECT
(equalsObj<BearingRange3D>(
br3D
));
71
EXPECT
(equalsXML<BearingRange3D>(
br3D
));
72
EXPECT
(equalsBinary<BearingRange3D>(
br3D
));
73
}
74
#endif
75
76
/* ************************************************************************* */
77
int
main
() {
78
TestResult
tr;
79
return
TestRegistry::runAllTests
(tr);
80
}
81
/* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition:
TestRegistry.cpp:27
Pose2.h
2D Pose
D
MatrixXcd D
Definition:
EigenSolver_EigenSolver_MatrixType.cpp:14
EXPECT
#define EXPECT(condition)
Definition:
Test.h:150
BearingRange2D
BearingRange< Pose2, Point2 > BearingRange2D
Definition:
testBearingRange.cpp:29
TestHarness.h
gtsam::BearingRange::Measure
static BearingRange Measure(const A1 &a1, const A2 &a2, OptionalJacobian< dimension, traits< A1 >::dimension > H1={}, OptionalJacobian< dimension, traits< A2 >::dimension > H2={})
Prediction function that stacks measurements.
Definition:
BearingRange.h:79
br3D
BearingRange3D br3D(Pose3().bearing(Point3(1, 0, 0)), 1)
gtsam::Pose3
Definition:
Pose3.h:37
cholesky::expected
Matrix expected
Definition:
testMatrix.cpp:971
gtsam::Point2
Vector2 Point2
Definition:
Point2.h:32
serializationTestHelpers.h
TestResult
Definition:
TestResult.h:26
BearingRange3D
BearingRange< Pose3, Point3 > BearingRange3D
Definition:
testBearingRange.cpp:32
gtsam
traits
Definition:
SFMdata.h:40
std
Definition:
BFloat16.h:88
gtsam::BearingRange
Definition:
BearingRange.h:52
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition:
Matrix.cpp:40
gtsam::Point3
Vector3 Point3
Definition:
Point3.h:38
main
int main()
Definition:
testBearingRange.cpp:77
gtsam::Unit3
Represents a 3D point on a unit sphere.
Definition:
Unit3.h:42
BearingRange.h
Bearing-Range product.
br2D
BearingRange2D br2D(1, 2)
GTSAM_CONCEPT_ASSERT
#define GTSAM_CONCEPT_ASSERT(concept)
Definition:
base/concepts.h:22
TEST
TEST(BearingRange2D, Concept)
Definition:
testBearingRange.cpp:36
Pose3.h
3D Pose
gtsam::Pose2
Definition:
Pose2.h:39
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:15