33 using namespace gtsam;
69 TEST( Lago, checkSTandChords ) {
75 vector<size_t> spanningTreeIds;
76 vector<size_t> chordsIds;
86 TEST( Lago, orientationsOverSpanningTree ) {
104 vector<size_t> spanningTreeIds;
105 vector<size_t> chordsIds;
117 TEST( Lago, regularizedMeasurements ) {
123 vector<size_t> spanningTreeIds;
124 vector<size_t> chordsIds;
130 std::pair<Matrix,Vector> actualAb = lagoGraph.
jacobian();
132 Vector actual = (
Vector(5) << actualAb.second(0),actualAb.second(1),actualAb.second(2),actualAb.second(3),actualAb.second(4)).finished();
134 actual = 0.1 * actual;
142 TEST( Lago, smallGraphVectorValues ) {
143 bool useOdometricPath =
false;
154 TEST( Lago, smallGraphVectorValuesSP ) {
166 TEST( Lago, multiplePosePriors ) {
167 bool useOdometricPath =
false;
180 TEST( Lago, multiplePosePriorsSP ) {
193 TEST( Lago, multiplePoseAndRotPriors ) {
194 bool useOdometricPath =
false;
207 TEST( Lago, multiplePoseAndRotPriorsSP ) {
220 TEST( Lago, smallGraphValues ) {
259 TEST( Lago, largeGraphNoisy_orientations ) {
264 boost::tie(g, initial) =
readG2o(inputFile);
277 Vector orientation = actualVV.
at(key);
278 Pose2 poseLago =
Pose2(0.0,0.0,orientation(0));
279 actual.
insert(key, poseLago);
285 boost::tie(gmatlab, expected) =
readG2o(matlabFile);
287 for(
const auto key_val: *expected){
294 TEST( Lago, largeGraphNoisy ) {
299 boost::tie(g, initial) =
readG2o(inputFile);
311 boost::tie(gmatlab, expected) =
readG2o(matlabFile);
313 for(
const auto key_val: *expected){
static int runAllTests(TestResult &result)
void insert(Key j, const Value &val)
#define DOUBLES_EQUAL(expected, actual, threshold)
iterator end()
Iterator over variables.
IsDerived< DERIVEDFACTOR > add(boost::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
void g(const string &key, int i)
GaussianFactorGraph buildLinearOrientationGraph(const vector< size_t > &spanningTreeIds, const vector< size_t > &chordsIds, const NonlinearFactorGraph &g, const key2doubleMap &orientationsToRoot, const PredecessorMap< Key > &tree)
TEST(Lago, checkSTandChords)
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
string findExampleDataFile(const string &name)
Initialize Pose2 in a factor graph using LAGO (Linear Approximation for Graph Optimization). see papers:
boost::shared_ptr< This > shared_ptr
const ValueType at(Key j) const
NonlinearFactorGraph graph()
#define EXPECT(condition)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Values::const_iterator const_iterator
Const iterator over vector values.
Key symbol(unsigned char c, std::uint64_t j)
VectorValues initializeOrientations(const NonlinearFactorGraph &graph, bool useOdometricPath)
boost::shared_ptr< Diagonal > shared_ptr
std::pair< Matrix, Vector > jacobian(const Ordering &ordering) const
void getSymbolicGraph(vector< size_t > &spanningTreeIds, vector< size_t > &chordsIds, key2doubleMap &deltaThetaMap, const PredecessorMap< Key > &tree, const NonlinearFactorGraph &g)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
#define EXPECT_LONGS_EQUAL(expected, actual)
static SharedNoiseModel model(noiseModel::Isotropic::Sigma(3, 0.1))
Class between(const Class &g) const
PredecessorMap< KEY > findMinimumSpanningTree(const G &fg)
std::map< Key, double > key2doubleMap
GraphAndValues readG2o(const string &g2oFile, const bool is3D, KernelFunctionType kernelFunctionType)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
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
key2doubleMap computeThetasToRoot(const key2doubleMap &deltaThetaMap, const PredecessorMap< Key > &tree)
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