27 using namespace gtsam;
29 static const double tol = 1
e-5;
47 TEST( testBoundingConstraint, unary_basics_inactive1 ) {
66 TEST( testBoundingConstraint, unary_basics_inactive2 ) {
85 TEST( testBoundingConstraint, unary_basics_active1 ) {
100 TEST( testBoundingConstraint, unary_basics_active2 ) {
115 TEST( testBoundingConstraint, unary_linearization_inactive) {
126 TEST( testBoundingConstraint, unary_linearization_active) {
139 TEST( testBoundingConstraint, unary_simple_optimization1) {
143 Point2 start_pt(0.0, 1.0);
152 initValues.
insert(x1, start_pt);
156 expected.
insert(x1, goal_pt);
161 TEST( testBoundingConstraint, unary_simple_optimization2) {
165 Point2 start_pt(2.0, 3.0);
173 initValues.
insert(key, start_pt);
177 expected.
insert(key, goal_pt);
182 TEST( testBoundingConstraint, MaxDistance_basics) {
184 Point2 pt1(0,0), pt2(1.0, 0.0),
pt3(2.0, 0.0), pt4(3.0, 0.0);
196 config1.
insert(key1, pt1);
221 TEST( testBoundingConstraint, MaxDistance_simple_optimization) {
223 Point2 pt1(0,0), pt2_init(5.0, 0.0), pt2_goal(2.0, 0.0);
232 initial_state.
insert(x1, pt1);
233 initial_state.
insert(x2, pt2_init);
237 expected.
insert(x2, pt2_goal);
245 TEST( testBoundingConstraint, avoid_demo) {
249 Point2 x1_pt(0,0), x2_init(2.0, 0.5), x2_goal(2.0, 1.0), x3_pt(4.0, 0.0), l1_pt(2.0, 0.0);
261 init.insert(x1, x1_pt);
262 init.insert(
x3, x3_pt);
263 init.insert(l1, l1_pt);
265 init.insert(x2, x2_init);
266 expected.insert(x2, x2_goal);
iq2D::PoseXInequality constraint1(key, 1.0, true, mu)
size_t dim() const override
virtual const Values & optimize()
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
static int runAllTests(TestResult &result)
Factor Graph consisting of non-linear factors.
Point2 odo(const Point2 &x1, const Point2 &x2)
odometry between two poses
iq2D::PoseYInequality constraint2(key, 2.0, true, mu)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
void update(Key j, const Value &val)
bool isGreaterThan() const
bool isGreaterThan() const
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
bool active(const Values &c) const override
NonlinearFactorGraph graph
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
SharedDiagonal hard_model1
SharedDiagonal soft_model2_alt
const Symbol key1('v', 1)
#define EXPECT(condition)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::shared_ptr< GaussianFactor > linearize(const Values &x) const override
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
Vector evaluateError(const X &x, OptionalMatrixType H) const override
noiseModel::Diagonal::shared_ptr SharedDiagonal
Vector unwhitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const override
double error(const Values &c) const override
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
iq2D::PoseYInequality constraint4(key, 2.0, false, mu)
iq2D::PoseXInequality constraint3(key, 1.0, false, mu)
SharedDiagonal soft_model2
void insert(Key j, const Value &val)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
bool active(const Values &c) const override
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
std::uint64_t Key
Integer nonlinear key type.
static Point3 pt3(1.0, 2.0, 3.0)
TEST(testBoundingConstraint, unary_basics_inactive1)
const Symbol key2('v', 2)
Vector evaluateError(const X1 &x1, const X2 &x2, OptionalMatrixType H1, OptionalMatrixType H2) const override
measurement functions and constraint definitions for simulated 2D robot