state-observation 1.7.0
General implementation of observers.
Loading...
Searching...
No Matches
model-base-ekf-flex-estimator-imu.hpp
Go to the documentation of this file.
1
12
13#ifndef FLEXBILITYESTMATOR_MODELBASEEKFFLEXIBILITYESTIMATOR_IMU_H
14#define FLEXBILITYESTMATOR_MODELBASEEKFFLEXIBILITYESTIMATOR_IMU_H
15
16#include <state-observation/api.h>
18// #include <state-observation/flexibility-estimation/stable-imu-fixed-contact-dynamical-system.hpp>
19#include <state-observation/flexibility-estimation/imu-elastic-local-frame-dynamical-system.hpp>
20// #include <state-observation/flexibility-estimation/imu-fixed-contact-dynamical-system.hpp>
21
22namespace stateObservation
23{
24namespace flexibilityEstimation
25{
26
37
38class STATE_OBSERVATION_DLLAPI ModelBaseEKFFlexEstimatorIMU : public EKFFlexibilityEstimatorBase,
39 private boost::noncopyable
40{
41public:
43 {
46 static const unsigned pendulum = IMUElasticLocalFrameDynamicalSystem::contactModel::pendulum;
47 };
48
50 explicit ModelBaseEKFFlexEstimatorIMU(double dt = 0.005);
51
54
56 void setContactsNumber(unsigned i);
57
58 unsigned getContactsNumber()
59 {
60 return functor_.getContactsNumber();
61 }
62
64 {
65 return functor_;
66 }
67
68 virtual stateObservation::Vector computeAccelerations()
69 {
70 return functor_.computeAccelerations(getFlexibilityVector(), getInput());
71 }
72
73 void setContactModel(unsigned nb);
74
76 virtual void setMeasurement(const Vector & y);
77
79 virtual void setProcessNoiseCovariance(const Matrix & Q);
80
82 virtual void setMeasurementNoiseCovariance(const Matrix & R);
83
86
89
90 virtual Vector getMomentaDotFromForces();
91 virtual Vector getMomentaDotFromKinematics();
92 virtual Vector getForcesAndMoments();
93
94 // get state covariance
95 stateObservation::Vector getStateCovariance() const
96 {
97 stateObservation::Matrix P(ekf_.getStateCovariance());
98 stateObservation::Vector Pvec(ekf_.getStateSize());
99 for(Index i = 0; i < ekf_.getStateSize(); ++i) Pvec(i) = P(i, i);
100 return Pvec;
101 }
102
103 virtual void setComBiasGuess(const stateObservation::Vector & x);
104
107 virtual void setFlexibilityGuess(const Matrix & x);
108
111
113 virtual const Vector & getFlexibilityVector();
114
115 virtual stateObservation::Matrix & computeLocalObservationMatrix();
116 virtual stateObservation::Matrix getAMatrix()
117 {
118 return ekf_.getA();
119 }
120
121 virtual stateObservation::Matrix getCMatrix()
122 {
123 return ekf_.getC();
124 }
125
126 virtual Index getMeasurementSize() const;
127
128 virtual Index getStateSize() const;
129
130 virtual Index getInputSize() const;
131
133 virtual void setWithForcesMeasurements(bool);
134
135 bool getWithForcesMeasurements();
136
137 virtual void setWithAbsolutePos(bool);
138
139 void setWithUnmodeledForces(bool b);
140
141 bool getWithUnmodeledForces()
142 {
143 return withUnmodeledForces_;
144 }
145
146 bool getWithAbsolutePos()
147 {
148 return withAbsolutePos_;
149 }
150
151 virtual void setWithComBias(bool b);
152
153 virtual bool getWithComBias()
154 {
155 return withComBias_;
156 }
157
158 virtual void setUnmodeledForceVariance(double d);
159 virtual void setUnmodeledForceProcessVariance(double d);
160
163 virtual void setForceVariance(double d);
164 virtual void setForceVariance(const Matrix3 & C);
165
166 virtual void setAbsolutePosVariance(double d);
167
169 virtual void setSamplingPeriod(double);
170
172 void setOn(bool & b);
173
174 virtual void setKfe(const Matrix3 & m);
175 virtual void setKfv(const Matrix3 & m);
176 virtual void setKte(const Matrix3 & m);
177 virtual void setKtv(const Matrix3 & m);
178
179 virtual void setKfeRopes(const Matrix3 & m);
180 virtual void setKfvRopes(const Matrix3 & m);
181 virtual void setKteRopes(const Matrix3 & m);
182 virtual void setKtvRopes(const Matrix3 & m);
183
184 virtual void setPe(const stateObservation::Vector3 & Pe)
185 {
186 functor_.setPe(Pe);
187 }
188
189 virtual Matrix getKfe() const;
190 virtual Matrix getKfv() const;
191 virtual Matrix getKte() const;
192 virtual Matrix getKtv() const;
193
196 virtual void resetStateCovarianceMatrix();
197
198 virtual void setRobotMass(double m);
199 virtual double getRobotMass() const
200 {
201 return functor_.getRobotMass();
202 }
203
204 void setTorquesLimit(const Vector3 & v)
205 {
206 limitTorques_ = v;
207 }
208
209 void setForcesLimit(const Vector3 & v)
210 {
211 limitForces_ = v;
212 }
213
214 virtual stateObservation::Vector3 getForcesLimit() const
215 {
216 return limitForces_;
217 }
218
219 virtual stateObservation::Vector3 getTorquesLimit() const
220 {
221 return limitTorques_;
222 }
223
224 void setLimitOn(const bool & b)
225 {
226 limitOn_ = b;
227 }
228
229 virtual bool getLimitOn() const
230 {
231 return limitOn_;
232 }
233
234 static Matrix getDefaultQ();
235
236 static Matrix6 getDefaultRIMU();
237
238 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
239
240protected:
241 virtual void updateMeasurementCovarianceMatrix_();
242
243 IMUElasticLocalFrameDynamicalSystem functor_;
244
245 Vector x_;
246
247 Matrix R_, Q_, P_;
248
249 const Index stateSize_;
250
251 static const Index measurementSizeBase_ = 12;
252
253 static const Index inputSizeBase_ = IMUElasticLocalFrameDynamicalSystem::input::sizeBase;
254 Index inputSize_;
255
256 double dt_; // sampling period
257 bool on_;
258
259 double unmodeledForceVariance_;
260 Matrix forceVariance_; // force sensor variance
261 double absPosVariance_;
262
263 bool useFTSensors_;
264
265 bool withAbsolutePos_;
266 bool withComBias_;
267 bool withUnmodeledForces_;
268
269 Vector3 limitTorques_;
270 Vector3 limitForces_;
271 bool limitOn_;
272
274 {
277 } op_;
278
279private:
280};
281
282} // namespace flexibilityEstimation
283} // namespace stateObservation
284#endif // FLEXBILITYESTMATOR_MODELBASEEKFFLEXIBILITYESTIMATOR_IMU_H
EKFFlexibilityEstimatorBase(Index stateSize, Index measurementSize, Index inputSize, const Vector &dx=Vector::Zero(0))
This class describes the dynamics of a robot's flexibility this dynamics with elastic forces to bring...
virtual void resetCovarianceMatrices()
Resets the covariance matrices to their original values.
virtual Matrix4 getFlexibility()
Gets an estimation of the flexibility in the form of a homogeneous matrix.
void setOn(bool &b)
Enable or disable the estimation.
virtual void setMeasurementNoiseCovariance(const Matrix &R)
Sets the measurements covariance matrice.
virtual Matrix getProcessNoiseCovariance() const
gets the covariance matrices for the process noises
virtual void setProcessNoiseCovariance(const Matrix &Q)
Sets the process covariance matrice.
virtual Matrix getMeasurementNoiseCovariance() const
gets the covariance matrices for the sensor noises
void setContactsNumber(unsigned i)
Sets the number of contacts can be changed online.
virtual void setWithForcesMeasurements(bool)
sets to whether or not the force mesurements are taken into account
virtual const Vector & getFlexibilityVector()
Gets an estimation of the flexibility in the form of a state vector \hat{x_{k+1}}.
virtual void setMeasurement(const Vector &y)
Sets the value of the next sensor measurement y_{k+1}.
virtual void setSamplingPeriod(double)
sets the sampling period
ModelBaseEKFFlexEstimatorIMU(double dt=0.005)
The constructor, it requires the value of the time discretization period.
Declare the class of the flexibility estimation using the extended Kalman Filter.
Filtering of divergent component of motion (DCM) and estimation of a bias betweeen the DCM and the co...
Eigen::Matrix4d Matrix4
4x4 Scalar Matrix
Eigen::Vector3d Vector3
3D vector
Eigen::Matrix3d Matrix3
3x3 Scalar Matrix
Eigen::MatrixXd Matrix
Dynamic sized Matrix.
Eigen::Matrix< double, 6, 6 > Matrix6
6x6 Scalar Matrix
Eigen::VectorXd Vector
Dynamic sized scalar vector.
static constexpr unsigned elasticContact
indices of the different components of a vector of the input state
static const unsigned elasticContact
indexes of the different components of a vector of the input state