From 68d2f81f0a7624ea45b5437666d7a8f557af152b Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 31 Oct 2009 16:54:38 +0000 Subject: [PATCH] Smoother now creates x1...xT, not x0 anymore --- cpp/smallExample.cpp | 12 ++++++------ cpp/testLinearFactorGraph.cpp | 4 ++-- cpp/timeLinearFactorGraph.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cpp/smallExample.cpp b/cpp/smallExample.cpp index 6123c829e..1b2a12028 100644 --- a/cpp/smallExample.cpp +++ b/cpp/smallExample.cpp @@ -245,14 +245,14 @@ LinearFactorGraph createSmoother(int T) { ExampleNonlinearFactorGraph nlfg; VectorConfig poses; - // prior on x0 - Vector x0 = zero(2); - string key0 = symbol('x', 0); - shared prior(new Point2Prior(x0, 1, key0)); + // prior on x1 + Vector x1 = zero(2); + string key1 = symbol('x', 1); + shared prior(new Point2Prior(x1, 1, key1)); nlfg.push_back(prior); - poses.insert(key0, x0); + poses.insert(key1, x1); - for (int t = 1; t <= T; t++) { + for (int t = 2; t <= T; t++) { // odometry between x_t and x_{t-1} Vector odo = Vector_(2, 1.0, 0.0); string key = symbol('x', t); diff --git a/cpp/testLinearFactorGraph.cpp b/cpp/testLinearFactorGraph.cpp index bb9d40747..549aa36d2 100644 --- a/cpp/testLinearFactorGraph.cpp +++ b/cpp/testLinearFactorGraph.cpp @@ -510,9 +510,9 @@ TEST( LinearFactorGraph, findAndRemoveFactors_twice ) /* ************************************************************************* */ TEST(timeLinearFactorGraph, createSmoother) { - LinearFactorGraph fg1 = createSmoother(1); + LinearFactorGraph fg1 = createSmoother(2); LONGS_EQUAL(3,fg1.size()); - LinearFactorGraph fg2 = createSmoother(2); + LinearFactorGraph fg2 = createSmoother(3); LONGS_EQUAL(5,fg2.size()); } diff --git a/cpp/timeLinearFactorGraph.cpp b/cpp/timeLinearFactorGraph.cpp index c91dd705a..19e54fe3e 100644 --- a/cpp/timeLinearFactorGraph.cpp +++ b/cpp/timeLinearFactorGraph.cpp @@ -16,7 +16,7 @@ using namespace gtsam; double timeKalmanSmoother(int T) { LinearFactorGraph smoother = createSmoother(T); Ordering ordering; - for (int t = 0; t <= T; t++) ordering.push_back(symbol('x',t)); + for (int t = 1; t <= T; t++) ordering.push_back(symbol('x',t)); clock_t start = clock(); smoother.optimize(ordering); clock_t end = clock ();