gtsam/gtsam_unstable/slam/TOAFactor.h

68 lines
2.2 KiB
C
Raw Normal View History

2014-12-11 05:50:41 +08:00
/* ----------------------------------------------------------------------------
2019-02-11 22:39:48 +08:00
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
2014-12-11 05:50:41 +08:00
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file TOAFactor.h
* @brief "Time of Arrival" factor
* @author Frank Dellaert
* @author Jay Chakravarty
* @date December 2014
*/
2020-03-18 02:34:11 +08:00
#pragma once
2016-04-11 10:01:14 +08:00
#include <gtsam/nonlinear/ExpressionFactor.h>
2014-12-11 05:50:41 +08:00
#include <gtsam_unstable/geometry/Event.h>
namespace gtsam {
/// A "Time of Arrival" factor - so little code seems hardly worth it :-)
2020-03-18 02:34:11 +08:00
class TOAFactor : public ExpressionFactor<double> {
2016-04-11 10:01:14 +08:00
typedef Expression<double> Double_;
2014-12-11 05:50:41 +08:00
2020-03-18 02:34:11 +08:00
public:
2014-12-11 05:50:41 +08:00
/**
2020-03-19 03:44:33 +08:00
* Most general constructor with two expressions
2020-03-18 02:34:11 +08:00
* @param eventExpression expression yielding an event
* @param sensorExpression expression yielding a sensor location
* @param toaMeasurement time of arrival at sensor
2014-12-11 05:50:41 +08:00
* @param model noise model
2020-03-19 03:44:33 +08:00
* @param speed optional speed of signal, in m/sec
2014-12-11 05:50:41 +08:00
*/
TOAFactor(const Expression<Event>& eventExpression,
2020-03-18 02:34:11 +08:00
const Expression<Point3>& sensorExpression, double toaMeasurement,
2020-03-19 03:44:33 +08:00
const SharedNoiseModel& model, double speed = 330)
2020-03-18 02:34:11 +08:00
: ExpressionFactor<double>(
model, toaMeasurement,
2020-03-19 03:44:33 +08:00
Double_(TimeOfArrival(speed), eventExpression, sensorExpression)) {}
2014-12-11 05:50:41 +08:00
2020-03-18 02:34:11 +08:00
/**
* Constructor with fixed sensor
* @param eventExpression expression yielding an event
* @param sensor a known sensor location
* @param toaMeasurement time of arrival at sensor
* @param model noise model
* @param toa optional time of arrival functor
*/
TOAFactor(const Expression<Event>& eventExpression, const Point3& sensor,
double toaMeasurement, const SharedNoiseModel& model,
2020-03-19 03:44:33 +08:00
double speed = 330)
2020-03-18 02:34:11 +08:00
: TOAFactor(eventExpression, Expression<Point3>(sensor), toaMeasurement,
2020-03-19 03:44:33 +08:00
model, speed) {}
static void InsertEvent(Key key, const Event& event,
boost::shared_ptr<Values> values) {
values->insert(key, event);
}
2014-12-11 05:50:41 +08:00
};
2020-03-18 02:34:11 +08:00
} // namespace gtsam