smallExample.h
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 // \callgraph
20 
21 
22 #pragma once
23 
24 #include <tests/simulated2D.h>
25 #include <gtsam/inference/Symbol.h>
29 
30 namespace gtsam {
31 namespace example {
32 
36 // inline std::shared_ptr<const NonlinearFactorGraph> sharedNonlinearFactorGraph();
37 // inline NonlinearFactorGraph createNonlinearFactorGraph();
38 
43 // inline Values createValues();
44 
46 // inline VectorValues createVectorValues();
47 
51 // inline std::shared_ptr<const Values> sharedNoisyValues();
52 // inline Values createNoisyValues();
53 
57 // inline VectorValues createZeroDelta();
58 
62 // inline VectorValues createCorrectDelta();
63 
68 // inline GaussianFactorGraph createGaussianFactorGraph();
69 
73 // inline GaussianBayesNet createSmallGaussianBayesNet();
74 
78 // inline std::shared_ptr<const NonlinearFactorGraph>
79 //sharedReallyNonlinearFactorGraph();
80 // inline NonlinearFactorGraph createReallyNonlinearFactorGraph();
81 
86 // inline std::pair<NonlinearFactorGraph, Values> createNonlinearSmoother(int T);
87 
92 // inline GaussianFactorGraph createSmoother(int T);
93 
94 /* ******************************************************* */
95 // Linear Constrained Examples
96 /* ******************************************************* */
97 
102 // inline GaussianFactorGraph createSimpleConstraintGraph();
103 // inline VectorValues createSimpleConstraintValues();
104 
109 // inline GaussianFactorGraph createSingleConstraintGraph();
110 // inline VectorValues createSingleConstraintValues();
111 
116 // inline GaussianFactorGraph createMultiConstraintGraph();
117 // inline VectorValues createMultiConstraintValues();
118 
119 /* ******************************************************* */
120 // Planar graph with easy subtree for SubgraphPreconditioner
121 /* ******************************************************* */
122 
123 /*
124  * Create factor graph with N^2 nodes, for example for N=3
125  * x13-x23-x33
126  * | | |
127  * x12-x22-x32
128  * | | |
129  * -x11-x21-x31
130  * with x11 clamped at (1,1), and others related by 2D odometry.
131  */
132 // inline std::pair<GaussianFactorGraph, VectorValues> planarGraph(size_t N);
133 
134 /*
135  * Create canonical ordering for planar graph that also works for tree
136  * With x11 the root, e.g. for N=3
137  * x33 x23 x13 x32 x22 x12 x31 x21 x11
138  */
139 // inline Ordering planarOrdering(size_t N);
140 
141 /*
142  * Split graph into tree and loop closing constraints, e.g., with N=3
143  * x13-x23-x33
144  * |
145  * x12-x22-x32
146  * |
147  * -x11-x21-x31
148  */
149 // inline std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(
150 // size_t N, const GaussianFactorGraph& original);
151 
152 
153 
154 // Implementations
155 
156 // using namespace gtsam::noiseModel;
157 
158 namespace impl {
159 typedef std::shared_ptr<NonlinearFactor> shared_nlf;
160 
165 
166 static const Key _l1_=0, _x1_=1, _x2_=2;
167 static const Key _x_=0, _y_=1, _z_=2;
168 } // \namespace impl
169 
170 
171 /* ************************************************************************* */
172 inline std::shared_ptr<const NonlinearFactorGraph>
174  const SharedNoiseModel &noiseModel2 = impl::kSigma0_2) {
175  using namespace impl;
176  using symbol_shorthand::L;
177  using symbol_shorthand::X;
178  // Create
179  std::shared_ptr<NonlinearFactorGraph> nlfg(new NonlinearFactorGraph);
180 
181  // prior on x1
182  Point2 mu(0, 0);
183  shared_nlf f1(new simulated2D::Prior(mu, noiseModel1, X(1)));
184  nlfg->push_back(f1);
185 
186  // odometry between x1 and x2
187  Point2 z2(1.5, 0);
188  shared_nlf f2(new simulated2D::Odometry(z2, noiseModel1, X(1), X(2)));
189  nlfg->push_back(f2);
190 
191  // measurement between x1 and l1
192  Point2 z3(0, -1);
193  shared_nlf f3(new simulated2D::Measurement(z3, noiseModel2, X(1), L(1)));
194  nlfg->push_back(f3);
195 
196  // measurement between x2 and l1
197  Point2 z4(-1.5, -1.);
198  shared_nlf f4(new simulated2D::Measurement(z4, noiseModel2, X(2), L(1)));
199  nlfg->push_back(f4);
200 
201  return nlfg;
202 }
203 
204 /* ************************************************************************* */
207  const SharedNoiseModel &noiseModel2 = impl::kSigma0_2) {
208  return *sharedNonlinearFactorGraph(noiseModel1, noiseModel2);
209 }
210 
211 /* ************************************************************************* */
213  using symbol_shorthand::X;
214  using symbol_shorthand::L;
215  Values c;
216  c.insert(X(1), Point2(0.0, 0.0));
217  c.insert(X(2), Point2(1.5, 0.0));
218  c.insert(L(1), Point2(0.0, -1.0));
219  return c;
220 }
221 
222 /* ************************************************************************* */
224  using namespace impl;
225  VectorValues c {{_l1_, Vector2(0.0, -1.0)},
226  {_x1_, Vector2(0.0, 0.0)},
227  {_x2_, Vector2(1.5, 0.0)}};
228  return c;
229 }
230 
231 /* ************************************************************************* */
232 inline std::shared_ptr<const Values> sharedNoisyValues() {
233  using symbol_shorthand::X;
234  using symbol_shorthand::L;
235  std::shared_ptr<Values> c(new Values);
236  c->insert(X(1), Point2(0.1, 0.1));
237  c->insert(X(2), Point2(1.4, 0.2));
238  c->insert(L(1), Point2(0.1, -1.1));
239  return c;
240 }
241 
242 /* ************************************************************************* */
244  return *sharedNoisyValues();
245 }
246 
247 /* ************************************************************************* */
249  using symbol_shorthand::X;
250  using symbol_shorthand::L;
251  VectorValues c;
252  c.insert(L(1), Vector2(-0.1, 0.1));
253  c.insert(X(1), Vector2(-0.1, -0.1));
254  c.insert(X(2), Vector2(0.1, -0.2));
255  return c;
256 }
257 
258 /* ************************************************************************* */
260  using symbol_shorthand::X;
261  using symbol_shorthand::L;
262  VectorValues c;
263  c.insert(L(1), Z_2x1);
264  c.insert(X(1), Z_2x1);
265  c.insert(X(2), Z_2x1);
266  return c;
267 }
268 
269 /* ************************************************************************* */
271  using symbol_shorthand::X;
272  using symbol_shorthand::L;
273  // Create empty graph
275 
276  // linearized prior on x1: c[_x1_]+x1=0 i.e. x1=-c[_x1_]
277  fg.emplace_shared<JacobianFactor>(X(1), 10*I_2x2, -1.0*Vector::Ones(2));
278 
279  // odometry between x1 and x2: x2-x1=[0.2;-0.1]
280  fg.emplace_shared<JacobianFactor>(X(1), -10*I_2x2, X(2), 10*I_2x2, Vector2(2.0, -1.0));
281 
282  // measurement between x1 and l1: l1-x1=[0.0;0.2]
283  fg.emplace_shared<JacobianFactor>(X(1), -5*I_2x2, L(1), 5*I_2x2, Vector2(0.0, 1.0));
284 
285  // measurement between x2 and l1: l1-x2=[-0.2;0.3]
286  fg.emplace_shared<JacobianFactor>(X(2), -5*I_2x2, L(1), 5*I_2x2, Vector2(-1.0, 1.5));
287 
288  return fg;
289 }
290 
291 /* ************************************************************************* */
298  using namespace impl;
299  Matrix R11 = (Matrix(1, 1) << 1.0).finished(), S12 = (Matrix(1, 1) << 1.0).finished();
300  Matrix R22 = (Matrix(1, 1) << 1.0).finished();
301  Vector d1(1), d2(1);
302  d1(0) = 9;
303  d2(0) = 5;
304 
305  // define nodes and specify in reverse topological sort (i.e. parents last)
308  GaussianBayesNet cbn;
309  cbn.push_back(Px_y);
310  cbn.push_back(Py);
311 
312  return cbn;
313 }
314 
315 /* ************************************************************************* */
316 // Some nonlinear functions to optimize
317 /* ************************************************************************* */
318 namespace smallOptimize {
319 
320 inline Point2 h(const Point2& v) {
321  return Point2(cos(v.x()), sin(v.y()));
322 }
323 
324 inline Matrix H(const Point2& v) {
325  return (Matrix(2, 2) <<
326  -sin(v.x()), 0.0,
327  0.0, cos(v.y())).finished();
328 }
329 
330 struct UnaryFactor: public gtsam::NoiseModelFactorN<Point2> {
331 
332  // Provide access to the Matrix& version of evaluateError:
333  using gtsam::NoiseModelFactor1<Point2>::evaluateError;
334 
336 
338  gtsam::NoiseModelFactorN<Point2>(model, key), z_(z) {
339  }
340 
341  Vector evaluateError(const Point2& x, OptionalMatrixType A) const override {
342  if (A) *A = H(x);
343  return (h(x) - z_);
344  }
345 
347  return std::static_pointer_cast<gtsam::NonlinearFactor>(
349 };
350 
351 }
352 
353 /* ************************************************************************* */
355  using symbol_shorthand::X;
356  using symbol_shorthand::L;
357  std::shared_ptr<NonlinearFactorGraph> fg(new NonlinearFactorGraph);
358  Point2 z(1.0, 0.0);
359  std::shared_ptr<smallOptimize::UnaryFactor> factor(
361  fg->push_back(factor);
362  return *fg;
363 }
364 
365 /* ************************************************************************* */
366 inline std::shared_ptr<const NonlinearFactorGraph> sharedReallyNonlinearFactorGraph() {
367  using symbol_shorthand::X;
368  using symbol_shorthand::L;
369  std::shared_ptr<NonlinearFactorGraph> fg(new NonlinearFactorGraph);
370  Point2 z(1.0, 0.0);
371  double sigma = 0.1;
372  std::shared_ptr<smallOptimize::UnaryFactor> factor(
374  fg->push_back(factor);
375  return fg;
376 }
377 
380 }
381 
382 /* ************************************************************************* */
384  using symbol_shorthand::X;
385  std::shared_ptr<NonlinearFactorGraph> fg(new NonlinearFactorGraph);
386  Point2 z(0.0, 0.0);
387  double sigma = 0.1;
388 
389  std::shared_ptr<PriorFactor<Point2>> factor(
390  new PriorFactor<Point2>(X(1), z, noiseModel::Isotropic::Sigma(2,sigma)));
391  // 3 noiseless inliers
392  fg->push_back(factor);
393  fg->push_back(factor);
394  fg->push_back(factor);
395 
396  // 1 outlier
397  Point2 z_out(1.0, 0.0);
398  std::shared_ptr<PriorFactor<Point2>> factor_out(
399  new PriorFactor<Point2>(X(1), z_out, noiseModel::Isotropic::Sigma(2,sigma)));
400  fg->push_back(factor_out);
401 
402  return *fg;
403 }
404 
405 /* ************************************************************************* */
407  using symbol_shorthand::X;
408  std::shared_ptr<NonlinearFactorGraph> fg(new NonlinearFactorGraph);
409  Point2 z(0.0, 0.0);
410  double sigma = 0.1;
411  auto gmNoise = noiseModel::Robust::Create(
413  std::shared_ptr<PriorFactor<Point2>> factor(
414  new PriorFactor<Point2>(X(1), z, gmNoise));
415  // 3 noiseless inliers
416  fg->push_back(factor);
417  fg->push_back(factor);
418  fg->push_back(factor);
419 
420  // 1 outlier
421  Point2 z_out(1.0, 0.0);
422  std::shared_ptr<PriorFactor<Point2>> factor_out(
423  new PriorFactor<Point2>(X(1), z_out, gmNoise));
424  fg->push_back(factor_out);
425 
426  return *fg;
427 }
428 
429 
430 /* ************************************************************************* */
431 inline std::pair<NonlinearFactorGraph, Values> createNonlinearSmoother(int T) {
432  using namespace impl;
433  using symbol_shorthand::X;
434  using symbol_shorthand::L;
435 
436  // Create
438  Values poses;
439 
440  // prior on x1
441  Point2 x1(1.0, 0.0);
443  nlfg.push_back(prior);
444  poses.insert(X(1), x1);
445 
446  for (int t = 2; t <= T; t++) {
447  // odometry between x_t and x_{t-1}
448  Point2 odo(1.0, 0.0);
450  nlfg.push_back(odometry);
451 
452  // measurement on x_t is like perfect GPS
453  Point2 xt(t, 0);
455  nlfg.push_back(measurement);
456 
457  // initial estimate
458  poses.insert(X(t), xt);
459  }
460 
461  return std::make_pair(nlfg, poses);
462 }
463 
464 /* ************************************************************************* */
466  const auto [nlfg, poses] = createNonlinearSmoother(T);
467  return *nlfg.linearize(poses);
468 }
469 
470 /* ************************************************************************* */
472  using namespace impl;
473  // create unary factor
474  // prior on _x_, mean = [1,-1], sigma=0.1
475  Matrix Ax = I_2x2;
476  Vector b1(2);
477  b1(0) = 1.0;
478  b1(1) = -1.0;
480 
481  // create binary constraint factor
482  // between _x_ and _y_, that is going to be the only factor on _y_
483  // |1 0||x_1| + |-1 0||y_1| = |0|
484  // |0 1||x_2| | 0 -1||y_2| |0|
485  Matrix Ax1 = I_2x2;
486  Matrix Ay1 = I_2x2 * -1;
487  Vector b2 = Vector2(0.0, 0.0);
490 
491  // construct the graph
493  fg.push_back(f1);
494  fg.push_back(f2);
495 
496  return fg;
497 }
498 
499 /* ************************************************************************* */
501  using namespace impl;
502  using symbol_shorthand::X;
503  using symbol_shorthand::L;
504  VectorValues config;
505  Vector v = Vector2(1.0, -1.0);
506  config.insert(_x_, v);
507  config.insert(_y_, v);
508  return config;
509 }
510 
511 /* ************************************************************************* */
513  using namespace impl;
514  // create unary factor
515  // prior on _x_, mean = [1,-1], sigma=0.1
516  Matrix Ax = I_2x2;
517  Vector b1(2);
518  b1(0) = 1.0;
519  b1(1) = -1.0;
520  //GaussianFactor::shared_ptr f1(new JacobianFactor(_x_, kSigma0_1->Whiten(Ax), kSigma0_1->whiten(b1), kSigma0_1));
522 
523  // create binary constraint factor
524  // between _x_ and _y_, that is going to be the only factor on _y_
525  // |1 2||x_1| + |10 0||y_1| = |1|
526  // |2 1||x_2| |0 10||y_2| |2|
527  Matrix Ax1(2, 2);
528  Ax1(0, 0) = 1.0;
529  Ax1(0, 1) = 2.0;
530  Ax1(1, 0) = 2.0;
531  Ax1(1, 1) = 1.0;
532  Matrix Ay1 = I_2x2 * 10;
533  Vector b2 = Vector2(1.0, 2.0);
536 
537  // construct the graph
539  fg.push_back(f1);
540  fg.push_back(f2);
541 
542  return fg;
543 }
544 
545 /* ************************************************************************* */
547  using namespace impl;
548  VectorValues config{{_x_, Vector2(1.0, -1.0)}, {_y_, Vector2(0.2, 0.1)}};
549  return config;
550 }
551 
552 /* ************************************************************************* */
554  using namespace impl;
555  // unary factor 1
556  Matrix A = I_2x2;
557  Vector b = Vector2(-2.0, 2.0);
559 
560  // constraint 1
561  Matrix A11(2, 2);
562  A11(0, 0) = 1.0;
563  A11(0, 1) = 2.0;
564  A11(1, 0) = 2.0;
565  A11(1, 1) = 1.0;
566 
567  Matrix A12(2, 2);
568  A12(0, 0) = 10.0;
569  A12(0, 1) = 0.0;
570  A12(1, 0) = 0.0;
571  A12(1, 1) = 10.0;
572 
573  Vector b1(2);
574  b1(0) = 1.0;
575  b1(1) = 2.0;
576  JacobianFactor::shared_ptr lc1(new JacobianFactor(_x_, A11, _y_, A12, b1,
578 
579  // constraint 2
580  Matrix A21(2, 2);
581  A21(0, 0) = 3.0;
582  A21(0, 1) = 4.0;
583  A21(1, 0) = -1.0;
584  A21(1, 1) = -2.0;
585 
586  Matrix A22(2, 2);
587  A22(0, 0) = 1.0;
588  A22(0, 1) = 1.0;
589  A22(1, 0) = 1.0;
590  A22(1, 1) = 2.0;
591 
592  Vector b2(2);
593  b2(0) = 3.0;
594  b2(1) = 4.0;
595  JacobianFactor::shared_ptr lc2(new JacobianFactor(_x_, A21, _z_, A22, b2,
597 
598  // construct the graph
600  fg.push_back(lf1);
601  fg.push_back(lc1);
602  fg.push_back(lc2);
603 
604  return fg;
605 }
606 
607 /* ************************************************************************* */
609  using namespace impl;
610  VectorValues config{{_x_, Vector2(-2.0, 2.0)},
611  {_y_, Vector2(-0.1, 0.4)},
612  {_z_, Vector2(-4.0, 5.0)}};
613  return config;
614 }
615 
616 /* ************************************************************************* */
617 // Create key for simulated planar graph
618 namespace impl {
619 inline Symbol key(size_t x, size_t y) {
620  using symbol_shorthand::X;
621  return X(1000*x+y);
622 }
623 } // \namespace impl
624 
625 /* ************************************************************************* */
626 inline std::pair<GaussianFactorGraph, VectorValues> planarGraph(size_t N) {
627  using namespace impl;
628 
629  // create empty graph
631 
632  // Create almost hard constraint on x11, sigma=0 will work for PCG not for normal
633  shared_nlf constraint(new simulated2D::Prior(Point2(1.0, 1.0), noiseModel::Isotropic::Sigma(2,1e-3), key(1,1)));
634  nlfg.push_back(constraint);
635 
636  // Create horizontal constraints, 1...N*(N-1)
637  Point2 z1(1.0, 0.0); // move right
638  for (size_t x = 1; x < N; x++)
639  for (size_t y = 1; y <= N; y++) {
641  nlfg.push_back(f);
642  }
643 
644  // Create vertical constraints, N*(N-1)+1..2*N*(N-1)
645  Point2 z2(0.0, 1.0); // move up
646  for (size_t x = 1; x <= N; x++)
647  for (size_t y = 1; y < N; y++) {
649  nlfg.push_back(f);
650  }
651 
652  // Create linearization and ground xtrue config
653  Values zeros;
654  for (size_t x = 1; x <= N; x++)
655  for (size_t y = 1; y <= N; y++)
656  zeros.insert(key(x, y), Point2(0,0));
657  VectorValues xtrue;
658  for (size_t x = 1; x <= N; x++)
659  for (size_t y = 1; y <= N; y++)
660  xtrue.insert(key(x, y), Point2((double)x, (double)y));
661 
662  // linearize around zero
663  std::shared_ptr<GaussianFactorGraph> gfg = nlfg.linearize(zeros);
664  return std::make_pair(*gfg, xtrue);
665 }
666 
667 /* ************************************************************************* */
668 inline Ordering planarOrdering(size_t N) {
670  for (size_t y = N; y >= 1; y--)
671  for (size_t x = N; x >= 1; x--)
672  ordering.push_back(impl::key(x, y));
673  return ordering;
674 }
675 
676 /* ************************************************************************* */
677 inline std::pair<GaussianFactorGraph, GaussianFactorGraph> splitOffPlanarTree(
678  size_t N, const GaussianFactorGraph& original) {
680 
681  // Add the x11 constraint to the tree
682  T.push_back(original[0]);
683 
684  // Add all horizontal constraints to the tree
685  size_t i = 1;
686  for (size_t x = 1; x < N; x++)
687  for (size_t y = 1; y <= N; y++, i++) T.push_back(original[i]);
688 
689  // Add first vertical column of constraints to T, others to C
690  for (size_t x = 1; x <= N; x++)
691  for (size_t y = 1; y < N; y++, i++)
692  if (x == 1)
693  T.push_back(original[i]);
694  else
695  C.push_back(original[i]);
696 
697  return std::make_pair(T, C);
698 }
699 
700 /* ************************************************************************* */
701 
702 } // \namespace example
703 } // \namespace gtsam
static const Key _x_
Definition: smallExample.h:167
GaussianFactorGraph createMultiConstraintGraph()
Definition: smallExample.h:553
VectorValues createVectorValues()
Definition: smallExample.h:223
static shared_ptr Create(double k, const ReweightScheme reweight=Block)
std::shared_ptr< const Values > sharedNoisyValues()
Definition: smallExample.h:232
std::shared_ptr< This > shared_ptr
shared_ptr to this class
VectorValues createMultiConstraintValues()
Definition: smallExample.h:608
Values createNoisyValues()
Definition: smallExample.h:243
Jet< T, N > cos(const Jet< T, N > &f)
Definition: jet.h:426
static SharedDiagonal kSigma1_0
Definition: smallExample.h:161
Scalar * y
GaussianFactorGraph createSmoother(int T)
Definition: smallExample.h:465
static const Unit3 z2
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Definition: FactorGraph.h:196
This is the base class for all measurement types.
Definition: Measurement.h:11
static const Key _x2_
Definition: smallExample.h:166
Factor Graph consisting of non-linear factors.
std::shared_ptr< NonlinearFactor > shared_nlf
Definition: smallExample.h:159
GaussianFactorGraph createGaussianFactorGraph()
Definition: smallExample.h:270
Point2 prior(const Point2 &x)
Prior on a single pose.
Definition: simulated2D.h:88
noiseModel::Diagonal::shared_ptr model
static const Key _z_
Definition: smallExample.h:167
Point2 odo(const Point2 &x1, const Point2 &x2)
odometry between two poses
Definition: simulated2D.h:99
Vector2 Point2
Definition: Point2.h:32
double mu
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition: FactorGraph.h:190
NonlinearFactorGraph sharedRobustFactorGraphWithOutliers()
Definition: smallExample.h:406
std::shared_ptr< const NonlinearFactorGraph > sharedNonlinearFactorGraph(const SharedNoiseModel &noiseModel1=impl::kSigma0_1, const SharedNoiseModel &noiseModel2=impl::kSigma0_2)
Definition: smallExample.h:173
NonlinearFactorGraph createReallyNonlinearFactorGraph()
Definition: smallExample.h:378
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Vector2 b2(4, -5)
NonlinearFactorGraph nonlinearFactorGraphWithGivenSigma(const double sigma)
Definition: smallExample.h:354
VectorValues createSingleConstraintValues()
Definition: smallExample.h:546
Jet< T, N > sin(const Jet< T, N > &f)
Definition: jet.h:439
MatrixXd L
Definition: LLT_example.cpp:6
iterator insert(const std::pair< Key, Vector > &key_value)
Key X(std::uint64_t j)
double f2(const Vector2 &x)
#define N
Definition: gksort.c:12
static shared_ptr Create(const RobustModel::shared_ptr &robust, const NoiseModel::shared_ptr noise)
Definition: NoiseModel.cpp:704
Symbol key(size_t x, size_t y)
Definition: smallExample.h:619
static enum @1107 ordering
std::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.
static SharedDiagonal kConstrainedModel
Definition: smallExample.h:164
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition: smallExample.h:346
static Point2 measurement(323.0, 240.0)
VectorValues createCorrectDelta()
Definition: smallExample.h:248
Matrix * OptionalMatrixType
static const Unit3 z3
Eigen::VectorXd Vector
Definition: Vector.h:38
static SharedDiagonal kSigma0_1
Definition: smallExample.h:162
GaussianBayesNet createSmallGaussianBayesNet()
Definition: smallExample.h:297
std::pair< NonlinearFactorGraph, Values > createNonlinearSmoother(int T)
Definition: smallExample.h:431
std::shared_ptr< const NonlinearFactorGraph > sharedReallyNonlinearFactorGraph()
Definition: smallExample.h:366
Matrix H(const Point2 &v)
Definition: smallExample.h:324
Array< int, Dynamic, 1 > v
Eigen::Triplet< double > T
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
VectorValues createZeroDelta()
Definition: smallExample.h:259
NonlinearFactorGraph createNonlinearFactorGraph(const SharedNoiseModel &noiseModel1=impl::kSigma0_1, const SharedNoiseModel &noiseModel2=impl::kSigma0_2)
Definition: smallExample.h:206
Linear Factor Graph where all factors are Gaussians.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
const G & b
Definition: Group.h:86
GaussianFactorGraph createSimpleConstraintGraph()
Definition: smallExample.h:471
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
Vector evaluateError(const Point2 &x, OptionalMatrixType A) const override
Definition: smallExample.h:341
Ordering planarOrdering(size_t N)
Definition: smallExample.h:668
noiseModel::Diagonal::shared_ptr SharedDiagonal
Definition: NoiseModel.h:743
traits
Definition: chartTesting.h:28
std::pair< GaussianFactorGraph, VectorValues > planarGraph(size_t N)
Definition: smallExample.h:626
UnaryFactor(const Point2 &z, const SharedNoiseModel &model, Key key)
Definition: smallExample.h:337
const double h
measurement functions and derivatives for simulated 2D robot
Eigen::Vector2d Vector2
Definition: Vector.h:42
VectorValues createSimpleConstraintValues()
Definition: smallExample.h:500
Point2 f1(const Point3 &p, OptionalJacobian< 2, 3 > H)
double f4(double x, double y, double z)
Pose3 x1
Definition: testPose3.cpp:663
static SharedDiagonal kSigma0_2
Definition: smallExample.h:163
std::shared_ptr< This > shared_ptr
Key L(std::uint64_t j)
double f3(double x1, double x2)
Chordal Bayes Net, the result of eliminating a factor graph.
static const double sigma
void insert(Key j, const Value &val)
Definition: Values.cpp:155
static const Key _x1_
Definition: smallExample.h:166
Pose2 odometry(2.0, 0.0, 0.0)
Values createValues()
Definition: smallExample.h:212
NonlinearFactorGraph sharedNonRobustFactorGraphWithOutliers()
Definition: smallExample.h:383
static const Key _l1_
Definition: smallExample.h:166
GaussianFactorGraph createSingleConstraintGraph()
Definition: smallExample.h:512
#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
static const Key _y_
Definition: smallExample.h:167
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
Definition: Vector.h:45
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
std::pair< GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(size_t N, const GaussianFactorGraph &original)
Definition: smallExample.h:677
std::shared_ptr< NonlinearFactor > shared_nlf
Point2 t(10, 10)
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:741
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:594
static shared_ptr All(size_t dim)
Definition: NoiseModel.h:466
Vector2 b1(2, -1)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:50