model-base-ekf-flex-estimator-imu.hpp
Go to the documentation of this file.
1 
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>
20 // #include <state-observation/flexibility-estimation/imu-fixed-contact-dynamical-system.hpp>
21 
22 namespace stateObservation
23 {
24 namespace flexibilityEstimation
25 {
26 
38 class STATE_OBSERVATION_DLLAPI ModelBaseEKFFlexEstimatorIMU : public EKFFlexibilityEstimatorBase,
39  private boost::noncopyable
40 {
41 public:
42  struct contactModel
43  {
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 
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 
85  virtual Matrix getProcessNoiseCovariance() const;
86 
88  virtual Matrix getMeasurementNoiseCovariance() const;
89 
90  virtual Vector getMomentaDotFromForces();
91  virtual Vector getMomentaDotFromKinematics();
92  virtual Vector getForcesAndMoments();
93 
94  // get state covariance
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 
110  virtual Matrix4 getFlexibility();
111 
113  virtual const Vector & getFlexibilityVector();
114 
115  virtual stateObservation::Matrix & computeLocalObservationMatrix();
117  {
118  return ekf_.getA();
119  }
120 
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 
142  {
143  return withUnmodeledForces_;
144  }
145 
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 
195  virtual void resetCovarianceMatrices();
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 
215  {
216  return limitForces_;
217  }
218 
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 
240 protected:
241  virtual void updateMeasurementCovarianceMatrix_();
242 
244 
246 
247  Matrix R_, Q_, P_;
248 
250 
251  static const Index measurementSizeBase_ = 12;
252 
255 
256  double dt_; // sampling period
257  bool on_;
258 
260  Matrix forceVariance_; // force sensor variance
262 
264 
268 
271  bool limitOn_;
272 
274  {
277  } op_;
278 
279 private:
280 };
281 
282 } // namespace flexibilityEstimation
283 } // namespace stateObservation
284 #endif // FLEXBILITYESTMATOR_MODELBASEEKFFLEXIBILITYESTIMATOR_IMU_H
stateObservation::Vector
Eigen::VectorXd Vector
Dynamic sized scalar vector.
Definition: definitions.hpp:76
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::unmodeledForceVariance_
double unmodeledForceVariance_
Definition: model-base-ekf-flex-estimator-imu.hpp:259
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::optimization::CA
stateObservation::Matrix CA
Definition: model-base-ekf-flex-estimator-imu.hpp:276
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::setLimitOn
void setLimitOn(const bool &b)
Definition: model-base-ekf-flex-estimator-imu.hpp:224
stateObservation::Matrix4
Eigen::Matrix4d Matrix4
4x4 Scalar Matrix
Definition: definitions.hpp:115
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::limitForces_
Vector3 limitForces_
Definition: model-base-ekf-flex-estimator-imu.hpp:270
stateObservation::Matrix6
Eigen::Matrix< double, 6, 6 > Matrix6
6x6 Scalar Matrix
Definition: definitions.hpp:121
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::dt_
double dt_
Definition: model-base-ekf-flex-estimator-imu.hpp:256
stateObservation::flexibilityEstimation::IMUElasticLocalFrameDynamicalSystem::contactModel::pendulum
static constexpr unsigned pendulum
Definition: imu-elastic-local-frame-dynamical-system.hpp:76
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::contactModel
Definition: model-base-ekf-flex-estimator-imu.hpp:42
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::setTorquesLimit
void setTorquesLimit(const Vector3 &v)
Definition: model-base-ekf-flex-estimator-imu.hpp:204
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::limitOn_
bool limitOn_
Definition: model-base-ekf-flex-estimator-imu.hpp:271
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::R_
Matrix R_
Definition: model-base-ekf-flex-estimator-imu.hpp:247
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getStateCovariance
stateObservation::Vector getStateCovariance() const
Definition: model-base-ekf-flex-estimator-imu.hpp:95
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::setForcesLimit
void setForcesLimit(const Vector3 &v)
Definition: model-base-ekf-flex-estimator-imu.hpp:209
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::on_
bool on_
Definition: model-base-ekf-flex-estimator-imu.hpp:257
stateObservation::flexibilityEstimation::IMUElasticLocalFrameDynamicalSystem::contactModel::elasticContact
static constexpr unsigned elasticContact
indices of the different components of a vector of the input state
Definition: imu-elastic-local-frame-dynamical-system.hpp:75
stateObservation::flexibilityEstimation::EKFFlexibilityEstimatorBase
This class is the base class of the flexibility estimators that use an extended Kalman Filter....
Definition: ekf-flexibility-estimator-base.hpp:35
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getFunctor
IMUElasticLocalFrameDynamicalSystem getFunctor()
Definition: model-base-ekf-flex-estimator-imu.hpp:63
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::absPosVariance_
double absPosVariance_
Definition: model-base-ekf-flex-estimator-imu.hpp:261
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::stateSize_
const Index stateSize_
Definition: model-base-ekf-flex-estimator-imu.hpp:249
stateObservation::flexibilityEstimation::IMUElasticLocalFrameDynamicalSystem
This class describes the dynamics of a robot's flexibility this dynamics with elastic forces to bring...
Definition: imu-elastic-local-frame-dynamical-system.hpp:34
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::setPe
virtual void setPe(const stateObservation::Vector3 &Pe)
Definition: model-base-ekf-flex-estimator-imu.hpp:184
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getContactsNumber
unsigned getContactsNumber()
Definition: model-base-ekf-flex-estimator-imu.hpp:58
stateObservation::Matrix
Eigen::MatrixXd Matrix
Dynamic sized Matrix.
Definition: definitions.hpp:100
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::withAbsolutePos_
bool withAbsolutePos_
Definition: model-base-ekf-flex-estimator-imu.hpp:265
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getLimitOn
virtual bool getLimitOn() const
Definition: model-base-ekf-flex-estimator-imu.hpp:229
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::forceVariance_
Matrix forceVariance_
Definition: model-base-ekf-flex-estimator-imu.hpp:260
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::computeAccelerations
virtual stateObservation::Vector computeAccelerations()
Definition: model-base-ekf-flex-estimator-imu.hpp:68
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::withComBias_
bool withComBias_
Definition: model-base-ekf-flex-estimator-imu.hpp:266
stateObservation::Matrix3
Eigen::Matrix3d Matrix3
3x3 Scalar Matrix
Definition: definitions.hpp:109
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU
This class implements the flexibility estimation of a robot with the hypothesis that the contact posi...
Definition: model-base-ekf-flex-estimator-imu.hpp:38
stateObservation::hrp2::m
constexpr double m
mass of the robot
Definition: hrp2.hpp:36
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getWithComBias
virtual bool getWithComBias()
Definition: model-base-ekf-flex-estimator-imu.hpp:153
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getCMatrix
virtual stateObservation::Matrix getCMatrix()
Definition: model-base-ekf-flex-estimator-imu.hpp:121
imu-elastic-local-frame-dynamical-system.hpp
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::useFTSensors_
bool useFTSensors_
Definition: model-base-ekf-flex-estimator-imu.hpp:263
stateObservation::Index
Eigen::Index Index
Definition: definitions.hpp:138
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::optimization
Definition: model-base-ekf-flex-estimator-imu.hpp:273
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::optimization::O
stateObservation::Matrix O
Definition: model-base-ekf-flex-estimator-imu.hpp:275
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::withUnmodeledForces_
bool withUnmodeledForces_
Definition: model-base-ekf-flex-estimator-imu.hpp:267
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::limitTorques_
Vector3 limitTorques_
Definition: model-base-ekf-flex-estimator-imu.hpp:269
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getAMatrix
virtual stateObservation::Matrix getAMatrix()
Definition: model-base-ekf-flex-estimator-imu.hpp:116
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::x_
Vector x_
Definition: model-base-ekf-flex-estimator-imu.hpp:245
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getForcesLimit
virtual stateObservation::Vector3 getForcesLimit() const
Definition: model-base-ekf-flex-estimator-imu.hpp:214
stateObservation::Vector3
Eigen::Vector3d Vector3
3D vector
Definition: definitions.hpp:85
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getRobotMass
virtual double getRobotMass() const
Definition: model-base-ekf-flex-estimator-imu.hpp:199
stateObservation
Definition: bidim-elastic-inv-pendulum-dyn-sys.hpp:20
ekf-flexibility-estimator-base.hpp
Declare the class of the flexibility estimation using the extended Kalman Filter.
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getWithUnmodeledForces
bool getWithUnmodeledForces()
Definition: model-base-ekf-flex-estimator-imu.hpp:141
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getWithAbsolutePos
bool getWithAbsolutePos()
Definition: model-base-ekf-flex-estimator-imu.hpp:146
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::getTorquesLimit
virtual stateObservation::Vector3 getTorquesLimit() const
Definition: model-base-ekf-flex-estimator-imu.hpp:219
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::functor_
IMUElasticLocalFrameDynamicalSystem functor_
Definition: model-base-ekf-flex-estimator-imu.hpp:243
stateObservation::flexibilityEstimation::ModelBaseEKFFlexEstimatorIMU::inputSize_
Index inputSize_
Definition: model-base-ekf-flex-estimator-imu.hpp:254
stateObservation::flexibilityEstimation::IMUElasticLocalFrameDynamicalSystem::input::sizeBase
static constexpr unsigned sizeBase
Definition: imu-elastic-local-frame-dynamical-system.hpp:55