testRot3Optimization.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/base/Testable.h>
21 #include <gtsam/base/lieProxies.h>
22 #include <gtsam/geometry/Point3.h>
23 #include <gtsam/geometry/Rot3.h>
26 #include <gtsam/inference/Symbol.h>
28 
29 using namespace gtsam;
30 
33 
35 
36 /* ************************************************************************* */
38 
39  // Optimize a circle
40  Values truth;
42  Graph fg;
43  fg.addPrior(R(0), Rot3(), noiseModel::Isotropic::Sigma(3, 0.01));
44  for(int j=0; j<6; ++j) {
45  truth.insert(R(j), Rot3::Rz(M_PI/3.0 * double(j)));
46  initial.insert(R(j), Rot3::Rz(M_PI/3.0 * double(j) + 0.1 * double(j%2)));
47  fg.emplace_shared<Between>(R(j), R((j+1)%6), Rot3::Rz(M_PI/3.0), noiseModel::Isotropic::Sigma(3, 0.01));
48  }
49 
51 
52  EXPECT(assert_equal(truth, final, 1e-5));
53 }
54 
55 /* ************************************************************************* */
56 int main() {
57  TestResult tr;
58  return TestRegistry::runAllTests(tr);
59 }
60 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
gtsam::NonlinearOptimizer::optimize
virtual const Values & optimize()
Definition: NonlinearOptimizer.h:98
gtsam::GaussNewtonOptimizer
Definition: GaussNewtonOptimizer.h:38
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Testable.h
Concept check for values that can be used in unit tests.
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
gtsam::optimize
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Definition: triangulation.cpp:177
initial
Values initial
Definition: OdometryOptimize.cpp:2
main
int main()
Definition: testRot3Optimization.cpp:56
Point3.h
3D Point
Rot3.h
3D rotation represented as a rotation matrix or quaternion
GaussNewtonOptimizer.h
Graph
NonlinearFactorGraph Graph
Definition: testRot3Optimization.cpp:32
numericalDerivative.h
Some functions to compute numerical derivatives.
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
BetweenFactor.h
gtsam::Rot3
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::NonlinearFactorGraph::addPrior
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
Definition: NonlinearFactorGraph.h:199
gtsam::symbol_shorthand::R
Key R(std::uint64_t j)
Definition: inference/Symbol.h:165
Symbol.h
TestResult
Definition: TestResult.h:26
Between
BetweenFactor< Rot3 > Between
Definition: testRot3Optimization.cpp:31
gtsam
traits
Definition: SFMdata.h:40
gtsam::TEST
TEST(SmartFactorBase, Pinhole)
Definition: testSmartFactorBase.cpp:38
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam::Values
Definition: Values.h:65
gtsam::Values::insert
void insert(Key j, const Value &val)
Definition: Values.cpp:155
gtsam::Rot3::Rz
static Rot3 Rz(double t)
Rotation around Z axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when look...
Definition: Rot3M.cpp:74
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
initial
Definition: testScenarioRunner.cpp:148
gtsam::noiseModel::Isotropic::Sigma
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:624
Graph
Definition: testGeneralSFMFactor.cpp:49
M_PI
#define M_PI
Definition: mconf.h:117
lieProxies.h
Provides convenient mappings of common member functions for testing.
R
Rot2 R(Rot2::fromAngle(0.1))
gtsam::FactorGraph::emplace_shared
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Definition: FactorGraph.h:153
gtsam::BetweenFactor
Definition: BetweenFactor.h:40


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:08:24