30 using namespace gtsam;
37 static const double ms = 1
e-3;
38 static const double cm = 1
e-2;
57 const double height = 0.5;
58 vector<Point3> sensors;
59 sensors.push_back(
Point3(0, 0, height));
60 sensors.push_back(
Point3(403 *
cm, 0, height));
61 sensors.push_back(
Point3(403 *
cm, 403 *
cm, height));
62 sensors.push_back(
Point3(0, 403 *
cm, 2 * height));
67 const double timeOfEvent = 0;
68 Event groundTruthEvent(timeOfEvent, 245 *
cm, 201.5 *
cm, (212 - 45) *
cm);
71 size_t K = sensors.size();
72 vector<double> simulatedTOA(K);
74 for (
size_t i = 0;
i <
K;
i++) {
75 simulatedTOA[
i] = toa(groundTruthEvent, sensors[
i]);
81 for (
size_t i = 0;
i <
K;
i++) {
89 delta << 0.1, 0.1, -0.1, 0.1;
91 initialEstimate.insert(key, estimatedEvent);
const gtsam::Symbol key('X', 0)
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.
static const double timeOfEvent
const ValueType at(Key j) const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Some functions to compute numerical derivatives.
Event retract(const Vector4 &v) const
Updates a with tangent space delta.
NonlinearFactorGraph graph
static const SmartProjectionParams params
static Point2 measurement(323.0, 240.0)
Expression< Event > Event_
A "Time of Arrival" factor - so little code seems hardly worth it :-)
#define EXPECT(condition)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void setAbsoluteErrorTol(double value)
Expression< Point3 > Point3_
Time of arrival to given sensor.
static const Point3 sensorAt0(0, 0, 0)
#define EXPECT_LONGS_EQUAL(expected, actual)
static const Event exampleEvent(timeOfEvent, 1, 0, 0)
static SharedNoiseModel model(noiseModel::Isotropic::Sigma(1, 0.5 *ms))
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Base::shared_ptr SharedNoiseModel