Put header-implemented unit test functions in anonymous namespaces to avoid duplicate symbols in SINGLE_TEST_EXE mode
parent
5ae4f21517
commit
14a71aeedc
|
@ -83,42 +83,43 @@ namespace simulated2D {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
/// Prior on a single pose
|
||||||
|
inline Point2 prior(const Point2& x) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
/// Prior on a single pose
|
/// Prior on a single pose, optionally returns derivative
|
||||||
inline Point2 prior(const Point2& x) {
|
Point2 prior(const Point2& x, boost::optional<Matrix&> H = boost::none) {
|
||||||
return x;
|
if (H) *H = gtsam::eye(2);
|
||||||
}
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
/// Prior on a single pose, optionally returns derivative
|
/// odometry between two poses
|
||||||
Point2 prior(const Point2& x, boost::optional<Matrix&> H = boost::none) {
|
inline Point2 odo(const Point2& x1, const Point2& x2) {
|
||||||
if (H) *H = gtsam::eye(2);
|
return x2 - x1;
|
||||||
return x;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// odometry between two poses
|
/// odometry between two poses, optionally returns derivative
|
||||||
inline Point2 odo(const Point2& x1, const Point2& x2) {
|
Point2 odo(const Point2& x1, const Point2& x2, boost::optional<Matrix&> H1 =
|
||||||
return x2 - x1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// odometry between two poses, optionally returns derivative
|
|
||||||
Point2 odo(const Point2& x1, const Point2& x2, boost::optional<Matrix&> H1 =
|
|
||||||
boost::none, boost::optional<Matrix&> H2 = boost::none) {
|
boost::none, boost::optional<Matrix&> H2 = boost::none) {
|
||||||
if (H1) *H1 = -gtsam::eye(2);
|
if (H1) *H1 = -gtsam::eye(2);
|
||||||
if (H2) *H2 = gtsam::eye(2);
|
if (H2) *H2 = gtsam::eye(2);
|
||||||
return x2 - x1;
|
return x2 - x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// measurement between landmark and pose
|
/// measurement between landmark and pose
|
||||||
inline Point2 mea(const Point2& x, const Point2& l) {
|
inline Point2 mea(const Point2& x, const Point2& l) {
|
||||||
return l - x;
|
return l - x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// measurement between landmark and pose, optionally returns derivative
|
/// measurement between landmark and pose, optionally returns derivative
|
||||||
Point2 mea(const Point2& x, const Point2& l, boost::optional<Matrix&> H1 =
|
Point2 mea(const Point2& x, const Point2& l, boost::optional<Matrix&> H1 =
|
||||||
boost::none, boost::optional<Matrix&> H2 = boost::none) {
|
boost::none, boost::optional<Matrix&> H2 = boost::none) {
|
||||||
if (H1) *H1 = -gtsam::eye(2);
|
if (H1) *H1 = -gtsam::eye(2);
|
||||||
if (H2) *H2 = gtsam::eye(2);
|
if (H2) *H2 = gtsam::eye(2);
|
||||||
return l - x;
|
return l - x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
namespace example {
|
namespace example {
|
||||||
|
namespace {
|
||||||
|
|
||||||
typedef NonlinearFactorGraph Graph;
|
typedef NonlinearFactorGraph Graph;
|
||||||
|
|
||||||
|
@ -150,13 +151,9 @@ Ordering planarOrdering(size_t N);
|
||||||
std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(
|
std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(
|
||||||
size_t N, const GaussianFactorGraph& original);
|
size_t N, const GaussianFactorGraph& original);
|
||||||
|
|
||||||
} // example
|
|
||||||
} // gtsam
|
|
||||||
|
|
||||||
|
|
||||||
// Implementations
|
// Implementations
|
||||||
namespace gtsam {
|
|
||||||
namespace example {
|
|
||||||
|
|
||||||
// using namespace gtsam::noiseModel;
|
// using namespace gtsam::noiseModel;
|
||||||
|
|
||||||
|
@ -649,5 +646,6 @@ std::pair<GaussianFactorGraph, GaussianFactorGraph > splitOffPlanarTree(size_t N
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
} // \namespace example
|
} // \namespace example
|
||||||
} // \namespace gtsam
|
} // \namespace gtsam
|
||||||
|
|
Loading…
Reference in New Issue