ImuBias.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 
18 #pragma once
19 
21 #include <gtsam/base/VectorSpace.h>
22 #include <iosfwd>
23 #include <boost/serialization/nvp.hpp>
24 
25 namespace gtsam {
26 
28 namespace imuBias {
29 
30 class GTSAM_EXPORT ConstantBias {
31 private:
34 
35 public:
37  static const size_t dimension = 6;
38 
40  biasAcc_(0.0, 0.0, 0.0), biasGyro_(0.0, 0.0, 0.0) {
41  }
42 
43  ConstantBias(const Vector3& biasAcc, const Vector3& biasGyro) :
44  biasAcc_(biasAcc), biasGyro_(biasGyro) {
45  }
46 
47  explicit ConstantBias(const Vector6& v) :
48  biasAcc_(v.head<3>()), biasGyro_(v.tail<3>()) {
49  }
50 
52  Vector6 vector() const {
53  Vector6 v;
54  v << biasAcc_, biasGyro_;
55  return v;
56  }
57 
59  const Vector3& accelerometer() const {
60  return biasAcc_;
61  }
62 
64  const Vector3& gyroscope() const {
65  return biasGyro_;
66  }
67 
70  OptionalJacobian<3, 6> H1 = boost::none,
71  OptionalJacobian<3, 3> H2 = boost::none) const {
72  if (H1) (*H1) << -I_3x3, Z_3x3;
73  if (H2) (*H2) << I_3x3;
74  return measurement - biasAcc_;
75  }
76 
79  OptionalJacobian<3, 6> H1 = boost::none,
80  OptionalJacobian<3, 3> H2 = boost::none) const {
81  if (H1) (*H1) << Z_3x3, -I_3x3;
82  if (H2) (*H2) << I_3x3;
83  return measurement - biasGyro_;
84  }
85 
89 
91  GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
92  const ConstantBias& bias);
93 
95  void print(const std::string& s = "") const;
96 
98  inline bool equals(const ConstantBias& expected, double tol = 1e-5) const {
99  return equal_with_abs_tol(biasAcc_, expected.biasAcc_, tol)
100  && equal_with_abs_tol(biasGyro_, expected.biasGyro_, tol);
101  }
102 
106 
109  return ConstantBias();
110  }
111 
113  inline ConstantBias operator-() const {
114  return ConstantBias(-biasAcc_, -biasGyro_);
115  }
116 
118  ConstantBias operator+(const Vector6& v) const {
119  return ConstantBias(biasAcc_ + v.head<3>(), biasGyro_ + v.tail<3>());
120  }
121 
124  return ConstantBias(biasAcc_ + b.biasAcc_, biasGyro_ + b.biasGyro_);
125  }
126 
129  return ConstantBias(biasAcc_ - b.biasAcc_, biasGyro_ - b.biasGyro_);
130  }
131 
133 
137  return -(*this);
138  }
140  return (*this) + q;
141  }
143  return q - (*this);
144  }
145  Vector6 localCoordinates(const ConstantBias& q) {
146  return between(q).vector();
147  }
148  ConstantBias retract(const Vector6& v) {
149  return compose(ConstantBias(v));
150  }
151  static Vector6 Logmap(const ConstantBias& p) {
152  return p.vector();
153  }
154  static ConstantBias Expmap(const Vector6& v) {
155  return ConstantBias(v);
156  }
158 
159 private:
160 
163 
165  friend class boost::serialization::access;
166  template<class ARCHIVE>
167  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
168  ar & BOOST_SERIALIZATION_NVP(biasAcc_);
169  ar & BOOST_SERIALIZATION_NVP(biasGyro_);
170  }
171 
172 
173 public:
176 
177 }; // ConstantBias class
178 } // namespace imuBias
179 
180 template<>
181 struct traits<imuBias::ConstantBias> : public internal::VectorSpace<
182  imuBias::ConstantBias> {
183 };
184 
185 } // namespace gtsam
186 
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
ConstantBias(const Vector6 &v)
Definition: ImuBias.h:47
ConstantBias(const Vector3 &biasAcc, const Vector3 &biasGyro)
Definition: ImuBias.h:43
ConstantBias operator-(const ConstantBias &b) const
Definition: ImuBias.h:128
ConstantBias operator+(const ConstantBias &b) const
Definition: ImuBias.h:123
Eigen::Vector3d Vector3
Definition: Vector.h:43
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
EIGEN_DEVICE_FUNC SegmentReturnType tail(Index n)
This is the const version of tail(Index).
Definition: BlockMethods.h:949
Matrix expected
Definition: testMatrix.cpp:974
static Vector6 Logmap(const ConstantBias &p)
Definition: ImuBias.h:151
ArrayXcf v
Definition: Cwise_arg.cpp:1
const Vector3 & accelerometer() const
Definition: ImuBias.h:59
double measurement(10.0)
void serialize(ARCHIVE &ar, const unsigned int)
Definition: ImuBias.h:167
Vector3 biasGyro_
The units for stddev are σ = rad/s or rad √Hz/s.
Definition: ImuBias.h:33
ConstantBias compose(const ConstantBias &q)
Definition: ImuBias.h:139
std::ostream & operator<<(std::ostream &os, const ConstantBias &bias)
ostream operator
Definition: ImuBias.cpp:68
Vector3 biasAcc_
The units for stddev are σ = m/s² or m √Hz/s²
Definition: ImuBias.h:32
ConstantBias retract(const Vector6 &v)
Definition: ImuBias.h:148
ConstantBias operator+(const Vector6 &v) const
Definition: ImuBias.h:118
static ConstantBias identity()
Definition: ImuBias.h:108
Vector3 correctAccelerometer(const Vector3 &measurement, OptionalJacobian< 3, 6 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
Definition: ImuBias.h:69
bool equals(const ConstantBias &expected, double tol=1e-5) const
Definition: ImuBias.h:98
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
EIGEN_DEVICE_FUNC const Scalar & q
Vector6 vector() const
Definition: ImuBias.h:52
Vector6 localCoordinates(const ConstantBias &q)
Definition: ImuBias.h:145
Point3 bias(10,-10, 50)
const G & b
Definition: Group.h:83
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
Definition: base/Matrix.h:84
const Vector3 & gyroscope() const
Definition: ImuBias.h:64
traits
Definition: chartTesting.h:28
ofstream os("timeSchurFactors.csv")
EIGEN_DEVICE_FUNC SegmentReturnType head(Index n)
This is the const version of head(Index).
Definition: BlockMethods.h:919
Expression< T > compose(const Expression< T > &t1, const Expression< T > &t2)
ConstantBias between(const ConstantBias &q)
Definition: ImuBias.h:142
float * p
static ConstantBias Expmap(const Vector6 &v)
Definition: ImuBias.h:154
Vector3 correctGyroscope(const Vector3 &measurement, OptionalJacobian< 3, 6 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
Definition: ImuBias.h:78
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
Definition: types.h:269
ConstantBias inverse()
Definition: ImuBias.h:136
Special class for optional Jacobian arguments.
const G double tol
Definition: Group.h:83
Expression< T > between(const Expression< T > &t1, const Expression< T > &t2)
ConstantBias operator-() const
Definition: ImuBias.h:113


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:12