From b14094cb1f916a033567a1bb34707d1a1000c9e2 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Fri, 18 Dec 2009 07:15:19 +0000 Subject: [PATCH] testUrbanOdometry --- .cproject | 52 ++++++++++++++++++++++++--------------- cpp/Makefile.am | 6 +++-- cpp/UrbanOdometry.h | 11 +++------ cpp/testUrbanOdometry.cpp | 38 ++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 30 deletions(-) create mode 100644 cpp/testUrbanOdometry.cpp diff --git a/.cproject b/.cproject index 18ea618c7..aa3eba21d 100644 --- a/.cproject +++ b/.cproject @@ -300,6 +300,7 @@ make + install true true @@ -307,6 +308,7 @@ make + check true true @@ -322,6 +324,7 @@ make + testSimpleCamera.run true true @@ -337,7 +340,6 @@ make - testVSLAMFactor.run true true @@ -345,6 +347,7 @@ make + testCalibratedCamera.run true true @@ -352,7 +355,6 @@ make - testGaussianConditional.run true true @@ -360,6 +362,7 @@ make + testPose2.run true true @@ -367,6 +370,7 @@ make + testRot3.run true true @@ -374,7 +378,6 @@ make - testNonlinearOptimizer.run true true @@ -382,6 +385,7 @@ make + testGaussianFactor.run true true @@ -389,6 +393,7 @@ make + testGaussianFactorGraph.run true true @@ -396,7 +401,6 @@ make - testNonlinearFactorGraph.run true true @@ -404,6 +408,7 @@ make + testPose3.run true true @@ -411,7 +416,6 @@ make - testVectorConfig.run true true @@ -419,7 +423,6 @@ make - testPoint2.run true true @@ -427,6 +430,7 @@ make + testNonlinearFactor.run true true @@ -434,6 +438,7 @@ make + timeGaussianFactor.run true true @@ -441,6 +446,7 @@ make + timeGaussianFactorGraph.run true true @@ -448,6 +454,7 @@ make + testGaussianBayesNet.run true true @@ -455,7 +462,6 @@ make - testBayesTree.run true false @@ -463,6 +469,7 @@ make + testSymbolicBayesNet.run true false @@ -470,7 +477,6 @@ make - testSymbolicFactorGraph.run true false @@ -478,6 +484,7 @@ make + testVector.run true true @@ -485,6 +492,7 @@ make + testMatrix.run true true @@ -492,7 +500,6 @@ make - testVSLAMGraph.run true true @@ -500,7 +507,6 @@ make - testNonlinearEquality.run true true @@ -508,6 +514,7 @@ make + testSQP.run true true @@ -515,7 +522,6 @@ make - testNonlinearConstraint.run true true @@ -523,6 +529,7 @@ make + testSQPOptimizer.run true true @@ -530,6 +537,7 @@ make + testVSLAMConfig.run true true @@ -537,6 +545,7 @@ make + testControlConfig.run true true @@ -544,6 +553,7 @@ make + testControlPoint.run true true @@ -551,7 +561,6 @@ make - testControlGraph.run true true @@ -559,6 +568,7 @@ make + testOrdering.run true true @@ -566,7 +576,6 @@ make - testPose2Constraint.run true true @@ -574,6 +583,7 @@ make + testRot2.run true true @@ -581,6 +591,7 @@ make + testGaussianBayesTree.run true true @@ -588,7 +599,6 @@ make - testPose3Factor.run true true @@ -596,7 +606,6 @@ make - testUrbanGraph.run true true @@ -604,7 +613,6 @@ make - testUrbanConfig.run true true @@ -612,15 +620,21 @@ make - testUrbanMeasurement.run true true true + +make + +testUrbanOdometry.run +true +true +true + make - install true true @@ -628,7 +642,6 @@ make - clean true true @@ -636,7 +649,6 @@ make - check true true diff --git a/cpp/Makefile.am b/cpp/Makefile.am index 487fdffe5..93a09560f 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -189,12 +189,14 @@ testPose3Factor_SOURCES = $(example) testPose3Factor.cpp testPose3Factor_LDADD = libgtsam.la # Urban -sources += UrbanFactor.cpp UrbanConfig.cpp UrbanMeasurement.cpp UrbanGraph.cpp -check_PROGRAMS += testUrbanConfig testUrbanMeasurement testUrbanGraph +sources += UrbanFactor.cpp UrbanConfig.cpp UrbanMeasurement.cpp UrbanOdometry.cpp UrbanGraph.cpp +check_PROGRAMS += testUrbanConfig testUrbanMeasurement testUrbanOdometry testUrbanGraph testUrbanConfig_SOURCES = $(example) testUrbanConfig.cpp testUrbanConfig_LDADD = libgtsam.la testUrbanMeasurement_SOURCES = $(example) testUrbanMeasurement.cpp testUrbanMeasurement_LDADD = libgtsam.la +testUrbanOdometry_SOURCES = $(example) testUrbanOdometry.cpp +testUrbanOdometry_LDADD = libgtsam.la testUrbanGraph_SOURCES = $(example) testUrbanGraph.cpp testUrbanGraph_LDADD = libgtsam.la diff --git a/cpp/UrbanOdometry.h b/cpp/UrbanOdometry.h index 8a329c496..c3acbba50 100644 --- a/cpp/UrbanOdometry.h +++ b/cpp/UrbanOdometry.h @@ -7,13 +7,6 @@ #pragma once -/* -#include -#include "NonlinearFactor.h" -#include "GaussianFactor.h" -#include "VectorConfig.h" -#include "Pose3.h" -*/ #include "UrbanFactor.h" namespace gtsam { @@ -42,7 +35,7 @@ namespace gtsam { std::cout << "key1 " << key1_ << std::endl; std::cout << "key2 " << key2_ << std::endl; gtsam::print(z_,"measured "); - gtsam::print(square_root_inverse_covariance_, "MeasurementCovariance"); + gtsam::print(square_root_inverse_covariance_, "square_root_inverse_covariance"); } bool equals(const NonlinearFactor& expected, double tol) const { @@ -56,6 +49,8 @@ namespace gtsam { std::list keys() const { std::list l; + l.push_back(key1_); + l.push_back(key2_); return l; } diff --git a/cpp/testUrbanOdometry.cpp b/cpp/testUrbanOdometry.cpp new file mode 100644 index 000000000..12b7ef0b4 --- /dev/null +++ b/cpp/testUrbanOdometry.cpp @@ -0,0 +1,38 @@ +/** + * @file testUrbanOdometry.cpp + * @brief Unit tests for UrbanOdometry Class + * @authors Frank Dellaert, Viorela Ila + **/ + +/*STL/C++*/ +#include + +#include +using namespace boost::assign; + +#include +#include "UrbanOdometry.h" +#include "Pose2Graph.h" + +using namespace std; +using namespace gtsam; + + +TEST( UrbanOdometry, constructor ) +{ + string key1 = "x1", key2 = "x2"; + Vector measured = zero(6); + Matrix measurement_covariance = eye(6); + UrbanOdometry factor(key1, key2, measured, measurement_covariance); + list expected; + expected += "x1","x2"; + CHECK(factor.keys()==expected); +} + + +/* ************************************************************************* */ +int main() { + TestResult tr; + return TestRegistry::runAllTests(tr); +} +/* ************************************************************************* */