29 #include <boost/tuple/tuple.hpp> 30 #include <boost/assign/std/list.hpp> 31 #include <boost/assign/std/set.hpp> 32 #include <boost/assign/std/vector.hpp> 34 #include <boost/range/adaptor/map.hpp> 41 using namespace gtsam;
49 static auto kUnit2 = noiseModel::Unit::Create(2);
67 double actual = fg.
error(cfg);
77 conditional =
result.first->front();
80 Matrix I = 15 * I_2x2, R11 =
I, S12 = -0.111111 *
I, S13 = -0.444444 *
I;
90 ordering +=
X(2),
L(1),
X(1);
95 double sigma = 0.0894427;
106 ordering +=
L(1),
X(1),
X(2);
127 Matrix I = 15 * I_2x2, R11 =
I, S12 = -0.111111 *
I, S13 = -0.444444 *
I;
133 L(1), (
Matrix(4, 2) << 6.87184, 0, 0, 6.87184, 0, 0, 0, 0).finished(),
135 (
Matrix(4, 2) << -5.25494, 0, 0, -5.25494, -7.27607, 0, 0, -7.27607)
137 (
Vector(4) << -1.21268, 1.73817, -0.727607, 1.45521).finished(),
138 noiseModel::Unit::Create(4));
150 double sigma = 0.0894427;
239 size_t size1 = fg1.
size();
240 size_t size2 = fg2.
size();
251 for (
size_t k = 0; k < v.size(); k++) cout << v[k] <<
" ";
275 expected +=
Vector2(-1.0, -1.0);
276 expected +=
Vector2(2.0, -1.0);
278 expected +=
Vector2(-1.0, 1.5);
287 Matrix Ap = I_1x1, An = I_1x1 * -1;
296 ordering +=
X(1),
X(2);
302 boost::tie(R, d) = bayesNet.
matrix();
304 (
Matrix(2, 2) << 0.707107, -0.353553, 0.0, 0.612372).finished();
306 (
Matrix(2, 2) << 0.707107, -0.353553, 0.0, -0.612372).finished();
367 X(1), I_3x3,
X(2), I_3x3,
Z_3x1, noise));
369 X(2), I_3x3,
X(3), I_3x3,
Z_3x1, noise));
371 X(3), I_3x3,
X(4), I_3x3,
Z_3x1, noise));
373 X(5), I_3x3,
X(6), I_3x3,
Z_3x1, noise));
427 double relElevation = 6;
432 -1., 0.0, 1.2246468
e-16,
434 -1.2246468
e-16, 0.0, -1.),
435 Point3(0.511832102, 8.42819594, 5.76841725)));
436 initValues.
insert(l32,
Point3(0.364081507, 6.89766221, -0.231582751) );
437 initValues.
insert(l41,
Point3(1.61051523, 6.7373052, -0.231582751) );
442 -1., 0.0, 1.2246468
e-16,
444 -1.2246468
e-16, 0.0, -1),
445 Point3(0.511832102, 8.42819594, 5.76841725)), priorModel);
446 factors += ProjectionFactor(
Point2(333.648615, 98.61535), measModel, xC1, l32, K);
447 factors += ProjectionFactor(
Point2(218.508, 83.8022039), measModel, xC1, l41, K);
457 for(
const GaussianBayesTree::sharedClique& clique: actBT.
nodes() | br::map_values) {
461 EXPECT(!conditional->get_model());
GaussianFactorGraph createMultiConstraintGraph()
VectorValues createMultiConstraintValues()
void replace(size_t index, sharedFactor factor)
std::pair< Matrix, Vector > matrix(const Ordering &ordering) const
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
VectorValues optimize(const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
Concept check for values that can be used in unit tests.
GaussianFactorGraph createSmoother(int T)
static int runAllTests(TestResult &result)
GaussianFactorGraph createGaussianFactorGraph()
void insert(Key j, const Value &val)
static enum @843 ordering
#define DOUBLES_EQUAL(expected, actual, threshold)
static const double sigma
const Nodes & nodes() const
Rot2 R(Rot2::fromAngle(0.1))
VectorValues createSingleConstraintValues()
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
GaussianFactorGraph factors(list_of(factor1)(factor2)(factor3))
Some functions to compute numerical derivatives.
double f2(const Vector2 &x)
IsDerived< DERIVEDFACTOR > push_back(boost::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
double error(const VectorValues &x) const
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
std::pair< boost::shared_ptr< GaussianConditional >, boost::shared_ptr< HessianFactor > > EliminateCholesky(const GaussianFactorGraph &factors, const Ordering &keys)
VectorValues createCorrectDelta()
#define EXPECT(condition)
bool equals(const This &fg, double tol=1e-9) const
std::pair< boost::shared_ptr< BayesNetType >, boost::shared_ptr< FactorGraphType > > eliminatePartialSequential(const Ordering &ordering, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
VectorValues createZeroDelta()
Linear Factor Graph where all factors are Gaussians.
static SharedDiagonal model
Basic bearing factor from 2D measurement.
void print(vector< int > v)
GaussianFactorGraph createSimpleConstraintGraph()
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
#define LONGS_EQUAL(expected, actual)
noiseModel::Diagonal::shared_ptr SharedDiagonal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
bool hasConstraints(const GaussianFactorGraph &factors)
VectorValues createSimpleConstraintValues()
Point2 f1(const Point3 &p, OptionalJacobian< 2, 3 > H)
double f4(double x, double y, double z)
double f3(double x1, double x2)
Create small example with two poses and one landmark.
boost::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType=boost::none, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
Chordal Bayes Net, the result of eliminating a factor graph.
boost::shared_ptr< GaussianFactor > linearize(const Values &x) const override
TEST(GaussianFactorGraph, equals)
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
GaussianFactorGraph createSingleConstraintGraph()
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
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
boost::shared_ptr< Cal3_S2 > shared_ptr
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
std::uint64_t Key
Integer nonlinear key type.
double error(const VectorValues &x)
noiseModel::Base::shared_ptr SharedNoiseModel