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);
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);
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);
ScalarCoordConstraint1< Point2, 1 > PoseYInequality
Simulated2D domain example factor constraining Y.
iq2D::PoseXInequality constraint1(key, 1.0, true, mu)
NonlinearEquality1< Point2 > UnaryEqualityConstraint
boost::shared_ptr< GaussianFactor > linearize(const Values &x) const override
double error(const Values &c) const override
size_t dim() const override
virtual const Values & optimize()
NonlinearEquality1< Point2 > UnaryEqualityPointConstraint
static int runAllTests(TestResult &result)
Factor Graph consisting of non-linear factors.
void insert(Key j, const Value &val)
Point2 odo(const Point2 &x1, const Point2 &x2)
odometry between two poses
iq2D::PoseYInequality constraint2(key, 2.0, true, mu)
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)
bool isGreaterThan() const
SharedDiagonal hard_model1
const Symbol key1('v', 1)
SharedDiagonal soft_model2_alt
Vector unwhitenedError(const Values &x, boost::optional< std::vector< Matrix > & > H=boost::none) const override
Vector evaluateError(const X &x, boost::optional< Matrix & > H=boost::none) const override
#define EXPECT(condition)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
noiseModel::Diagonal::shared_ptr SharedDiagonal
GenericPrior< Point2 > Prior
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Vector evaluateError(const X1 &x1, const X2 &x2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const override
GenericOdometry< Point2 > Odometry
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
const Symbol key2('v', 2)
iq2D::PoseYInequality constraint4(key, 2.0, false, mu)
bool isGreaterThan() const
iq2D::PoseXInequality constraint3(key, 1.0, false, mu)
SharedDiagonal soft_model2
void update(Key j, const Value &val)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
bool active(const Values &c) const override
MinDistanceConstraint< Point2, Point2 > LandmarkAvoid
Simulated2D domain example factor.
ScalarCoordConstraint1< Point2, 0 > PoseXInequality
Simulated2D domain example factor constraining X.
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
MaxDistanceConstraint< Point2 > PoseMaxDistConstraint
Simulated2D domain example factor.
std::uint64_t Key
Integer nonlinear key type.
static Point3 pt3(1.0, 2.0, 3.0)
TEST(testBoundingConstraint, unary_basics_inactive1)
Vector unwhitenedError(const Values &x, boost::optional< std::vector< Matrix > & > H=boost::none) const override
measurement functions and constraint definitions for simulated 2D robot