diff --git a/.cproject b/.cproject index af6b32cd2..a43d32f58 100644 --- a/.cproject +++ b/.cproject @@ -568,6 +568,7 @@ make + tests/testBayesTree.run true false @@ -575,6 +576,7 @@ make + testBinaryBayesNet.run true false @@ -622,6 +624,7 @@ make + testSymbolicBayesNet.run true false @@ -629,6 +632,7 @@ make + tests/testSymbolicFactor.run true false @@ -636,6 +640,7 @@ make + testSymbolicFactorGraph.run true false @@ -651,6 +656,7 @@ make + tests/testBayesTree true false @@ -728,46 +734,6 @@ true true - - make - -j5 - testValues.run - true - true - true - - - make - -j5 - testOrdering.run - true - true - true - - - make - -j5 - testKey.run - true - true - true - - - make - -j5 - testLinearContainerFactor.run - true - true - true - - - make - -j6 -j8 - testWhiteNoiseFactor.run - true - true - true - make -j2 @@ -1114,6 +1080,7 @@ make + testErrors.run true false @@ -1159,6 +1126,14 @@ true true + + make + -j5 + testParticleFactor.run + true + true + true + make -j2 @@ -1239,14 +1214,6 @@ true true - - make - -j5 - testParticleFactor.run - true - true - true - make -j2 @@ -1351,6 +1318,22 @@ true true + + make + -j5 + testImuFactor.run + true + true + true + + + make + -j5 + testCombinedImuFactor.run + true + true + true + make -j2 @@ -1433,7 +1416,6 @@ make - testSimulated2DOriented.run true false @@ -1473,7 +1455,6 @@ make - testSimulated2D.run true false @@ -1481,7 +1462,6 @@ make - testSimulated3D.run true false @@ -1495,22 +1475,6 @@ true true - - make - -j5 - testImuFactor.run - true - true - true - - - make - -j5 - testCombinedImuFactor.run - true - true - true - make -j5 @@ -1768,6 +1732,7 @@ cpack + -G DEB true false @@ -1775,6 +1740,7 @@ cpack + -G RPM true false @@ -1782,6 +1748,7 @@ cpack + -G TGZ true false @@ -1789,6 +1756,7 @@ cpack + --config CPackSourceConfig.cmake true false @@ -2547,6 +2515,7 @@ make + testGraph.run true false @@ -2554,6 +2523,7 @@ make + testJunctionTree.run true false @@ -2561,6 +2531,7 @@ make + testSymbolicBayesNetB.run true false @@ -2830,6 +2801,62 @@ true true + + make + -j5 + Pose2SLAMExample_lago.run + true + true + true + + + make + -j5 + Pose2SLAMExample_g2o.run + true + true + true + + + make + -j5 + testLago.run + true + true + true + + + make + -j5 + testLinearContainerFactor.run + true + true + true + + + make + -j5 + testOrdering.run + true + true + true + + + make + -j5 + testValues.run + true + true + true + + + make + -j5 + testWhiteNoiseFactor.run + true + true + true + make -j4 @@ -2848,7 +2875,6 @@ make - tests/testGaussianISAM2 true false diff --git a/examples/Pose2SLAMExample_g2o.cpp b/examples/Pose2SLAMExample_g2o.cpp index 393bba86d..565a26965 100644 --- a/examples/Pose2SLAMExample_g2o.cpp +++ b/examples/Pose2SLAMExample_g2o.cpp @@ -18,27 +18,22 @@ * @author Luca Carlone */ -#include -#include -#include #include -#include -#include +#include #include -#include -#include #include -#include using namespace std; using namespace gtsam; +int main(const int argc, const char *argv[]) { -int main(const int argc, const char *argv[]){ - + // Read graph from file + string g2oFile; if (argc < 2) - std::cout << "Please specify: 1st argument: input file (in g2o format) and 2nd argument: output file" << std::endl; - const string g2oFile = argv[1]; + g2oFile = "../../examples/Data/noisyToyGraph.txt"; + else + g2oFile = argv[1]; NonlinearFactorGraph graph; Values initial; @@ -46,7 +41,8 @@ int main(const int argc, const char *argv[]){ // Add prior on the pose having index (key) = 0 NonlinearFactorGraph graphWithPrior = graph; - noiseModel::Diagonal::shared_ptr priorModel = noiseModel::Diagonal::Variances((Vector(3) << 1e-6, 1e-6, 1e-8)); + noiseModel::Diagonal::shared_ptr priorModel = // + noiseModel::Diagonal::Variances((Vector(3) << 1e-6, 1e-6, 1e-8)); graphWithPrior.add(PriorFactor(0, Pose2(), priorModel)); std::cout << "Optimizing the factor graph" << std::endl; @@ -54,10 +50,13 @@ int main(const int argc, const char *argv[]){ Values result = optimizer.optimize(); std::cout << "Optimization complete" << std::endl; - const string outputFile = argv[2]; - std::cout << "Writing results to file: " << outputFile << std::endl; - writeG2o(outputFile, graph, result); - std::cout << "done! " << std::endl; - + if (argc < 3) { + result.print("result"); + } else { + const string outputFile = argv[2]; + std::cout << "Writing results to file: " << outputFile << std::endl; + writeG2o(outputFile, graph, result); + std::cout << "done! " << std::endl; + } return 0; } diff --git a/examples/Pose2SLAMExample_lago.cpp b/examples/Pose2SLAMExample_lago.cpp index d61f1b533..c84ea8c7c 100644 --- a/examples/Pose2SLAMExample_lago.cpp +++ b/examples/Pose2SLAMExample_lago.cpp @@ -12,33 +12,29 @@ /** * @file Pose2SLAMExample_lago.cpp * @brief A 2D Pose SLAM example that reads input from g2o, and solve the Pose2 problem - * using LAGO (Linear Approximation for Graph Optimization). See class LagoInitializer.h + * using LAGO (Linear Approximation for Graph Optimization). See class lago.h * Output is written on a file, in g2o format * Syntax for the script is ./Pose2SLAMExample_lago input.g2o output.g2o * @date May 15, 2014 * @author Luca Carlone */ -#include -#include -#include +#include #include -#include -#include -#include -#include +#include #include -#include using namespace std; using namespace gtsam; +int main(const int argc, const char *argv[]) { -int main(const int argc, const char *argv[]){ - + // Read graph from file + string g2oFile; if (argc < 2) - std::cout << "Please specify: 1st argument: input file (in g2o format) and 2nd argument: output file" << std::endl; - const string g2oFile = argv[1]; + g2oFile = "../../examples/Data/noisyToyGraph.txt"; + else + g2oFile = argv[1]; NonlinearFactorGraph graph; Values initial; @@ -46,17 +42,23 @@ int main(const int argc, const char *argv[]){ // Add prior on the pose having index (key) = 0 NonlinearFactorGraph graphWithPrior = graph; - noiseModel::Diagonal::shared_ptr priorModel = noiseModel::Diagonal::Variances((Vector(3) << 1e-6, 1e-6, 1e-8)); + noiseModel::Diagonal::shared_ptr priorModel = // + noiseModel::Diagonal::Variances((Vector(3) << 1e-6, 1e-6, 1e-8)); graphWithPrior.add(PriorFactor(0, Pose2(), priorModel)); + graphWithPrior.print(); std::cout << "Computing LAGO estimate" << std::endl; Values estimateLago = initializeLago(graphWithPrior); std::cout << "done!" << std::endl; - const string outputFile = argv[2]; - std::cout << "Writing results to file: " << outputFile << std::endl; - writeG2o(outputFile, graph, estimateLago); - std::cout << "done! " << std::endl; + if (argc < 3) { + estimateLago.print("estimateLago"); + } else { + const string outputFile = argv[2]; + std::cout << "Writing results to file: " << outputFile << std::endl; + writeG2o(outputFile, graph, estimateLago); + std::cout << "done! " << std::endl; + } return 0; }