52 measured_(measured), nM_(scale * direction), bias_(bias) {
56 virtual NonlinearFactor::shared_ptr
clone()
const {
58 NonlinearFactor::shared_ptr(
new MagFactor(*
this)));
62 boost::optional<Matrix&> HR = boost::none) {
66 Matrix H = HR->col(2);
76 boost::optional<Matrix&> H = boost::none)
const {
78 Point3 hx = unrotate(nRb, nM_, H) + bias_;
79 return (hx - measured_);
101 measured_(measured), nM_(scale * direction), bias_(bias) {
105 virtual NonlinearFactor::shared_ptr
clone()
const {
107 NonlinearFactor::shared_ptr(
new MagFactor1(*
this)));
114 boost::optional<Matrix&> H = boost::none)
const {
117 return (hx - measured_);
137 measured_(measured), bRn_(nRb.inverse()) {
141 virtual NonlinearFactor::shared_ptr
clone()
const {
143 NonlinearFactor::shared_ptr(
new MagFactor2(*
this)));
152 boost::optional<Matrix&> H1 = boost::none, boost::optional<Matrix&> H2 =
158 return (hx - measured_);
178 measured_(measured), bRn_(nRb.inverse()) {
182 virtual NonlinearFactor::shared_ptr
clone()
const {
184 NonlinearFactor::shared_ptr(
new MagFactor3(*
this)));
193 const Point3& bias, boost::optional<Matrix&> H1 = boost::none,
194 boost::optional<Matrix&> H2 = boost::none, boost::optional<Matrix&> H3 =
197 Unit3 rotated = bRn_.
rotate(direction, boost::none, H2);
205 *H2 = scale * H * (*H2);
209 return (hx - measured_);
Factor to estimate rotation given magnetometer reading This version uses model measured bM = scale * ...
Definition: MagFactor.h:88
Nonlinear factor base class.
Definition: NonlinearFactor.h:52
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
A convenient base class for creating your own NoiseModelFactor with 3 variables.
Definition: NonlinearFactor.h:420
virtual NonlinearFactor::shared_ptr clone() const
Definition: MagFactor.h:141
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:1072
Factor to estimate rotation given magnetometer reading This version uses model measured bM = scale * ...
Definition: MagFactor.h:31
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from world to rotated frame
Definition: Rot3.cpp:134
Point3 rotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from rotated coordinate frame to world
Definition: Rot3M.cpp:120
Point3 point3(OptionalJacobian< 3, 2 > H=boost::none) const
Return unit-norm Point3.
Definition: Unit3.cpp:134
Factor to calibrate local Earth magnetic field as well as magnetometer bias This version uses model m...
Definition: MagFactor.h:167
static Rot3 Yaw(double t)
Positive yaw is to right (as in aircraft heading). See ypr.
Definition: Rot3.h:150
A convenient base class for creating your own NoiseModelFactor with 2 variables.
Definition: NonlinearFactor.h:345
MagFactor(Key key, const Point3 &measured, double scale, const Unit3 &direction, const Point3 &bias, const SharedNoiseModel &model)
Constructor of factor that estimates nav to body rotation bRn.
Definition: MagFactor.h:48
3D rotation represented as a rotation matrix or quaternion
Vector evaluateError(const Point3 &nM, const Point3 &bias, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
vector of errors
Definition: MagFactor.h:151
Vector evaluateError(const Rot3 &nRb, boost::optional< Matrix & > H=boost::none) const
vector of errors
Definition: MagFactor.h:113
virtual NonlinearFactor::shared_ptr clone() const
Definition: MagFactor.h:182
Factor to calibrate local Earth magnetic field as well as magnetometer bias This version uses model m...
Definition: MagFactor.h:126
Vector evaluateError(const Rot2 &nRb, boost::optional< Matrix & > H=boost::none) const
vector of errors
Definition: MagFactor.h:75
MagFactor2(Key key1, Key key2, const Point3 &measured, const Rot3 &nRb, const SharedNoiseModel &model)
Constructor.
Definition: MagFactor.h:134
double theta() const
return angle (RADIANS)
Definition: Rot2.h:173
A convenient base class for creating your own NoiseModelFactor with 1 variable.
Definition: NonlinearFactor.h:276
Vector evaluateError(const double &scale, const Unit3 &direction, const Point3 &bias, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none, boost::optional< Matrix & > H3=boost::none) const
vector of errors
Definition: MagFactor.h:192
Non-linear factor base classes.
MagFactor3(Key key1, Key key2, Key key3, const Point3 &measured, const Rot3 &nRb, const SharedNoiseModel &model)
Constructor.
Definition: MagFactor.h:175
virtual NonlinearFactor::shared_ptr clone() const
Definition: MagFactor.h:56
virtual NonlinearFactor::shared_ptr clone() const
Definition: MagFactor.h:105
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
MagFactor1(Key key, const Point3 &measured, double scale, const Unit3 &direction, const Point3 &bias, const SharedNoiseModel &model)
Constructor.
Definition: MagFactor.h:97
Global functions in a separate testing namespace.
Definition: chartTesting.h:28