34 using namespace gtsam;
71 auto gPlus = initialize::buildPoseGraph<Pose2>(
g);
94 TEST( Lago, checkSTandChords ) {
96 auto gPlus = initialize::buildPoseGraph<Pose2>(
g);
100 vector<size_t> spanningTreeIds;
101 vector<size_t> chordsIds;
111 TEST(Lago, orientationsOverSpanningTree) {
113 auto gPlus = initialize::buildPoseGraph<Pose2>(
g);
128 expected[
x3] = 3 *
M_PI / 2;
148 TEST( Lago, regularizedMeasurements ) {
150 auto gPlus = initialize::buildPoseGraph<Pose2>(
g);
154 vector<size_t> spanningTreeIds;
155 vector<size_t> chordsIds;
161 std::pair<Matrix,Vector> actualAb = lagoGraph.
jacobian();
163 Vector actual = (
Vector(5) << actualAb.second(0),actualAb.second(1),actualAb.second(2),actualAb.second(3),actualAb.second(4)).finished();
165 actual = 0.1 * actual;
173 TEST( Lago, smallGraphVectorValues ) {
174 bool useOdometricPath =
false;
185 TEST( Lago, smallGraphVectorValuesSP ) {
197 TEST( Lago, multiplePosePriors ) {
198 bool useOdometricPath =
false;
211 TEST( Lago, multiplePosePriorsSP ) {
224 TEST( Lago, multiplePoseAndRotPriors ) {
225 bool useOdometricPath =
false;
238 TEST( Lago, multiplePoseAndRotPriorsSP ) {
251 TEST( Lago, smallGraphValues ) {
290 TEST( Lago, largeGraphNoisy_orientations ) {
303 for(VectorValues::const_iterator it = actualVV.
begin(); it != actualVV.
end(); ++it ){
306 Vector orientation = actualVV.
at(key);
307 Pose2 poseLago =
Pose2(0.0,0.0,orientation(0));
308 actual.
insert(key, poseLago);
315 const Key& k = key_pose.first;
322 TEST( Lago, largeGraphNoisy ) {
338 const Key& k = key_pose.first;
const gtsam::Symbol key('X', 0)
PredecessorMap< KEY > findMinimumSpanningTree(const G &fg)
static int runAllTests(TestResult &result)
const ValueType at(Key j) const
#define DOUBLES_EQUAL(expected, actual, threshold)
key2doubleMap computeThetasToRoot(const key2doubleMap &deltaThetaMap, const PredecessorMap &tree)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
common code between lago.* (2D) and InitializePose3.* (3D)
iterator end()
Iterator over variables.
void getSymbolicGraph(vector< size_t > &spanningTreeIds, vector< size_t > &chordsIds, key2doubleMap &deltaThetaMap, const PredecessorMap &tree, const NonlinearFactorGraph &g)
void g(const string &key, int i)
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
std::map< Key, Key > PredecessorMap
Initialize Pose2 in a factor graph using LAGO (Linear Approximation for Graph Optimization). see papers:
NonlinearFactorGraph graph()
#define EXPECT(condition)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Key symbol(unsigned char c, std::uint64_t j)
VectorValues initializeOrientations(const NonlinearFactorGraph &graph, bool useOdometricPath)
GraphAndValues readG2o(const std::string &g2oFile, const bool is3D, KernelFunctionType kernelFunctionType)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
TEST(Lago, findMinimumSpanningTree)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
#define EXPECT_LONGS_EQUAL(expected, actual)
std::pair< Matrix, Vector > jacobian(const Ordering &ordering) const
GaussianFactorGraph buildLinearOrientationGraph(const vector< size_t > &spanningTreeIds, const vector< size_t > &chordsIds, const NonlinearFactorGraph &g, const key2doubleMap &orientationsToRoot, const PredecessorMap &tree)
Class between(const Class &g) const
static SharedNoiseModel model(noiseModel::Isotropic::Sigma(3, 0.1))
static constexpr Key kAnchorKey
void insert(Key j, const Value &val)
std::map< Key, double > key2doubleMap
std::shared_ptr< Diagonal > shared_ptr
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
iterator begin()
Iterator over variables.
Values initialize(const NonlinearFactorGraph &graph, bool useOdometricPath)
utility functions for loading datasets
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Base::shared_ptr SharedNoiseModel