testNavExpressions.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/Rot3.h>
23 #include <gtsam/nonlinear/Values.h>
24 #include <gtsam/slam/expressions.h>
25 
27 
28 using namespace gtsam;
29 
30 // A NavState unknown expression wXb with key 42
32 
33 /* ************************************************************************* */
34 // Example: absolute position measurement
35 TEST(Expressions, Position) {
36  auto absolutePosition_ = position(wXb_);
37 
38  // Test with some values
39  Values values;
40  values.insert(42, NavState(Rot3(), Point3(1, 2, 3), Velocity3(4, 5, 6)));
41  EXPECT(assert_equal(Point3(1, 2, 3), absolutePosition_.value(values)));
42 }
43 
44 /* ************************************************************************* */
45 // Example: velocity measurement in body frame
46 TEST(Expressions, Velocity) {
47  // We want to predict h(wXb) = velocity in body frame
48  // h(wXb) = bRw(wXb) * wV(wXb)
49  auto bodyVelocity_ = unrotate(attitude(wXb_), velocity(wXb_));
50 
51  // Test with some values
52  Values values;
53  values.insert(42, NavState(Rot3(), Point3(1, 2, 3), Velocity3(4, 5, 6)));
54  EXPECT(assert_equal(Velocity3(4, 5, 6), bodyVelocity_.value(values)));
55 }
56 
57 /* ************************************************************************* */
58 int main() {
59  TestResult tr;
60  return TestRegistry::runAllTests(tr);
61 }
62 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
wXb_
Expression< NavState > wXb_(42)
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
gtsam::Velocity3
Vector3 Velocity3
Velocity is currently typedef'd to Vector3.
Definition: NavState.h:28
gtsam::position
Point3_ position(const NavState_ &X)
Definition: navigation/expressions.h:37
gtsam::NavState
Definition: NavState.h:34
different_sigmas::values
HybridValues values
Definition: testHybridBayesNet.cpp:245
Rot3.h
3D rotation represented as a rotation matrix or quaternion
gtsam::attitude
Rot3_ attitude(const NavState_ &X)
Definition: navigation/expressions.h:34
gtsam::Expression
Definition: Expression.h:47
gtsam::unrotate
Point3_ unrotate(const Rot3_ &x, const Point3_ &p)
Definition: slam/expressions.h:109
gtsam::Rot3
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
NavState.h
Navigation state composing of attitude, position, and velocity.
expressions.h
Common expressions for solving navigation problems.
gtsam::HybridValues::insert
void insert(Key j, const Vector &value)
Definition: HybridValues.cpp:85
TestResult
Definition: TestResult.h:26
gtsam
traits
Definition: SFMdata.h:40
gtsam::TEST
TEST(SmartFactorBase, Pinhole)
Definition: testSmartFactorBase.cpp:38
main
int main()
Definition: testNavExpressions.cpp:58
NoiseModel.h
gtsam::Values
Definition: Values.h:65
expressions.h
Common expressions for solving geometry/slam/sfm problems.
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
Values.h
A non-templated config holding any types of Manifold-group elements.
gtsam::velocity
Velocity3_ velocity(const NavState_ &X)
Definition: navigation/expressions.h:40


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:57