17 using namespace gtsam;
41 double range11 =
std::sqrt(4.0 + 4.0), range21 = 2.0, range32 = 2.0;
70 auto marginalCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
x1}, &
graph));
71 auto landmarkCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
l1,
l2}, &
graph));
72 auto rootCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
x2,
x3}, &
graph));
83 auto gfg = marginalCluster->linearize(initial);
88 ordering.push_back(
x1);
89 const auto [bn, fg] = gfg->eliminatePartialSequential(ordering);
90 auto expectedFactor = std::dynamic_pointer_cast<
HessianFactor>(fg->at(0));
92 throw std::runtime_error(
"Expected HessianFactor");
95 auto actual = marginalCluster->linearizeAndEliminate(initial);
109 auto marginalCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
x1}, &
graph));
110 auto landmarkCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
l1,
l2}, &
graph));
111 auto rootCluster = std::shared_ptr<Cluster>(
new Cluster(variableIndex, {
x2,
x3}, &
graph));
115 clusterTree.
addRoot(rootCluster);
116 rootCluster->addChild(landmarkCluster);
117 landmarkCluster->addChild(marginalCluster);
143 for (
size_t i = 0;
i < 4;
i++)
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
static int runAllTests(TestResult &result)
Point2 prior(const Point2 &x)
Prior on a single pose.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static const Symbol x3('x', 3)
static const Symbol x2('x', 2)
static const Symbol l1('l', 1)
Values updateCholesky(const Values &values)
NonlinearFactorGraph graph
static enum @1107 ordering
static Rot2 fromDegrees(double theta)
Named constructor from angle in degrees.
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
static const Symbol l2('l', 2)
#define EXPECT(condition)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static NonlinearClusterTree Construct()
#define EXPECT_LONGS_EQUAL(expected, actual)
static shared_ptr Sigmas(const Vector &sigmas, bool smart=true)
const sharedFactor at(size_t i) const
A Gaussian factor using the canonical parameters (information form)
void insert(Key j, const Value &val)
Jet< T, N > sqrt(const Jet< T, N > &f)
Pose2 odometry(2.0, 0.0, 0.0)
TEST(SmartFactorBase, Pinhole)
static const Symbol x1('x', 1)
NonlinearFactorGraph planarSLAMGraph()
void addRoot(const std::shared_ptr< Cluster > &cluster)
Values planarSLAMValues()