gtsam
Loading...
Searching...
No Matches
DopplerFactor.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
17#pragma once
18
19#include <gtsam/base/std_optional_serialization.h>
24
25#include <string>
26
27namespace gtsam {
28
61class GTSAM_EXPORT DopplerFactor
62 : public NoiseModelFactorT<Vector1, Vector3, double, double> {
63 private:
65
66 double measRangeRate_ = 0.0;
67 Point3 satVel_{0, 0, 0};
68 Point3 los_{0, 0, 0};
69 double satClkDrift_ = 0.0;
70 double dt_ = 1.0;
71 Point3 velSagnac_{0, 0, 0};
72 double sagnacOffset_ = 0.0;
73
74 public:
76 typedef std::shared_ptr<DopplerFactor> shared_ptr;
77 typedef DopplerFactor This;
78
80 DopplerFactor() = default;
81 virtual ~DopplerFactor() = default;
82
96 DopplerFactor(Key velocityKey, Key clockBiasPrevKey, Key clockBiasCurrKey,
97 double measuredDoppler, double wavelength,
98 const Point3& satellitePosition,
99 const Point3& satelliteVelocity, const Point3& receiverPosition,
100 double dt, double satelliteClockDrift = 0.0,
102
103 gtsam::NonlinearFactor::shared_ptr clone() const override {
104 return std::static_pointer_cast<gtsam::NonlinearFactor>(
105 gtsam::NonlinearFactor::shared_ptr(new This(*this)));
106 }
107
109 void print(const std::string& s = "", const KeyFormatter& keyFormatter =
110 DefaultKeyFormatter) const override;
112 bool equals(const NonlinearFactor& expected,
113 double tol = 1e-9) const override;
114
116 Vector1 evaluateError(const Vector3& velocity, const double& clockBiasPrev,
117 const double& clockBiasCurr,
118 OptionalMatrixType Hvelocity,
119 OptionalMatrixType HclockBiasPrev,
120 OptionalMatrixType HclockBiasCurr) const override;
121
123 inline double measuredRangeRate() const { return measRangeRate_; }
125 inline const Point3& lineOfSight() const { return los_; }
127 inline double dt() const { return dt_; }
128
129 private:
130#if GTSAM_ENABLE_BOOST_SERIALIZATION
131 friend class boost::serialization::access;
132 template <class ARCHIVE>
133 void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
134 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
135 ar& BOOST_SERIALIZATION_NVP(measRangeRate_);
136 ar& BOOST_SERIALIZATION_NVP(satVel_);
137 ar& BOOST_SERIALIZATION_NVP(los_);
138 ar& BOOST_SERIALIZATION_NVP(satClkDrift_);
139 ar& BOOST_SERIALIZATION_NVP(dt_);
140 ar& BOOST_SERIALIZATION_NVP(velSagnac_);
141 ar& BOOST_SERIALIZATION_NVP(sagnacOffset_);
142 }
143#endif
144};
145
147template <>
148struct traits<DopplerFactor> : public Testable<DopplerFactor> {};
149
173class GTSAM_EXPORT DopplerFactorArm
174 : public NoiseModelFactorN<Pose3, Vector3, double, double> {
175 private:
177
178 double measRangeRate_ = 0.0;
179 Point3 satVel_{0, 0, 0};
180 Point3 los_{0, 0, 0};
181 double satClkDrift_ = 0.0;
182 double dt_ = 1.0;
183 Point3 velSagnac_{0, 0, 0};
184 double sagnacOffset_ = 0.0;
185 gnss::LeverArm arm_;
186 Point3 leverVel_{0, 0, 0};
187
188 public:
190 typedef std::shared_ptr<DopplerFactorArm> shared_ptr;
191 typedef DopplerFactorArm This;
192
194 DopplerFactorArm() = default;
195 virtual ~DopplerFactorArm() = default;
196
215 DopplerFactorArm(Key poseKey, Key velocityKey, Key clockBiasPrevKey,
216 Key clockBiasCurrKey, double measuredDoppler,
217 double wavelength, const Point3& satellitePosition,
218 const Point3& satelliteVelocity,
219 const Point3& receiverPosition, const Point3& leverArm,
220 const Point3& angularVelocity, double dt,
221 double satelliteClockDrift = 0.0,
223
226 DopplerFactorArm(Key poseKey, Key velocityKey, Key clockBiasPrevKey,
227 Key clockBiasCurrKey, double measuredDoppler,
228 double wavelength, const Point3& satellitePosition,
229 const Point3& satelliteVelocity,
230 const Point3& receiverPosition, const Point3& leverArm,
231 const Pose3& ecef_T_nav, const Point3& angularVelocity,
232 double dt, double satelliteClockDrift = 0.0,
234
235 gtsam::NonlinearFactor::shared_ptr clone() const override {
236 return std::static_pointer_cast<gtsam::NonlinearFactor>(
237 gtsam::NonlinearFactor::shared_ptr(new This(*this)));
238 }
239
241 void print(const std::string& s = "", const KeyFormatter& keyFormatter =
242 DefaultKeyFormatter) const override;
244 bool equals(const NonlinearFactor& expected,
245 double tol = 1e-9) const override;
246
248 Vector evaluateError(const Pose3& pose, const Vector3& velocity,
249 const double& clockBiasPrev, const double& clockBiasCurr,
250 OptionalMatrixType Hpose, OptionalMatrixType Hvelocity,
251 OptionalMatrixType HclockBiasPrev,
252 OptionalMatrixType HclockBiasCurr) const override;
253
255 inline double measuredRangeRate() const { return measRangeRate_; }
257 inline const Point3& lineOfSight() const { return los_; }
259 inline double dt() const { return dt_; }
261 inline const Point3& leverArm() const { return arm_.b; }
263 inline const std::optional<Pose3>& ecefTnav() const {
264 return arm_.ecef_T_nav;
265 }
266
267 private:
268#if GTSAM_ENABLE_BOOST_SERIALIZATION
269 friend class boost::serialization::access;
270 template <class ARCHIVE>
271 void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
272 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
273 ar& BOOST_SERIALIZATION_NVP(measRangeRate_);
274 ar& BOOST_SERIALIZATION_NVP(satVel_);
275 ar& BOOST_SERIALIZATION_NVP(los_);
276 ar& BOOST_SERIALIZATION_NVP(satClkDrift_);
277 ar& BOOST_SERIALIZATION_NVP(dt_);
278 ar& BOOST_SERIALIZATION_NVP(velSagnac_);
279 ar& BOOST_SERIALIZATION_NVP(sagnacOffset_);
280 ar& boost::serialization::make_nvp("bL_", arm_.b);
281 ar& boost::serialization::make_nvp("ecef_T_nav_", arm_.ecef_T_nav);
282 ar& BOOST_SERIALIZATION_NVP(leverVel_);
283 }
284#endif
285};
286
288template <>
289struct traits<DopplerFactorArm> : public Testable<DopplerFactorArm> {};
290
291} // namespace gtsam
3D Point
Shared constants and utilities for GNSS factors.
Base class for noise model factors with N variables.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
NoiseModelFactorT< Vector, ValueTypes... > NoiseModelFactorN
Noise model factor with N value types and dynamic-sized error vector.
Definition NoiseModelFactorN.h:561
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Template to create a binary predicate.
Definition Testable.h:112
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
static shared_ptr Create(size_t dim)
Create a unit covariance noise model.
Definition NoiseModel.h:673
GNSS Doppler (range-rate) factor.
Definition DopplerFactor.h:62
double dt() const
Epoch interval t_k - t_{k-1} [s].
Definition DopplerFactor.h:127
const Point3 & lineOfSight() const
Unit line-of-sight vector (receiver -> satellite).
Definition DopplerFactor.h:125
DopplerFactor()=default
default constructor - only use for serialization
gtsam::NonlinearFactor::shared_ptr clone() const override
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
Definition DopplerFactor.h:103
double measuredRangeRate() const
Measured range rate (= -lambda * Doppler) [m/s].
Definition DopplerFactor.h:123
DopplerFactor with a kinematic lever-arm correction, keyed on a body Pose3.
Definition DopplerFactor.h:174
gtsam::NonlinearFactor::shared_ptr clone() const override
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
Definition DopplerFactor.h:235
const Point3 & leverArm() const
Lever arm in the body frame [m].
Definition DopplerFactor.h:261
double dt() const
Epoch interval t_k - t_{k-1} [s].
Definition DopplerFactor.h:259
const Point3 & lineOfSight() const
Unit line-of-sight vector (receiver -> satellite).
Definition DopplerFactor.h:257
const std::optional< Pose3 > & ecefTnav() const
Optional ECEF-from-nav transform.
Definition DopplerFactor.h:263
double measuredRangeRate() const
Measured range rate (= -lambda * Doppler) [m/s].
Definition DopplerFactor.h:255
DopplerFactorArm()=default
default constructor - only use for serialization
Lever-arm helper for GNSS factors that key on a body Pose3.
Definition GnssCommon.h:119
Point3 b
Lever arm in body frame [m].
Definition GnssCommon.h:120
std::optional< Pose3 > ecef_T_nav
Optional ECEF-from-nav transform.
Definition GnssCommon.h:121
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual Vector1 evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Nonlinear factor base class.
Definition NonlinearFactor.h:70