Go to the documentation of this file.
36 using namespace gtsam;
40 static const double tol = 1
e-5;
97 Pose2 value(2.0, 1.0, 2.0), wrong(2.0, 3.0, 4.0);
127 Values feasible, bad_linearize;
135 Vector actual = nle->unwhitenedError(feasible);
138 actual = nle->unwhitenedError(bad_linearize);
140 assert_equal(actual, Vector::Constant(3, std::numeric_limits<double>::infinity())));
154 EXPECT(nle1->equals(*nle2));
156 EXPECT(nle2->equals(*nle1));
158 EXPECT(!nle1->equals(*nle3));
165 Pose2 feasible1(1.0, 2.0, 3.0);
166 double error_gain = 500.0;
170 Pose2 badPoint1(0.0, 2.0, 3.0);
178 double actError = nle.
error(config);
194 Pose2 feasible1(1.0, 2.0, 3.0);
195 double error_gain = 500.0;
202 Pose2 initPose(0.0, 2.0, 3.0);
222 Pose2 feasible1(1.0, 2.0, 3.0);
226 Pose2 initPose(0.0, 2.0, 3.0);
230 double error_gain = 500.0;
253 TEST( testNonlinearEqualityConstraint, unary_basics ) {
278 TEST( testNonlinearEqualityConstraint, unary_linearization ) {
301 TEST( testNonlinearEqualityConstraint, unary_simple_optimization ) {
304 Point2 truth_pt(1.0, 2.0);
310 Point2 badPt(100.0, -200.0);
322 EXPECT(constraint->active(initValues));
334 TEST( testNonlinearEqualityConstraint, odo_basics ) {
335 Point2 x1(1.0, 2.0),
x2(2.0, 3.0), odom(1.0, 1.0);
362 TEST( testNonlinearEqualityConstraint, odo_linearization ) {
363 Point2 x1(1.0, 2.0),
x2(2.0, 3.0), odom(1.0, 1.0);
390 TEST( testNonlinearEqualityConstraint, odo_simple_optimize ) {
394 Point2 truth_pt1(1.0, 2.0), truth_pt2(3.0, 2.0);
402 Point2 badPt(100.0, -200.0);
427 TEST (testNonlinearEqualityConstraint, two_pose ) {
438 Point2 pt_x1(1.0, 1.0), pt_x2(5.0, 6.0);
453 initialEstimate.insert(
x2,
Point2(0,0));
454 initialEstimate.insert(
l1,
Point2(1.0, 6.0));
455 initialEstimate.insert(
l2,
Point2(-4.0, 0.0));
469 TEST (testNonlinearEqualityConstraint, map_warp ) {
497 initialEstimate.insert(
l1,
Point2(1.0, 6.0));
498 initialEstimate.insert(
l2,
Point2(-4.0, 0.0));
499 initialEstimate.insert(
x2,
Point2(0.0, 0.0));
514 TEST (testNonlinearEqualityConstraint, stereo_constrained ) {
517 static double fov = 60;
518 static int w = 640,
h = 480;
520 static std::shared_ptr<Cal3_S2> shK(
new Cal3_S2(
K));
534 Symbol key_x1(
'x', 1), key_x2(
'x', 2);
535 Symbol key_l1(
'l', 1), key_l2(
'l', 2);
559 initValues.
insert(key_x1, poseLeft);
560 initValues.
insert(key_x2, poseRight);
569 truthValues.
insert(key_x1, leftCamera.
pose());
570 truthValues.
insert(key_x2, rightCamera.
pose());
const Symbol key1('v', 1)
static int runAllTests(TestResult &result)
NonlinearEquality< Pose2 > PoseNLE
std::shared_ptr< BetweenConstraint< VALUE > > shared_ptr
#define CHECK_EXCEPTION(condition, exception_name)
virtual const Values & optimize()
std::shared_ptr< GenericPrior< VALUE > > shared_ptr
Reprojection of a LANDMARK to a 2D point.
static SharedDiagonal hard_model
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double error(const Values &c) const override
#define EXPECT(condition)
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
The most common 5DOF 3D->2D calibration.
PriorFactor< Pose2 > PosePrior
static Symbol key('x', 1)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
iq2D::PoseXInequality constraint1(key, 1.0, true, mu)
static const Point3 pt(1.0, 2.0, 3.0)
Chordal Bayes Net, the result of eliminating a factor graph.
virtual bool active(const Values &) const
Vector unwhitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const override
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a 3D point from world coordinates into the image
Point2 landmark2(7.0, 1.5)
std::shared_ptr< NonlinearEquality1< VALUE > > shared_ptr
fixed value for variable
static const double sigma
This is the base class for all measurement types.
std::shared_ptr< GaussianFactor > linearize(const Values &x) const override
Point2 landmark1(5.0, 1.5)
const Symbol key2('v', 2)
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
#define DOUBLES_EQUAL(expected, actual, threshold)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
double error(const Values &c) const override
Actual error function calculation.
noiseModel::Diagonal::shared_ptr SharedDiagonal
const Pose3 & pose() const
return pose
static Point3 landmark(0, 0, 5)
Base class for all pinhole cameras.
noiseModel::Base::shared_ptr SharedNoiseModel
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
noiseModel::Diagonal::shared_ptr model
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
static enum @1096 ordering
Vector evaluateError(const T &xj, OptionalMatrixType H) const override
Error function.
Vector evaluateError(const X &x1, OptionalMatrixType H) const override
g(x) with optional derivative
static const Pose3 pose1(Rot3(), Point3(0, 1, 0.5))
Vector evaluateError(const T &p1, const T &p2, OptionalMatrixType H1, OptionalMatrixType H2) const override
evaluate error, returns vector of errors size of tangent space
Factor Graph consisting of non-linear factors.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
TEST(NonlinearEquality, linearization)
void insert(Key j, const Value &val)
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
The most common 5DOF 3D->2D calibration.
static SharedDiagonal soft_model
GaussianFactor::shared_ptr linearize(const Values &x) const override
Linearize is over-written, because base linearization tries to whiten.
NonlinearFactorGraph graph
iq2D::PoseYInequality constraint2(key, 2.0, true, mu)
std::shared_ptr< PoseNLE > shared_poseNLE
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
measurement functions and constraint definitions for simulated 2D robot
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:08:01