13 #error "This header is C++-only." 17 #include <Eigen/Geometry> 19 #include "flexkalman/AugmentedProcessModel.h" 20 #include "flexkalman/AugmentedState.h" 21 #include "flexkalman/BaseTypes.h" 22 #include "flexkalman/PoseState.h" 26 namespace types = flexkalman::types;
27 using flexkalman::types::Vector;
31 template <
typename State>
33 :
public flexkalman::MeasurementBase<WorldDirectionMeasurement<State>>
36 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 static constexpr
size_t Dimension = 3;
38 using MeasurementVector = types::Vector<Dimension>;
39 using MeasurementSquareMatrix = types::SquareMatrix<Dimension>;
41 types::Vector<3>
const &reference,
42 types::Vector<3>
const &variance)
43 : direction_(direction.normalized()),
44 reference_(reference.normalized()),
45 covariance_(variance.asDiagonal())
48 MeasurementSquareMatrix
const &
49 getCovariance(State
const & )
55 predictMeasurement(State
const &s)
const 57 return s.getCombinedQuaternion() * reference_;
61 getResidual(MeasurementVector
const &predictedMeasurement,
64 return predictedMeasurement - reference_;
68 getResidual(State
const &s)
const 70 return getResidual(predictMeasurement(s), s);
74 types::Vector<3> direction_;
75 types::Vector<3> reference_;
76 MeasurementSquareMatrix covariance_;
81 class LinAccelWithGravityMeasurement
82 :
public flexkalman::MeasurementBase<LinAccelWithGravityMeasurement>
85 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
86 static constexpr
size_t Dimension = 3;
87 using MeasurementVector = types::Vector<Dimension>;
88 using MeasurementSquareMatrix = types::SquareMatrix<Dimension>;
89 LinAccelWithGravityMeasurement(types::Vector<3>
const &direction,
90 types::Vector<3>
const &reference,
91 types::Vector<3>
const &variance)
92 : direction_(direction), reference_(reference),
93 covariance_(variance.asDiagonal())
97 MeasurementSquareMatrix
const &
98 getCovariance(State
const & )
105 predictMeasurement(State
const &s)
const 112 getResidual(MeasurementVector
const &predictedMeasurement,
113 State
const &s)
const 115 s.getQuaternion().conjugate() *
116 predictedMeasurement
return predictedMeasurement -
117 reference_.normalized();
120 template <
typename State>
122 getResidual(State
const &s)
const 124 MeasurementVector residual =
125 direction_ - reference_ * s.getQuaternion();
126 return getResidual(predictMeasurement(s), s);
130 types::Vector<3> direction_;
131 types::Vector<3> reference_;
132 MeasurementSquareMatrix covariance_;
137 :
public flexkalman::MeasurementBase<BiasedGyroMeasurement>
140 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
141 static constexpr
size_t Dimension = 3;
142 using MeasurementVector = types::Vector<Dimension>;
143 using MeasurementSquareMatrix = types::SquareMatrix<Dimension>;
145 types::Vector<3>
const &variance)
146 : angVel_(angVel), covariance_(variance.asDiagonal())
149 template <
typename State>
150 MeasurementSquareMatrix
const &
151 getCovariance(State
const & )
156 template <
typename State>
158 predictMeasurement(State
const &s)
const 160 return s.b().stateVector() + angVel_;
163 template <
typename State>
165 getResidual(MeasurementVector
const &predictedMeasurement,
166 State
const &s)
const 168 return predictedMeasurement - s.a().angularVelocity();
171 template <
typename State>
173 getResidual(State
const &s)
const 175 return getResidual(predictMeasurement(s), s);
179 types::Vector<3> angVel_;
180 MeasurementSquareMatrix covariance_;
187 :
public flexkalman::MeasurementBase<AbsolutePositionLeverArmMeasurement>
190 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
191 using State = flexkalman::pose_externalized_rotation::State;
192 static constexpr
size_t Dimension = 3;
193 using MeasurementVector = types::Vector<Dimension>;
194 using MeasurementSquareMatrix = types::SquareMatrix<Dimension>;
203 MeasurementVector
const &measurement,
204 MeasurementVector
const &knownLocationInBodySpace,
205 MeasurementVector
const &variance)
206 : measurement_(measurement),
207 knownLocationInBodySpace_(knownLocationInBodySpace),
208 covariance_(variance.asDiagonal())
211 MeasurementSquareMatrix
const &
212 getCovariance(State
const & )
218 predictMeasurement(State
const &s)
const 220 return s.getIsometry() * knownLocationInBodySpace_;
224 getResidual(MeasurementVector
const &predictedMeasurement,
225 State
const & )
const 227 return measurement_ - predictedMeasurement;
231 getResidual(State
const &s)
const 233 return getResidual(predictMeasurement(s), s);
237 MeasurementVector measurement_;
238 MeasurementVector knownLocationInBodySpace_;
239 MeasurementSquareMatrix covariance_;
For PS Move-like things, where there's a directly-computed absolute position that is not at the track...
Definition: t_fusion.hpp:186
For things like accelerometers, which on some level measure the local vector of a world direction...
Definition: t_fusion.hpp:32
AbsolutePositionLeverArmMeasurement(MeasurementVector const &measurement, MeasurementVector const &knownLocationInBodySpace, MeasurementVector const &variance)
Definition: t_fusion.hpp:202
Definition: t_fusion.hpp:25
Definition: t_fusion.hpp:136