Go to the documentation of this file.
42 using namespace gtsam;
51 HybridGaussianFactor::const_iterator const_it = factor.
begin();
53 HybridGaussianFactor::iterator it = factor.
begin();
61 auto A1 = Matrix::Zero(2, 1);
62 auto A2 = Matrix::Zero(2, 2);
63 auto b = Matrix::Zero(2, 1);
65 auto f10 = std::make_shared<JacobianFactor>(
X(1),
A1,
X(2),
A2,
b);
66 auto f11 = std::make_shared<JacobianFactor>(
X(1),
A1,
X(2),
A2,
b);
75 std::vector<GaussianFactorValuePair> pairs{{
f10, 0.0}, {
f11, 0.0}};
94 auto A3 = Matrix::Zero(2, 3);
95 auto f20 = std::make_shared<JacobianFactor>(
X(1),
A1,
X(3),
A3,
b);
96 auto f21 = std::make_shared<JacobianFactor>(
X(1),
A1,
X(3),
A3,
b);
97 auto f22 = std::make_shared<JacobianFactor>(
X(1),
A1,
X(3),
A3,
b);
112 R
"(Hybrid [x1 x2; 1]{
148 dKeys.emplace_back(
M(0), 2);
149 dKeys.emplace_back(
M(1), 2);
151 auto gaussians = std::make_shared<GaussianConditional>();
163 auto A01 = Matrix2::Identity();
164 auto A02 = Matrix2::Identity();
166 auto A11 = Matrix2::Identity();
167 auto A12 = Matrix2::Identity() * 2;
169 auto b = Vector2::Zero();
171 auto f0 = std::make_shared<JacobianFactor>(
X(1), A01,
X(2), A02,
b);
172 auto f1 = std::make_shared<JacobianFactor>(
X(1),
A11,
X(2),
A12,
b);
177 continuousValues.insert(
X(2),
Vector2(1, 1));
181 hybridFactor.errorTree(continuousValues);
183 std::vector<DiscreteKey> discrete_keys = {
m1};
185 std::vector<double> errors = {1, 4};
192 discreteValues[
m1.first] = 1;
194 4.0, hybridFactor.error({continuousValues, discreteValues}), 1
e-9);
214 double measurement_noise = 1
e-3) {
215 auto model0 = noiseModel::Isotropic::Sigma(1,
sigmas[0]);
216 auto model1 = noiseModel::Isotropic::Sigma(1,
sigmas[1]);
217 auto prior_noise = noiseModel::Isotropic::Sigma(1, measurement_noise);
220 std::make_shared<BetweenFactor<double>>(
X(0),
X(1),
means[0], model0)
223 std::make_shared<BetweenFactor<double>>(
X(0),
X(1),
means[1],
model1)
229 std::vector<GaussianFactorValuePair>
factors{{
f0, model0->negLogConstant()},
257 double x1 = 0.0,
x2 = 1.75;
261 std::vector<double>
means = {0.0, 2.0},
sigmas = {1
e-0, 1
e-0};
288 auto prior_noise = noiseModel::Isotropic::Sigma(1, 1
e-3);
332 double x1 = 1.0,
x2 = 1.0;
336 std::vector<double>
means = {0.0, 0.0},
sigmas = {1e2, 1
e-2};
static int runAllTests(TestResult &result)
std::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
Linear Factor Graph where all factors are Gaussians.
A hybrid conditional in the Conditional Linear Gaussian scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define EXPECT_LONGS_EQUAL(expected, actual)
const HybridGaussianFactor hybridFactorA(m1, {{f10, 10}, {f11, 11}})
Concept check for values that can be used in unit tests.
#define EXPECT(condition)
iterator insert(const std::pair< Key, Vector > &key_value)
bool assert_print_equal(const std::string &expected, const V &actual, const std::string &s="")
const GaussianFactorGraph factors
A Bayes net of Gaussian Conditionals indexed by discrete keys.
DiscreteKeys is a set of keys that can be assembled using the & operator.
const_iterator begin() const
Point2Pair means(const std::vector< Point2Pair > &abPointPairs)
Calculate the two means of a set of Point2 pairs.
A set of GaussianFactors, indexed by a set of discrete keys.
const std::vector< GaussianConditional::shared_ptr > conditionals
Provides additional testing facilities for common data structures.
Eigen::Matrix< double, 1, 1 > Vector1
A conditional of gaussian conditionals indexed by discrete variables, as part of a Bayes Network....
void insert(Key j, const Vector &value)
const_iterator end() const
static const double A12[]
const HybridGaussianFactor hybridFactorB(m2, {{f20, 20}, {f21, 21}, {f22, 22}})
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
TEST(HybridGaussianFactor, Constructor)
Linearized Hybrid factor graph that uses type erasure.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
const KeyVector & keys() const
Access the factor's involved variable keys.
std::pair< Key, size_t > DiscreteKey
Implementation of a discrete-conditioned hybrid factor. Implements a joint discrete-continuous factor...
const KeyVector & continuousKeys() const
Return only the continuous keys for this factor.
static const double A11[]
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static HybridGaussianFactorGraph CreateFactorGraph(const gtsam::Values &values, const std::vector< double > &means, const std::vector< double > &sigmas, DiscreteKey &m1, double measurement_noise=1e-3)
Create a Factor Graph by directly specifying all the factors instead of creating conditionals first....
noiseModel::Isotropic::shared_ptr model1
const DiscreteKeys & discreteKeys() const
Return the discrete keys for this factor.
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
Matrix< RealScalar, Dynamic, Dynamic > M
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:40:14