32 using namespace boost;
34 using namespace gtsam;
62 Point2 local(2.0, 3.0), global(-1.0, 2.0);
66 Matrix actualDT, actualDL, actualDF;
67 tc.
evaluateError(global, trans, local, actualDF, actualDT, actualDL);
69 Matrix numericalDT, numericalDL, numericalDF;
70 numericalDF = numericalDerivative31<Vector,Point2,Pose2,Point2>(
71 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
72 global,
trans, local, 1
e-5);
73 numericalDT = numericalDerivative32<Vector,Point2,Pose2,Point2>(
74 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
75 global,
trans, local, 1
e-5);
76 numericalDL = numericalDerivative33<Vector,Point2,Pose2,Point2>(
77 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
78 global,
trans, local, 1
e-5);
98 Matrix actualDT, actualDL, actualDF;
99 tc.
evaluateError(global, trans, local, actualDF, actualDT, actualDL);
101 Matrix numericalDT, numericalDL, numericalDF;
102 numericalDF = numericalDerivative31<Vector,Point2,Pose2,Point2>(
103 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
104 global,
trans, local, 1
e-5);
105 numericalDT = numericalDerivative32<Vector,Point2,Pose2,Point2>(
106 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
107 global,
trans, local, 1
e-5);
108 numericalDL = numericalDerivative33<Vector,Point2,Pose2,Point2>(
109 std::bind(
evaluateError_, tc, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
110 global,
trans, local, 1
e-5);
121 Point2 local1(2.0, 2.0), local2(4.0, 5.0),
122 global1(-1.0, 5.0), global2(2.0, 3.0);
142 double error_gain = 1000.0;
150 init.insert(lA1, local1);
151 init.insert(lA2, local2);
152 init.insert(lB1, global1);
153 init.insert(lB2, global2);
154 init.insert(tA1, trans);
161 expected.
insert(lA1, local1);
162 expected.
insert(lA2, local2);
163 expected.
insert(lB1, global1);
164 expected.
insert(lB2, global2);
165 expected.
insert(tA1, transIdeal);
187 double error_gain = 1000.0;
194 init.insert(
lA1, local);
195 init.insert(lB1, global);
196 init.insert(tA1, trans);
223 double error_gain = 1000.0;
230 init.insert(lA1, local);
231 init.insert(lB1, global);
232 init.insert(tA1, trans);
GTSAM_EXPORT Point2 transformFrom(const Point2 &point, OptionalJacobian< 2, 3 > Dpose={}, OptionalJacobian< 2, 2 > Dpoint={}) const
virtual const Values & optimize()
gtsam::ReferenceFrameFactor< gtsam::Point2, gtsam::Pose2 > PointReferenceFrameFactor
Concept check for values that can be used in unit tests.
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.
const ValueType at(Key j) const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
BiCGSTAB< SparseMatrix< double > > solver
Some functions to compute numerical derivatives.
NonlinearFactorGraph graph
#define EXPECT(condition)
Eigen::Triplet< double > T
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Vector evaluateError(const Point &global, const Transform &trans, const Point &local, OptionalMatrixType Dforeign, OptionalMatrixType Dtrans, OptionalMatrixType Dlocal) const override
TEST(ReferenceFrameFactor, equals)
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
Vector evaluateError_(const PointReferenceFrameFactor &c, const Point2 &global, const Pose2 &trans, const Point2 &local)
void insert(Key j, const Value &val)
GTSAM_EXPORT Pose2 inverse() const
inverse
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
std::uint64_t Key
Integer nonlinear key type.
gtsam::ReferenceFrameFactor< gtsam::Pose2, gtsam::Pose2 > PoseReferenceFrameFactor