diff --git a/.cproject b/.cproject
index 0acb12e7e..c19b1a91a 100644
--- a/.cproject
+++ b/.cproject
@@ -311,14 +311,6 @@
true
true
-
- make
- -j2
- testGaussianFactor.run
- true
- true
- true
-
make
-j2
@@ -345,6 +337,7 @@
make
+
tests/testBayesTree.run
true
false
@@ -352,6 +345,7 @@
make
+
testBinaryBayesNet.run
true
false
@@ -399,6 +393,7 @@
make
+
testSymbolicBayesNet.run
true
false
@@ -406,6 +401,7 @@
make
+
tests/testSymbolicFactor.run
true
false
@@ -413,6 +409,7 @@
make
+
testSymbolicFactorGraph.run
true
false
@@ -428,168 +425,17 @@
make
+
tests/testBayesTree
true
false
true
-
+
make
-j2
- check
- true
- true
- true
-
-
- make
- -j2
- testGaussianFactorGraph.run
- true
- true
- true
-
-
- make
- -j2
- testGaussianISAM.run
- true
- true
- true
-
-
- make
-
- testGraph.run
- true
- false
- true
-
-
- make
- -j2
- testIterative.run
- true
- true
- true
-
-
- make
- -j2
- testNonlinearEquality.run
- true
- true
- true
-
-
- make
- -j2
- testNonlinearFactor.run
- true
- true
- true
-
-
- make
- -j2
- testNonlinearFactorGraph.run
- true
- true
- true
-
-
- make
- -j2
- testNonlinearOptimizer.run
- true
- true
- true
-
-
- make
- -j2
- testSubgraphPreconditioner.run
- true
- true
- true
-
-
- make
- -j2
- testTupleConfig.run
- true
- true
- true
-
-
- make
- -j2
- timeGaussianFactorGraph.run
- true
- true
- true
-
-
- make
-
- testInference.run
- true
- false
- true
-
-
- make
-
testGaussianFactor.run
true
- false
- true
-
-
- make
-
- testJunctionTree.run
- true
- false
- true
-
-
- make
-
- testSymbolicBayesNet.run
- true
- false
- true
-
-
- make
-
- testSymbolicFactorGraph.run
- true
- false
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
-
- make
- -j2
- testGaussianJunctionTree
- true
- true
- true
-
-
- make
- -j2
- testSerialization.run
- true
true
true
@@ -665,22 +511,6 @@
false
true
-
- make
- -j2
- all
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
make
-j2
@@ -697,6 +527,22 @@
true
true
+
+ make
+ -j2
+ all
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
make
-j2
@@ -721,54 +567,6 @@
true
true
-
- make
- -j5
- testValues.run
- true
- true
- true
-
-
- make
- -j5
- testOrdering.run
- true
- true
- true
-
-
- make
- -j2
- tests/testGeneralSFMFactor.run
- true
- true
- true
-
-
- make
- -j2
- tests/testPlanarSLAM.run
- true
- true
- true
-
-
- make
- -j2
- tests/testPose2SLAM.run
- true
- true
- true
-
-
- make
- -j2
- tests/testPose3SLAM.run
- true
- true
- true
-
make
-j2
@@ -793,6 +591,94 @@
true
true
+
+ make
+ -j5
+ testGeneralSFMFactor.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testPlanarSLAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testPose2SLAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testPose3SLAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testSimulated2D.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testSimulated2DOriented.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testVisualSLAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testProjectionFactor.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testSerializationSLAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testValues.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testOrdering.run
+ true
+ true
+ true
+
make
-j5
@@ -897,22 +783,6 @@
true
true
-
- make
- -j2
- testGaussianJunctionTree.run
- true
- true
- true
-
-
- make
- -j2
- testGaussianFactorGraph.run
- true
- true
- true
-
make
-j2
@@ -921,42 +791,26 @@
true
true
-
+
make
- -j2
- testTupleConfig.run
+ -j5
+ testMarginals.run
true
true
true
-
+
make
- -j2
- testSerialization.run
+ -j5
+ testGaussianISAM2.run
true
true
true
-
+
make
- -j2
- testInference.run
- true
- true
- true
-
-
- make
- -j2
- testGaussianISAM.run
- true
- true
- true
-
-
- make
- -j2
- testSymbolicFactorGraph.run
+ -j5
+ testSymbolicFactorGraphB.run
true
true
true
@@ -985,14 +839,6 @@
true
true
-
- make
- -j2
- testPose2SLAMwSPCG.run
- true
- true
- true
-
make
-j2
@@ -1017,14 +863,6 @@
true
true
-
- make
- -j5
- tests.testBoundingConstraint.run
- true
- true
- true
-
make
-j2
@@ -1057,6 +895,62 @@
true
true
+
+ make
+ -j5
+ clean
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testGaussianJunctionTreeB.run
+ true
+ true
+ true
+
+
+ make
+
+ testGraph.run
+ true
+ false
+ true
+
+
+ make
+
+ testJunctionTree.run
+ true
+ false
+ true
+
+
+ make
+
+ testSymbolicBayesNetB.run
+ true
+ false
+ true
+
+
+ make
+ -j5
+ testGaussianISAM.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ testDoglegOptimizer.run
+ true
+ true
+ true
+
make
-j2
@@ -1147,6 +1041,7 @@
make
+
testErrors.run
true
false
@@ -1602,7 +1497,6 @@
make
-
testSimulated2DOriented.run
true
false
@@ -1642,7 +1536,6 @@
make
-
testSimulated2D.run
true
false
@@ -1650,7 +1543,6 @@
make
-
testSimulated3D.run
true
false
@@ -1752,10 +1644,10 @@
true
true
-
+
make
- -j2
- CameraResectioning
+ -j5
+ CameraResectioning.run
true
true
true
@@ -1832,6 +1724,30 @@
true
true
+
+ make
+ -j5
+ LocalizationExample.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ LocalizationExample2.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ Pose2SLAMwSPCG_advanced.run
+ true
+ true
+ true
+
make
-j2
@@ -1842,7 +1758,6 @@
make
-
tests/testGaussianISAM2
true
false
@@ -1864,102 +1779,6 @@
true
true
-
- make
- -j2
- testRot3.run
- true
- true
- true
-
-
- make
- -j2
- testRot2.run
- true
- true
- true
-
-
- make
- -j2
- testPose3.run
- true
- true
- true
-
-
- make
- -j2
- timeRot3.run
- true
- true
- true
-
-
- make
- -j2
- testPose2.run
- true
- true
- true
-
-
- make
- -j2
- testCal3_S2.run
- true
- true
- true
-
-
- make
- -j2
- testSimpleCamera.run
- true
- true
- true
-
-
- make
- -j2
- testHomography2.run
- true
- true
- true
-
-
- make
- -j2
- testCalibratedCamera.run
- true
- true
- true
-
-
- make
- -j2
- check
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
-
- make
- -j2
- testPoint2.run
- true
- true
- true
-
make
-j2
@@ -2161,6 +1980,7 @@
cpack
+
-G DEB
true
false
@@ -2168,6 +1988,7 @@
cpack
+
-G RPM
true
false
@@ -2175,6 +1996,7 @@
cpack
+
-G TGZ
true
false
@@ -2182,6 +2004,7 @@
cpack
+
--config CPackSourceConfig.cmake
true
false
@@ -2235,42 +2058,98 @@
true
true
-
+
make
- -j5
- wrap.testSpirit.run
+ -j2
+ testRot3.run
true
true
true
-
+
make
- -j5
- wrap.testWrap.run
+ -j2
+ testRot2.run
true
true
true
-
+
make
- -j5
- check.wrap
+ -j2
+ testPose3.run
true
true
true
-
+
make
- -j5
- wrap_gtsam
+ -j2
+ timeRot3.run
true
true
true
-
+
make
- -j5
- wrap
+ -j2
+ testPose2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCal3_S2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testSimpleCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testHomography2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCalibratedCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ check
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPoint2.run
true
true
true
@@ -2314,6 +2193,46 @@
false
true
+
+ make
+ -j5
+ wrap.testSpirit.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ wrap.testWrap.run
+ true
+ true
+ true
+
+
+ make
+ -j5
+ check.wrap
+ true
+ true
+ true
+
+
+ make
+ -j5
+ wrap_gtsam
+ true
+ true
+ true
+
+
+ make
+ -j5
+ wrap
+ true
+ true
+ true
+
diff --git a/examples/LocalizationExample.cpp b/examples/LocalizationExample.cpp
index 2d2357dad..a8ff59d68 100644
--- a/examples/LocalizationExample.cpp
+++ b/examples/LocalizationExample.cpp
@@ -66,9 +66,9 @@ int main(int argc, char** argv) {
// Query the marginals
Marginals marginals = graph.marginals(result);
cout.precision(2);
- cout << "\nP1:\n" << marginals.marginalCovariance(pose2SLAM::PoseKey(1)) << endl;
- cout << "\nP2:\n" << marginals.marginalCovariance(pose2SLAM::PoseKey(2)) << endl;
- cout << "\nP3:\n" << marginals.marginalCovariance(pose2SLAM::PoseKey(3)) << endl;
+ cout << "\nP1:\n" << marginals.marginalCovariance(1) << endl;
+ cout << "\nP2:\n" << marginals.marginalCovariance(2) << endl;
+ cout << "\nP3:\n" << marginals.marginalCovariance(3) << endl;
return 0;
}
diff --git a/examples/LocalizationExample2.cpp b/examples/LocalizationExample2.cpp
index 903101d87..9a4330181 100644
--- a/examples/LocalizationExample2.cpp
+++ b/examples/LocalizationExample2.cpp
@@ -71,10 +71,9 @@ int main(int argc, char** argv) {
// add unary measurement factors, like GPS, on all three poses
SharedDiagonal noiseModel(Vector_(2, 0.1, 0.1)); // 10cm std on x,y
- Symbol x1('x',1), x2('x',2), x3('x',3);
- graph.push_back(boost::make_shared(x1, 0, 0, noiseModel));
- graph.push_back(boost::make_shared(x2, 2, 0, noiseModel));
- graph.push_back(boost::make_shared(x3, 4, 0, noiseModel));
+ graph.push_back(boost::make_shared(1, 0, 0, noiseModel));
+ graph.push_back(boost::make_shared(2, 2, 0, noiseModel));
+ graph.push_back(boost::make_shared(3, 4, 0, noiseModel));
// print
graph.print("\nFactor graph:\n");
@@ -94,9 +93,9 @@ int main(int argc, char** argv) {
// Query the marginals
Marginals marginals(graph, result);
cout.precision(2);
- cout << "\nP1:\n" << marginals.marginalCovariance(x1) << endl;
- cout << "\nP2:\n" << marginals.marginalCovariance(x2) << endl;
- cout << "\nP3:\n" << marginals.marginalCovariance(x3) << endl;
+ cout << "\nP1:\n" << marginals.marginalCovariance(1) << endl;
+ cout << "\nP2:\n" << marginals.marginalCovariance(2) << endl;
+ cout << "\nP3:\n" << marginals.marginalCovariance(3) << endl;
return 0;
}
diff --git a/examples/PlanarSLAMExample_easy.cpp b/examples/PlanarSLAMExample_easy.cpp
index 5039b1145..cd4a7aefd 100644
--- a/examples/PlanarSLAMExample_easy.cpp
+++ b/examples/PlanarSLAMExample_easy.cpp
@@ -35,16 +35,20 @@ int main(int argc, char** argv) {
// create the graph (defined in planarSlam.h, derived from NonlinearFactorGraph)
planarSLAM::Graph graph;
+ // Create some keys
+ static Symbol i1('x',1), i2('x',2), i3('x',3);
+ static Symbol j1('l',1), j2('l',2);
+
// add a Gaussian prior on pose x_1
Pose2 priorMean(0.0, 0.0, 0.0); // prior mean is at origin
SharedDiagonal priorNoise(Vector_(3, 0.3, 0.3, 0.1)); // 30cm std on x,y, 0.1 rad on theta
- graph.addPrior(1, priorMean, priorNoise); // add directly to graph
+ graph.addPrior(i1, priorMean, priorNoise); // add directly to graph
// add two odometry factors
Pose2 odometry(2.0, 0.0, 0.0); // create a measurement for both factors (the same in this case)
SharedDiagonal odometryNoise(Vector_(3, 0.2, 0.2, 0.1)); // 20cm std on x,y, 0.1 rad on theta
- graph.addOdometry(1, 2, odometry, odometryNoise);
- graph.addOdometry(2, 3, odometry, odometryNoise);
+ graph.addOdometry(i1, i2, odometry, odometryNoise);
+ graph.addOdometry(i2, i3, odometry, odometryNoise);
// create a noise model for the landmark measurements
SharedDiagonal measurementNoise(Vector_(2, 0.1, 0.2)); // 0.1 rad std on bearing, 20cm on range
@@ -58,20 +62,20 @@ int main(int argc, char** argv) {
range32 = 2.0;
// add bearing/range factors (created by "addBearingRange")
- graph.addBearingRange(1, 1, bearing11, range11, measurementNoise);
- graph.addBearingRange(2, 1, bearing21, range21, measurementNoise);
- graph.addBearingRange(3, 2, bearing32, range32, measurementNoise);
+ graph.addBearingRange(i1, j1, bearing11, range11, measurementNoise);
+ graph.addBearingRange(i2, j1, bearing21, range21, measurementNoise);
+ graph.addBearingRange(i3, j2, bearing32, range32, measurementNoise);
// print
graph.print("Factor graph");
// create (deliberatly inaccurate) initial estimate
planarSLAM::Values initialEstimate;
- initialEstimate.insertPose(1, Pose2(0.5, 0.0, 0.2));
- initialEstimate.insertPose(2, Pose2(2.3, 0.1,-0.2));
- initialEstimate.insertPose(3, Pose2(4.1, 0.1, 0.1));
- initialEstimate.insertPoint(1, Point2(1.8, 2.1));
- initialEstimate.insertPoint(2, Point2(4.1, 1.8));
+ initialEstimate.insertPose(i1, Pose2(0.5, 0.0, 0.2));
+ initialEstimate.insertPose(i2, Pose2(2.3, 0.1,-0.2));
+ initialEstimate.insertPose(i3, Pose2(4.1, 0.1, 0.1));
+ initialEstimate.insertPoint(j1, Point2(1.8, 2.1));
+ initialEstimate.insertPoint(j2, Point2(4.1, 1.8));
initialEstimate.print("Initial estimate:\n ");
diff --git a/examples/PlanarSLAMSelfContained_advanced.cpp b/examples/PlanarSLAMSelfContained_advanced.cpp
index 36f9ad8ca..bff4ee7ea 100644
--- a/examples/PlanarSLAMSelfContained_advanced.cpp
+++ b/examples/PlanarSLAMSelfContained_advanced.cpp
@@ -15,29 +15,29 @@
* @author Alex Cunningham
*/
-#include
-#include
-
-// for all nonlinear keys
-#include
-
-// for points and poses
-#include
-#include
-
-// for modeling measurement uncertainty - all models included here
-#include
-
// add in headers for specific factors
#include
#include
#include
+// for all nonlinear keys
+#include
+
// implementations for structures - needed if self-contained, and these should be included last
#include
#include
#include
+// for modeling measurement uncertainty - all models included here
+#include
+
+// for points and poses
+#include
+#include
+
+#include
+#include
+
using namespace std;
using namespace gtsam;
@@ -52,8 +52,8 @@ using namespace gtsam;
*/
int main(int argc, char** argv) {
// create keys for variables
- Symbol x1('x',1), x2('x',2), x3('x',3);
- Symbol l1('l',1), l2('l',2);
+ Symbol i1('x',1), i2('x',2), i3('x',3);
+ Symbol j1('l',1), j2('l',2);
// create graph container and add factors to it
NonlinearFactorGraph graph;
@@ -62,7 +62,7 @@ int main(int argc, char** argv) {
// gaussian for prior
SharedDiagonal prior_model = noiseModel::Diagonal::Sigmas(Vector_(3, 0.3, 0.3, 0.1));
Pose2 prior_measurement(0.0, 0.0, 0.0); // prior at origin
- PriorFactor posePrior(x1, prior_measurement, prior_model); // create the factor
+ PriorFactor posePrior(i1, prior_measurement, prior_model); // create the factor
graph.add(posePrior); // add the factor to the graph
/* add odometry */
@@ -70,8 +70,8 @@ int main(int argc, char** argv) {
SharedDiagonal odom_model = noiseModel::Diagonal::Sigmas(Vector_(3, 0.2, 0.2, 0.1));
Pose2 odom_measurement(2.0, 0.0, 0.0); // create a measurement for both factors (the same in this case)
// create between factors to represent odometry
- BetweenFactor odom12(x1, x2, odom_measurement, odom_model);
- BetweenFactor odom23(x2, x3, odom_measurement, odom_model);
+ BetweenFactor odom12(i1, i2, odom_measurement, odom_model);
+ BetweenFactor odom23(i2, i3, odom_measurement, odom_model);
graph.add(odom12); // add both to graph
graph.add(odom23);
@@ -88,9 +88,9 @@ int main(int argc, char** argv) {
range32 = 2.0;
// create bearing/range factors
- BearingRangeFactor meas11(x1, l1, bearing11, range11, meas_model);
- BearingRangeFactor meas21(x2, l1, bearing21, range21, meas_model);
- BearingRangeFactor meas32(x3, l2, bearing32, range32, meas_model);
+ BearingRangeFactor meas11(i1, j1, bearing11, range11, meas_model);
+ BearingRangeFactor meas21(i2, j1, bearing21, range21, meas_model);
+ BearingRangeFactor meas32(i3, j2, bearing32, range32, meas_model);
// add the factors
graph.add(meas11);
@@ -101,11 +101,11 @@ int main(int argc, char** argv) {
// initialize to noisy points
Values initial;
- initial.insert(x1, Pose2(0.5, 0.0, 0.2));
- initial.insert(x2, Pose2(2.3, 0.1,-0.2));
- initial.insert(x3, Pose2(4.1, 0.1, 0.1));
- initial.insert(l1, Point2(1.8, 2.1));
- initial.insert(l2, Point2(4.1, 1.8));
+ initial.insert(i1, Pose2(0.5, 0.0, 0.2));
+ initial.insert(i2, Pose2(2.3, 0.1,-0.2));
+ initial.insert(i3, Pose2(4.1, 0.1, 0.1));
+ initial.insert(j1, Point2(1.8, 2.1));
+ initial.insert(j2, Point2(4.1, 1.8));
initial.print("initial estimate");
@@ -126,11 +126,11 @@ int main(int argc, char** argv) {
// Print marginals covariances for all variables
Marginals marginals(graph, resultMultifrontal, Marginals::CHOLESKY);
- print(marginals.marginalCovariance(x1), "x1 covariance");
- print(marginals.marginalCovariance(x2), "x2 covariance");
- print(marginals.marginalCovariance(x3), "x3 covariance");
- print(marginals.marginalCovariance(l1), "l1 covariance");
- print(marginals.marginalCovariance(l2), "l2 covariance");
+ print(marginals.marginalCovariance(i1), "i1 covariance");
+ print(marginals.marginalCovariance(i2), "i2 covariance");
+ print(marginals.marginalCovariance(i3), "i3 covariance");
+ print(marginals.marginalCovariance(j1), "j1 covariance");
+ print(marginals.marginalCovariance(j2), "j2 covariance");
return 0;
}
diff --git a/examples/Pose2SLAMExample_advanced.cpp b/examples/Pose2SLAMExample_advanced.cpp
index 29d8c58cf..3884e03e4 100644
--- a/examples/Pose2SLAMExample_advanced.cpp
+++ b/examples/Pose2SLAMExample_advanced.cpp
@@ -16,26 +16,23 @@
* @author Chris Beall
*/
-#include
-#include
-#include
-
// pull in the Pose2 SLAM domain with all typedefs and helper functions defined
#include
#include
#include
-
#include
#include
+#include
+#include
+#include
+
using namespace std;
using namespace gtsam;
-using namespace boost;
-using namespace pose2SLAM;
int main(int argc, char** argv) {
/* 1. create graph container and add factors to it */
- Graph graph;
+ pose2SLAM::Graph graph;
/* 2.a add prior */
// gaussian for prior
@@ -77,8 +74,8 @@ int main(int argc, char** argv) {
/* Get covariances */
Marginals marginals(graph, result, Marginals::CHOLESKY);
- Matrix covariance1 = marginals.marginalCovariance(PoseKey(1));
- Matrix covariance2 = marginals.marginalCovariance(PoseKey(2));
+ Matrix covariance1 = marginals.marginalCovariance(1);
+ Matrix covariance2 = marginals.marginalCovariance(2);
print(covariance1, "Covariance1");
print(covariance2, "Covariance2");
diff --git a/examples/matlab/LocalizationExample.m b/examples/matlab/LocalizationExample.m
index 521c768ec..3a8282e3a 100644
--- a/examples/matlab/LocalizationExample.m
+++ b/examples/matlab/LocalizationExample.m
@@ -45,9 +45,9 @@ result.print(sprintf('\nFinal result:\n '));
%% Query the marginals
marginals = graph.marginals(result);
-x{1}=gtsamSymbol('x',1); P{1}=marginals.marginalCovariance(x{1}.key)
-x{2}=gtsamSymbol('x',2); P{2}=marginals.marginalCovariance(x{2}.key)
-x{3}=gtsamSymbol('x',3); P{3}=marginals.marginalCovariance(x{3}.key)
+P{1}=marginals.marginalCovariance(1)
+P{2}=marginals.marginalCovariance(2)
+P{3}=marginals.marginalCovariance(3)
%% Plot Trajectory
figure(1)
diff --git a/examples/vSLAMexample/Feature2D.h b/examples/vSLAMexample/Feature2D.h
index aca5f9e4b..ea0f60e74 100644
--- a/examples/vSLAMexample/Feature2D.h
+++ b/examples/vSLAMexample/Feature2D.h
@@ -24,7 +24,7 @@ struct Feature2D
{
gtsam::Point2 m_p;
- int m_idCamera; // id of the camera pose that makes this measurement
+ int m_idCamera; // id of the camera pose that makes this measurement
int m_idLandmark; // id of the 3D landmark that it is associated with
Feature2D(int idCamera, int idLandmark, gtsam::Point2 p) :
diff --git a/examples/vSLAMexample/vISAMexample.cpp b/examples/vSLAMexample/vISAMexample.cpp
index 71d5516a2..6b47c9633 100644
--- a/examples/vSLAMexample/vISAMexample.cpp
+++ b/examples/vSLAMexample/vISAMexample.cpp
@@ -11,14 +11,12 @@
/**
* @file vISAMexample.cpp
- * @brief An ISAM example for synthesis sequence
- * single camera
+ * @brief An ISAM example for synthesis sequence, single camera
* @author Duy-Nguyen Ta
*/
-#include
-#include
-using namespace boost;
+#include "vSLAMutils.h"
+#include "Feature2D.h"
#include
#include
@@ -26,13 +24,12 @@ using namespace boost;
#include
#include
-#include "vSLAMutils.h"
-#include "Feature2D.h"
+#include
+#include
+using namespace boost;
using namespace std;
using namespace gtsam;
-using namespace visualSLAM;
-using namespace boost;
/* ************************************************************************* */
#define CALIB_FILE "calib.txt"
@@ -45,7 +42,7 @@ string g_dataFolder;
// Store groundtruth values, read from files
shared_ptrK g_calib;
-map g_landmarks; // map:
+map g_landmarks; // map:
map g_poses; // map:
std::map > g_measurements; // feature sets detected at each frame
@@ -76,31 +73,31 @@ void readAllDataISAM() {
/**
* Setup newFactors and initialValues for each new pose and set of measurements at each frame.
*/
-void createNewFactors(shared_ptr& newFactors, boost::shared_ptr& initialValues,
+void createNewFactors(shared_ptr& newFactors, boost::shared_ptr& initialValues,
int pose_id, const Pose3& pose, const std::vector& measurements, SharedNoiseModel measurementSigma, shared_ptrK calib) {
// Create a graph of newFactors with new measurements
- newFactors = shared_ptr (new Graph());
+ newFactors = shared_ptr (new visualSLAM::Graph());
for (size_t i = 0; i < measurements.size(); i++) {
newFactors->addMeasurement(
measurements[i].m_p,
measurementSigma,
- pose_id,
- measurements[i].m_idLandmark,
+ Symbol('x',pose_id),
+ Symbol('l',measurements[i].m_idLandmark),
calib);
}
// ... we need priors on the new pose and all new landmarks
newFactors->addPosePrior(pose_id, pose, poseSigma);
for (size_t i = 0; i < measurements.size(); i++) {
- newFactors->addPointPrior(measurements[i].m_idLandmark, g_landmarks[measurements[i].m_idLandmark]);
+ newFactors->addPointPrior(Symbol('x',measurements[i].m_idLandmark), g_landmarks[measurements[i].m_idLandmark]);
}
// Create initial values for all nodes in the newFactors
initialValues = shared_ptr (new Values());
- initialValues->insert(PoseKey(pose_id), pose);
+ initialValues->insert(Symbol('x',pose_id), pose);
for (size_t i = 0; i < measurements.size(); i++) {
- initialValues->insert(PointKey(measurements[i].m_idLandmark), g_landmarks[measurements[i].m_idLandmark]);
+ initialValues->insert(Symbol('l',measurements[i].m_idLandmark), g_landmarks[measurements[i].m_idLandmark]);
}
}
@@ -127,8 +124,8 @@ int main(int argc, char* argv[]) {
typedef std::map > FeatureMap;
BOOST_FOREACH(const FeatureMap::value_type& features, g_measurements) {
const int poseId = features.first;
- shared_ptr newFactors;
- shared_ptr initialValues;
+ shared_ptr newFactors;
+ shared_ptr initialValues;
createNewFactors(newFactors, initialValues, poseId, g_poses[poseId],
features.second, measurementSigma, g_calib);
diff --git a/examples/vSLAMexample/vSFMexample.cpp b/examples/vSLAMexample/vSFMexample.cpp
index 8774b79f3..6eb3955f2 100644
--- a/examples/vSLAMexample/vSFMexample.cpp
+++ b/examples/vSLAMexample/vSFMexample.cpp
@@ -11,26 +11,23 @@
/**
* @file vSFMexample.cpp
- * @brief An vSFM example for synthesis sequence
- * single camera
+ * @brief A visual SLAM example for simulated sequence
* @author Duy-Nguyen Ta
*/
-#include
-using namespace boost;
+#include "vSLAMutils.h"
+#include "Feature2D.h"
#include
#include
#include
#include
-#include "vSLAMutils.h"
-#include "Feature2D.h"
+#include
+using namespace boost;
using namespace std;
using namespace gtsam;
-using namespace visualSLAM;
-using namespace boost;
/* ************************************************************************* */
#define CALIB_FILE "calib.txt"
@@ -43,9 +40,9 @@ string g_dataFolder;
// Store groundtruth values, read from files
shared_ptrK g_calib;
-map g_landmarks; // map:
-map g_poses; // map:
-std::vector g_measurements; // Feature2D: {camera_id, landmark_id, 2d feature_position}
+map g_landmarks; // map:
+map g_poses; // map:
+std::vector g_measurements; // Feature2D: {camera_id, landmark_id, 2d feature_position}
// Noise models
SharedNoiseModel measurementSigma(noiseModel::Isotropic::Sigma(2, 5.0f));
@@ -75,9 +72,9 @@ void readAllData() {
* by adding and linking 2D features (measurements) detected in each captured image
* with their corresponding landmarks.
*/
-Graph setupGraph(std::vector& measurements, SharedNoiseModel measurementSigma, shared_ptrK calib) {
+visualSLAM::Graph setupGraph(std::vector& measurements, SharedNoiseModel measurementSigma, shared_ptrK calib) {
- Graph g;
+ visualSLAM::Graph g;
cout << "Built graph: " << endl;
for (size_t i = 0; i < measurements.size(); i++) {
@@ -86,8 +83,8 @@ Graph setupGraph(std::vector& measurements, SharedNoiseModel measurem
g.addMeasurement(
measurements[i].m_p,
measurementSigma,
- measurements[i].m_idCamera,
- measurements[i].m_idLandmark,
+ Symbol('x',measurements[i].m_idCamera),
+ Symbol('l',measurements[i].m_idLandmark),
calib);
}
@@ -101,15 +98,15 @@ Graph setupGraph(std::vector& measurements, SharedNoiseModel measurem
*/
Values initialize(std::map landmarks, std::map poses) {
- Values initValues;
+ visualSLAM::Values initValues;
// Initialize landmarks 3D positions.
for (map::iterator lmit = landmarks.begin(); lmit != landmarks.end(); lmit++)
- initValues.insert(PointKey(lmit->first), lmit->second);
+ initValues.insert(Symbol('l',lmit->first), lmit->second);
// Initialize camera poses.
for (map::iterator poseit = poses.begin(); poseit != poses.end(); poseit++)
- initValues.insert(PoseKey(poseit->first), poseit->second);
+ initValues.insert(Symbol('x',poseit->first), poseit->second);
return initValues;
}
@@ -129,7 +126,7 @@ int main(int argc, char* argv[]) {
readAllData();
// Create a graph using the 2D measurements (features) and the calibration data
- Graph graph(setupGraph(g_measurements, measurementSigma, g_calib));
+ visualSLAM::Graph graph(setupGraph(g_measurements, measurementSigma, g_calib));
// Create an initial Values structure using groundtruth values as the initial estimates
Values initialEstimates(initialize(g_landmarks, g_poses));
@@ -139,7 +136,7 @@ int main(int argc, char* argv[]) {
// Add prior factor for all poses in the graph
map::iterator poseit = g_poses.begin();
for (; poseit != g_poses.end(); poseit++)
- graph.addPosePrior(poseit->first, poseit->second, noiseModel::Unit::Create(1));
+ graph.addPosePrior(Symbol('x',poseit->first), poseit->second, noiseModel::Unit::Create(1));
// Optimize the graph
cout << "*******************************************************" << endl;
diff --git a/examples/vSLAMexample/vSLAMutils.h b/examples/vSLAMexample/vSLAMutils.h
index 52d492224..2365ef35c 100644
--- a/examples/vSLAMexample/vSLAMutils.h
+++ b/examples/vSLAMexample/vSLAMutils.h
@@ -17,13 +17,12 @@
#pragma once
-#include