12#ifndef ZMPTRACKINGGAINESTIMATOR_HPP
13#define ZMPTRACKINGGAINESTIMATOR_HPP
15#include <state-observation/api.h>
30 constexpr static double defaultDt_ = 0.005;
31 constexpr static double defaultGain_ = 1;
74 const Vector2 & initZMP = Vector2::Zero(),
75 const Vector3 & initGain = Vector3::Zero(),
89 const Vector3 & initGain = Vector3::Zero(),
90 const Matrix2 & yaw = Matrix2::Identity(),
110 initGainUncertainty);
131 initGainUncertainty);
218 * previousOrientation_.transpose())
219 .selfadjointView<Eigen::Upper>();
243 typedef Eigen::Matrix<double, 2, 5> Matrix25;
244 typedef Eigen::Matrix<double, 2, 3> Matrix23;
251 Vector3 gainDriftPerSecondStd_;
272 return Vector2(v.array().square()).asDiagonal();
278 return Vector3(v.array().square()).asDiagonal();
281 inline void updateR_()
283 R_ = Vec2ToSqDiag_(zmpMeasureErrorstd_);
284 filter_.setMeasurementCovariance(R_);
287 inline void updateQ_()
289 Q_.topLeftCorner<2, 2>() = Vec2ToSqDiag_(zmpProcessErrorStd_);
290 Q_.bottomRightCorner<3, 3>() = Vec3ToSqDiag_(gainDriftPerSecondStd_);
291 filter_.setProcessCovariance(Q_);
295 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
The class of a Linear Kalman filter.
~ZmpTrackingGainEstimator()
Destroy the Lipm Dcm Bias Estimator object.
void setGain(const Vector3 &gain, const Vector3 &uncertainty)
Set the Gain from a guess.
void setInputs(const Vector2 &zmpErr, const Vector2 &zmp, const Matrix2 &R=Matrix2::Identity())
Set the Inputs of the estimator.
void setGainDriftPerSecond(const Vector3 &)
Set the Gain Drift Per Second.
static constexpr double defaultGainMinimum
static constexpr double defaultZmpMeasurementErrorStd
default error in the measurements of the zmp
void update()
Runs the estimation. Needs to be called every timestep.
static constexpr double defaultGainUncertainty
default value for the uncertainty of the Gain
Matrix2 R_
measurement noise
void resetWithMeasurements(const Vector2 &initZMP=Vector2::Zero(), const Vector3 &initGain=Vector3::Zero(), const Matrix2 &yaw=Matrix2::Identity(), const Vector2 &initZMPUncertainty=Vector2::Constant(defaultZmpUncertainty), const Vector3 &initGainUncertainty=Vector3::Constant(defaultGainUncertainty))
Resets the estimator.
void setGain(const Vector3 &gain)
Set the Gain from a guess.
Matrix2 getEstimatedGain() const
Get the Unbiased DCM filtered by the estimator.
void setZMPProcesError(const Vector2 &)
Set the covariance of the zmp process linear dynamics error.
static constexpr double defaultZmpUncertainty
default valu for the initial ZMP uncertainty. It should be quite low since this is supposed to be mea...
void setMinimumGain(const double &minGain)
Set the Gain Limit.
static constexpr double defaultGainDriftSecond
default expected drift of the bias every second
Matrix25 C_
The B matrix is zero.
void resetWithMeasurements(const Vector2 &initZMP, const Vector3 &initGain, double yaw, const Vector2 &initZMPUncertainty=Vector2::Constant(defaultZmpUncertainty), const Vector3 &initGainUncertainty=Vector3::Constant(defaultGainUncertainty))
Resets the estimator.
void setSamplingTime(double dt)
Set the Sampling Time.
LinearKalmanFilter & getFilter()
Get the Kalman Filter object This can be used to run specific Advanced Kalman filter related funcions...
Matrix2 getEstimatedLocalGain() const
Get the estimated Bias expressed in the local frame of the robot.
ZmpTrackingGainEstimator(double dt=defaultDt_, const Vector2 &zmpMeasureErrorStd=Vector2::Constant(defaultZmpMeasurementErrorStd), const Vector3 &gainDriftPerSecond=Vector3::Constant(defaultGainDriftSecond), const Vector2 &zmpProcessErrorStd=Vector2::Constant(defaultZmpProcessErrorStd), double minimumGain=defaultGainMinimum, const Vector2 &initZMP=Vector2::Zero(), const Vector3 &initGain=Vector3::Zero(), const Vector2 &initZMPUncertainty=Vector2::Constant(defaultZmpUncertainty), const Vector3 &initGainUncertainty=Vector3::Constant(defaultGainUncertainty))
Construct a new ZMP Gain Estimator object.
void setInputs(const Vector2 &zmpErr, const Vector2 &zmp, const Matrix3 &orientation)
Set the Inputs of the estimator.
static constexpr double defaultZmpProcessErrorStd
default error in the process linear dynamics of the zmp (in meters)
static Matrix3 Vec3ToSqDiag_(const Vector3 &v)
builds a diagonal out of the square valued of the Vec3
void resetWithMeasurements(const Vector2 &initZMP, const Vector3 &initGain, const Matrix3 &rotation, const Vector2 &initZMPUncertainty=Vector2::Constant(defaultZmpUncertainty), const Vector3 &initGainUncertainty=Vector3::Constant(defaultGainUncertainty))
Resets the estimator with first measurements.
void setZmpMeasureErrorStd(const Vector2 &)
Set the Zmp Measurement Error Stamdard deviation.
void setInputs(const Vector2 &zmpErr, const Vector2 &zmp, double yaw)
Set the Inputs of the estimator.
static Matrix2 Vec2ToSqDiag_(const Vector2 &v)
builds a diagonal out of the square valued of the Vec2
const LinearKalmanFilter & getFilter() const
Get the Kalman Filter object This can be used to run specific Advanced Kalman filter related funcions...
Defines the class of a Linear Kalman filter.
Gathers many kinds of algorithms.
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::Rotation2D< double > Rotation2D
2D rotations
Eigen::Matrix2d Matrix2
2D scalar Matrix
Eigen::Vector3d Vector3
3D vector
Eigen::Matrix3d Matrix3
3x3 Scalar Matrix
Eigen::Matrix< double, 5, 5 > Matrix5
5x5 Scalar Matrix
Eigen::Matrix< double, 2, 1 > Vector2
2d Vector
Implements integrators for the kinematics, in terms or rotations and translations.
double rotationMatrixToYawAxisAgnostic(const Matrix3 &rotation)
take 3x3 matrix represeting a rotation and gives a corresponding angle around upward vertical axis