33 using namespace gtsam;
41 static auto kUnit2 = noiseModel::Unit::Create(2);
59 double actual = fg.
error(cfg);
67 GaussianConditional::shared_ptr conditional;
69 conditional =
result.first->front();
72 Matrix I = 15 * I_2x2, R11 =
I, S12 = -0.111111 *
I, S13 = -0.444444 *
I;
86 double sigma = 0.0894427;
115 Matrix I = 15 * I_2x2, R11 =
I, S12 = -0.111111 *
I, S13 = -0.444444 *
I;
121 L(1), (
Matrix(4, 2) << 6.87184, 0, 0, 6.87184, 0, 0, 0, 0).finished(),
123 (
Matrix(4, 2) << -5.25494, 0, 0, -5.25494, -7.27607, 0, 0, -7.27607)
125 (
Vector(4) << -1.21268, 1.73817, -0.727607, 1.45521).finished(),
126 noiseModel::Unit::Create(4));
138 double sigma = 0.0894427;
227 size_t size1 = fg1.
size();
228 size_t size2 = fg2.
size();
239 for (
size_t k = 0; k < v.size(); k++) cout << v[k] <<
" ";
263 expected.push_back(
Vector2(-1.0, -1.0));
264 expected.push_back(
Vector2(2.0, -1.0));
265 expected.push_back(
Vector2(0.0, 1.0));
266 expected.push_back(
Vector2(-1.0, 1.5));
275 Matrix Ap = I_1x1, An = I_1x1 * -1;
287 const auto [
R,
d] = bayesNet.
matrix();
289 (
Matrix(2, 2) << 0.707107, -0.353553, 0.0, 0.612372).finished();
291 (
Matrix(2, 2) << 0.707107, -0.353553, 0.0, -0.612372).finished();
351 X(1), I_3x3,
X(2), I_3x3,
Z_3x1, noise));
353 X(2), I_3x3,
X(3), I_3x3,
Z_3x1, noise));
355 X(3), I_3x3,
X(4), I_3x3,
Z_3x1, noise));
357 X(5), I_3x3,
X(6), I_3x3,
Z_3x1, noise));
411 double relElevation = 6;
416 -1., 0.0, 1.2246468
e-16,
418 -1.2246468
e-16, 0.0, -1.),
419 Point3(0.511832102, 8.42819594, 5.76841725)));
420 initValues.
insert(l32,
Point3(0.364081507, 6.89766221, -0.231582751) );
421 initValues.
insert(l41,
Point3(1.61051523, 6.7373052, -0.231582751) );
426 -1., 0.0, 1.2246468
e-16,
428 -1.2246468
e-16, 0.0, -1),
429 Point3(0.511832102, 8.42819594, 5.76841725)), priorModel);
441 for (
const auto& [
key, clique]: actBT.
nodes()) {
442 GaussianConditional::shared_ptr conditional = clique->conditional();
445 EXPECT(!conditional->get_model());
GaussianFactorGraph createMultiConstraintGraph()
const gtsam::Symbol key('X', 0)
VectorValues createMultiConstraintValues()
void replace(size_t index, sharedFactor factor)
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
Concept check for values that can be used in unit tests.
GaussianFactorGraph createSmoother(int T)
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
static int runAllTests(TestResult &result)
GaussianFactorGraph createGaussianFactorGraph()
const Nodes & nodes() const
#define DOUBLES_EQUAL(expected, actual, threshold)
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
std::pair< std::shared_ptr< BayesNetType >, std::shared_ptr< FactorGraphType > > eliminatePartialSequential(const Ordering &ordering, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
Rot2 R(Rot2::fromAngle(0.1))
VectorValues createSingleConstraintValues()
const GaussianFactorGraph factors
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Some functions to compute numerical derivatives.
double f2(const Vector2 &x)
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
double error(const VectorValues &x) const
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
static enum @1107 ordering
VectorValues optimize(const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
std::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.
bool equals(const This &fg, double tol=1e-9) const
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
VectorValues createCorrectDelta()
std::shared_ptr< Cal3_S2 > shared_ptr
#define EXPECT(condition)
std::pair< std::shared_ptr< GaussianConditional >, std::shared_ptr< HessianFactor > > EliminateCholesky(const GaussianFactorGraph &factors, const Ordering &keys)
Array< int, Dynamic, 1 > v
std::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
VectorValues createZeroDelta()
Linear Factor Graph where all factors are Gaussians.
The most common 5DOF 3D->2D calibration.
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
static SharedDiagonal model
Reprojection of a LANDMARK to a 2D point.
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
std::pair< Matrix, Vector > matrix(const Ordering &ordering) const
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.
Chordal Bayes Net, the result of eliminating a factor graph.
static const double sigma
void insert(Key j, const Value &val)
TEST(GaussianFactorGraph, equals)
Jet< T, N > sqrt(const Jet< T, N > &f)
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
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
bool hasConstraints(const GaussianFactorGraph &factors)
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