12#ifndef KINETICSOBSERVER_HPP
13#define KINETICSOBSERVER_HPP
17#include <boost/utility.hpp>
19#include <state-observation/api.h>
284 const Matrix12 & initialCovarianceMatrix,
285 const Matrix12 & processCovarianceMatrix,
286 Index contactNumber = -1,
287 const Matrix3 & linearStiffness = Matrix3::Constant(-1),
288 const Matrix3 & linearDamping = Matrix3::Constant(-1),
289 const Matrix3 & angularStiffness = Matrix3::Constant(-1),
290 const Matrix3 & angularDamping = Matrix3::Constant(-1));
308 Index contactNumber = -1,
309 const Matrix3 & linearStiffness = Matrix3::Constant(-1),
310 const Matrix3 & linearDamping = Matrix3::Constant(-1),
311 const Matrix3 & angularStiffness = Matrix3::Constant(-1),
312 const Matrix3 & angularDamping = Matrix3::Constant(-1));
357 unsigned contactNumber);
365 const Matrix6 & wrenchCovMatrix,
367 unsigned contactNumber);
475 const Vector3 & momentUserFrame,
477 Vector3 & momentCentroidFrame);
557 bool resetContactWrenches =
true,
558 bool resetCovariance =
true);
578 bool resetCovariance =
true);
1001 Sensor(
Index signalSize) : measIndex(-1), measIndexTangent(-1), size(signalSize), time(0) {}
1010 return v.segment(size, measIndex);
1028 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1031 typedef std::vector<IMU, Eigen::aligned_allocator<IMU>>
VectorIMU;
1037 Contact() :
Sensor(sizeWrench), isSet(false), withRealSensor(false), stateIndex(-1), stateIndexTangent(-1)
1039 worldRestPose.angVel = worldRestPose.linVel = Vector3::Zero();
1066 static const Kinematics::Flags::Byte contactKineFlags =
1067 Kinematics::Flags::position | Kinematics::Flags::orientation | Kinematics::Flags::linVel
1068 | Kinematics::Flags::angVel;
1070 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1082 static const Kinematics::Flags::Byte poseFlags = Kinematics::Flags::position | Kinematics::Flags::orientation;
1133 const Vector3 & centroidContactForce,
1134 const Vector3 & centroidContactTorque,
1136 Vector3 & totalCentroidTorque);
1150 const Vector3 & totalForceLocal,
1151 const Vector3 & totalMomentLocal,
1290 double relativeErrorThreshold,
1298 double relativeErrorThreshold,
1303 double relativeErrorThreshold,
1310 double relativeErrorThreshold,
1421 inline static constexpr Index sizeAcceleroSignal = 3;
1422 inline static constexpr Index sizeGyroSignal = 3;
1423 inline static constexpr Index sizeIMUSignal = sizeAcceleroSignal + sizeGyroSignal;
1425 inline static constexpr Index sizePos = 3;
1426 inline static constexpr Index sizePosTangent = 3;
1427 inline static constexpr Index sizeOri = 4;
1428 inline static constexpr Index sizeOriTangent = 3;
1429 inline static constexpr Index sizeLinVel = sizePos;
1430 inline static constexpr Index sizeLinVelTangent = sizeLinVel;
1431 inline static constexpr Index sizeLinAccTangent = sizeLinVelTangent;
1432 inline static constexpr Index sizeAngVel = sizeOriTangent;
1433 inline static constexpr Index sizeAngVelTangent = sizeAngVel;
1434 inline static constexpr Index sizeGyroBias = sizeGyroSignal;
1435 inline static constexpr Index sizeGyroBiasTangent = sizeGyroBias;
1437 inline static constexpr Index sizeForce = 3;
1438 inline static constexpr Index sizeForceTangent = sizeForce;
1439 inline static constexpr Index sizeTorque = 3;
1440 inline static constexpr Index sizeTorqueTangent = sizeTorque;
1442 inline static constexpr Index sizeWrench = sizeForce + sizeTorque;
1444 inline static constexpr Index sizeStateKine = sizePos + sizeOri + sizeLinVel + sizeAngVel;
1445 inline static constexpr Index sizeStateBase = sizeStateKine + sizeForce + sizeTorque;
1446 inline static constexpr Index sizeStateKineTangent = sizePos + sizeOriTangent + sizeLinVel + sizeAngVel;
1447 inline static constexpr Index sizeStateTangentBase = sizeStateKineTangent + sizeForce + sizeTorque;
1449 inline static constexpr Index sizePose = sizePos + sizeOri;
1450 inline static constexpr Index sizePoseTangent = sizePos + sizeOriTangent;
1452 inline static constexpr Index sizeContactKine = sizePose;
1453 inline static constexpr Index sizeContactKineTangent = sizePoseTangent;
1455 inline static constexpr Index sizeContact = sizeContactKine + sizeWrench;
1456 inline static constexpr Index sizeContactTangent = sizeContactKineTangent + sizeWrench;
1458 inline static constexpr Kinematics::Flags::Byte flagsStateKine =
1459 Kinematics::Flags::position | Kinematics::Flags::orientation | Kinematics::Flags::linVel
1460 | Kinematics::Flags::angVel;
1462 inline static constexpr Kinematics::Flags::Byte flagsContactKine =
1463 Kinematics::Flags::position | Kinematics::Flags::orientation;
1465 inline static constexpr Kinematics::Flags::Byte flagsPoseKine =
1466 Kinematics::Flags::position | Kinematics::Flags::orientation;
1468 inline static constexpr Kinematics::Flags::Byte flagsPosKine = Kinematics::Flags::position;
1470 inline static constexpr Kinematics::Flags::Byte flagsIMUKine =
1471 Kinematics::Flags::position | Kinematics::Flags::orientation | Kinematics::Flags::linVel
1472 | Kinematics::Flags::angVel | Kinematics::Flags::linAcc | Kinematics::Flags::angAcc;
1511 bool nanDetected_ =
false;
1512 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1557 Opt() : locKine(locKine1), ori(locKine.orientation), ori1(locKine1.orientation), ori2(locKine2.orientation) {}
1569 const Kinematics & userImuKinematics,
1575#include <state-observation/dynamics-estimators/kinetics-observer.hxx>
Implements the accelerometer-gyrometer inertial measuremen.
This is the base class of any functor that describes the dynamics of the state and the measurement....
Definition dynamical-system-functor-base.hpp:33
Definition extended-kalman-filter.hpp:43
This observer estimates the kinematics, the external forces, the bias on the gyrometers measurements,...
Definition kinetics-observer.hpp:42
virtual void measurementDifference(const Vector &measureVector1, const Vector &measureVector2, Vector &difference)
the difference operator for the measurement statevector1 ⊖ statevector2
Index getIMUMeasIndexByNum(Index num) const
Get the measurement index of the required IMU : allows to access its corresponding measurements in th...
static const double contactForceInitVarianceDefault
Definition kinetics-observer.hpp:1483
LocalKinematics getLocalCentroidKinematics() const
Get the estimated local Kinematics of the centroid frame in the world frame (local,...
static const double stateAngVelInitVarianceDefault
Definition kinetics-observer.hpp:1480
Vector6 getCentroidContactWrench(Index numContact) const
Returns the wrench exerted at the contact, expressed in the frame of the centroid.
Kinematics getContactPosition(Index contactNbr) const
Get the Contact 6D pose n in the global frame.
void setKinematicsProcessCovarianceDefault(const Matrix3 &P_pos, const Matrix3 &P_ori, const Matrix3 &P_linVel, const Matrix3 &P_angVel)
Set the default Kinematics Process Covariance.
static const double gyroVarianceDefault
Definition kinetics-observer.hpp:1498
friend int testAccelerationsJacobians(KineticsObserver &ko, int errcode, double relativeErrorThreshold, double threshold)
Comparison between the Jacobians of the linear and angular accelerations with respect to the state,...
static const double contactPositionProcessVarianceDefault
Definition kinetics-observer.hpp:1492
Index getStateTangentSize() const
Get the State Vector Tangent Size.
Matrix6 unmodeledWrenchInitCovMat_
Definition kinetics-observer.hpp:1533
Kinematics getGlobalKinematicsOf(const Kinematics &userBodyKin) const
Get the global kinematics of a given frame (in the user frame) in the centroid frame.
Index contactForceIndexTangent(Index contactNbr) const
Get the index of the linear force of a specific contact in the tangent sate vector.
void setStateVector(const Vector &newvalue, bool resetCovariance=true)
Set a value of the state x_k provided from another source.
Vector getMeasurementVector()
Get the Measurement Vector.
Index kineIndexTangent() const
Get the kinematics index of the tangent state vector.
Index linVelIndex() const
Get the linear velocity index of the state vector.
Index posIndex() const
Get the position index of the state vector.
void setUnmodeledWrenchInitCovMatDefault(const Matrix6 &initCovMat)
Set the default value for init Unmodeled Wrench covariance matrix.
void setAbsoluteOriSensorDefaultCovarianceMatrix(const Matrix3 &covMat)
Set the Absolute Orientation Sensor Default Covariance Matrix.
static const double linearStiffnessDefault
Definition kinetics-observer.hpp:1504
void setStateCovarianceMat(const Matrix &P)
Set the State Covariance Matrix This is useful in case of a setting a guess on a whole state vect9or.
void setCoMAngularMomentum(const Vector3 &sigma, const Vector3 &sigma_dot)
Set the Angular Momentum around the CoM and its derviative expressed in the user frame.
Matrix3 contactForceProcessCovMat_
Definition kinetics-observer.hpp:1544
Index contactIndex(VectorContactConstIterator i) const
Matrix3 gyroBiasInitCovMat_
Definition kinetics-observer.hpp:1532
Index gyroBiasIndex(Index IMUNumber) const
Get the gyro bias index of the state vector.
void resetProcessKinematicsCovMat()
static const double unmodeledWrenchInitVarianceDefault
Definition kinetics-observer.hpp:1482
virtual Vector measureDynamics(const Vector &x, const Vector &u, TimeIndex k)
Applies the measurement model to the given state vector using the given input to predict the sensor m...
virtual Matrix computeCMatrix()
double dt_
Definition kinetics-observer.hpp:1369
static const double stateOriInitVarianceDefault
Definition kinetics-observer.hpp:1478
Kinematics getUserContactInputPose(Index numContact) const
Returns the pose of the contact in the user frame, given as an input when updating the contact.
void computeLocalAccelerations(const Vector &x, Vector &acceleration)
computes the local acceleration from the given state vector
void updateMeasurements()
Updates the measurements.
double getMass() const
Returns the mass of the robot.
void resetSensorsDefaultCovMats()
Reset the default values for the sensors covariance matrices.
void setKinematicsInitCovarianceDefault(const Matrix3 &P_pos, const Matrix3 &P_ori, const Matrix3 &P_linVel, const Matrix3 &P_angVel)
Set the Default value for Kinematics Init Covariance.
Vector6 getContactWrench(Index contactNbr) const
Get the Estimated Contact Wrench This is useful in the case of uncertain wrench sensors or when conta...
void updateContactWithWrenchSensor(const Vector6 &wrenchMeasurement, const Kinematics &localKine, unsigned contactNumber)
Update the contact when it is equipped with wrench sensor.
Matrix3 stateOriProcessCovMat_
Definition kinetics-observer.hpp:1537
static const double contactForceProcessVarianceDefault
Definition kinetics-observer.hpp:1494
void resetStateContactCovMat(Index contactNbr)
Index contactWrenchIndexTangent(VectorContactConstIterator i) const
Index contactIndexTangent(VectorContactConstIterator i) const
Getters for the indexes of the state Vector using private types.
Index contactPosIndexTangent(Index contactNbr) const
Get the index of the position of a specific contact in the tangent sate vector.
Index unmodeledTorqueIndex() const
Get the unmodeled external torque force index of the state vector.
static const double positionSensorVarianceDefault
Definition kinetics-observer.hpp:1501
Vector6 getUnmodeledWrench() const
Get the Unmodeled External Wrench (requires setWithUnmodeledWrench() to true before to update())
void setCenterOfMass(const Vector3 &com)
Set the Center Of Mass kinematics expressed in the user frame.
Index currentIMUSensorNumber_
Definition kinetics-observer.hpp:1375
void setGyroBiasProcessCovariance(const Matrix3 &covMat, unsigned imuNumber)
Set the Gyro Bias Process Covariance.
const IndexedMatrix3 & getInertiaMatrix() const
Returns the global inertia matrix of the robot at the center of mass.
Matrix3 contactPositionProcessCovMat_
Definition kinetics-observer.hpp:1542
const Vector & update()
Runs the estimation.
VectorContact contacts_
Definition kinetics-observer.hpp:1330
Vector worldCentroidStateVectorDx_
Definition kinetics-observer.hpp:1339
Index contactForceIndexTangent(VectorContactConstIterator i) const
void setCenterOfMass(const Vector3 &com, const Vector3 &com_dot)
Set the Center Of Mass kinematics expressed in the user frame.
virtual void resetProcessNoise()
Removes the process noise.
Vector3 additionalTorque_
Definition kinetics-observer.hpp:1346
NoiseBase * measurementNoise_
Definition kinetics-observer.hpp:1372
Index contactsIndex() const
Get the index for the contact segment in the state vector.
void updateContactWithWrenchSensor(const Vector6 &wrenchMeasurement, const Matrix6 &wrenchCovMatrix, const Kinematics &localKine, unsigned contactNumber)
Update the contact when it is equipped with wrench sensor.
void setGyroBiasInitCovarianceDefault(const Matrix3 &covMat)
Set the Default value for Gyro Bias Init Covariance.
static const double statePoseInitVarianceDefault
Definition kinetics-observer.hpp:1477
virtual void setMeasurementNoise(NoiseBase *)
Sets a noise which disturbs the measurements.
virtual void setFiniteDifferenceStep(const Vector &dx)
Set the Finite Difference time step.
Index numberOfContactRealSensors_
Definition kinetics-observer.hpp:1374
virtual void useFiniteDifferencesJacobians(bool b=true)
Define if we use dinite differences Jacobian or analytic.
Kinematics getContactStateRestKinematics(Index numContact) const
Returns the estimated rest pose of the contact in the world frame.
Vector stateDifference(const Vector &stateVector1, const Vector &stateVector2)
the difference operator for the state statevector1 ⊖ statevector2
void setUnmodeledWrenchProcessCovarianceDefault(const Matrix6 &covMat)
Set the default Unmodeled Wrench Process Covariance.
IndexedMatrix3 I_
Definition kinetics-observer.hpp:1362
Vector3 initTotalCentroidForce_
Definition kinetics-observer.hpp:1348
void setContactStateCovMat(Index contactNbr, const Matrix12 &contactCovMat)
Set the Contact State Covariance Matrix.
void setKinematicsProcessCovarianceDefault(const Matrix12 &)
Set the default Kinematics Process Covariance.
Matrix3 stateLinVelInitCovMat_
Definition kinetics-observer.hpp:1530
void resetProcessCovarianceMat()
void resetProcessUnmodeledWrenchCovMat()
void setAbsoluteOriSensor(const Orientation &measurement)
Set an Absolute Orientation Sensor measurement The measurement is the orientation of the observed fra...
Index contactOriIndexTangent(Index contactNbr) const
Get the index of the orientation of a specific contact in the tangent sate vector.
const IndexedMatrix3 & getInertiaMatrixDot() const
Returns the derivative of the global inertia matrix of the robot at the center of mass.
void addUnmodeledAndContactWrench_(const Vector ¢roidStateVector, Vector3 &force, Vector3 &torque)
Adds the unmodeled and contact wrenches from the state to the given wrench.
Index contactForceIndex(VectorContactConstIterator i) const
void setKinematicsProcessCovariance(const Matrix12 &)
Set the Kinematics Process Covariance.
Index contactKineIndexTangent(VectorContactConstIterator i) const
LocalKinematics estimateAccelerations()
gets the Kinematics that include the linear and angular accelerations.
Index angVelIndex() const
Get the angular velocity index of the state vector.
static const double acceleroVarianceDefault
Definition kinetics-observer.hpp:1497
Matrix3 statePosProcessCovMat_
Definition kinetics-observer.hpp:1536
Index posIndexTangent() const
Get the position index of the tangent state vector.
Vector oldWorldCentroidStateVector_
Definition kinetics-observer.hpp:1340
friend int testAnalyticalCJacobianVsFD(KineticsObserver &ko, int errcode, double relativeErrorThreshold, double threshold)
AbsoluteOriSensor absOriSensor_
Definition kinetics-observer.hpp:1329
bool getWithAccelerationEstimation() const
Returns if the estimation computes also the accelerations.
Vector stateSum(const Vector &stateVector, const Vector &tangentVector)
the sum operator for the state vector
void setInitWorldCentroidStateVector(const Vector &initStateVector)
Initializes the state vector.
static const double contactTorqueInitVarianceDefault
Definition kinetics-observer.hpp:1484
Vector worldCentroidStateVector_
Definition kinetics-observer.hpp:1338
void updateContactWithNoSensor(const Kinematics &localKine, unsigned contactNumber)
Update the contact when it is NOT equipped with wrench sensor.
Index getNumberOfSetContacts() const
Get the Current Number Of Contacts.
Index setIMU(const Vector3 &accelero, const Vector3 &gyrometer, const Matrix3 &acceleroCov, const Matrix3 &gyroCov, const Kinematics &userImuKinematics, Index num=-1)
Provides also the associated covariance matrices
Index oriIndex() const
Get the orientation index of the state vector.
Index angVelIndexTangent() const
Get the angular velocity index of the tangent state vector.
Matrix3 stateAngVelProcessCovMat_
Definition kinetics-observer.hpp:1539
void setContactWrenchSensorDefaultCovarianceMatrix(const Matrix6 &wrenchSensorCovMat)
Set the Contact Wrench Sensor Default Covariance Matrix.
const IndexedVector3 & getCenterOfMassDot() const
Returns the linear velocity of the CoM of the robot in the user frame.
VectorContact::iterator VectorContactIterator
Definition kinetics-observer.hpp:1074
virtual void setProcessNoise(NoiseBase *)
Sets a noise which disturbs the state dynamics.
const ExtendedKalmanFilter & getEKF() const
Gets a const reference on the extended Kalman filter.
Matrix6 absPoseSensorCovMatDefault_
Definition kinetics-observer.hpp:1525
const IndexedVector3 & getAngularMomentumDot() const
Returns the derivative of the angular momentum of the robot at the center of mass.
Matrix3 stateAngVelInitCovMat_
Definition kinetics-observer.hpp:1531
void setKinematicsInitCovarianceDefault(const Matrix &)
Set the Default value for Kinematics Init Covariance.
Kinematics getCentroidContactInputPose(Index numContact) const
Returns the pose of the contact in the centroid frame, given as an input when updating the contact (o...
Index setIMU(const Vector3 &accelero, const Vector3 &gyrometer, const Kinematics &userImuKinematics, Index num=-1)
Set the measurements of an IMU and give the Kinematic of the IMU in the user frame.
Matrix3 contactTorqueProcessCovMat_
Definition kinetics-observer.hpp:1545
Index measurementTangentSize_
Definition kinetics-observer.hpp:1336
static const double gyroBiasProcessVarianceDefault
Definition kinetics-observer.hpp:1490
void resetInputs()
reset all the sensor inputs and provided contact information but keeps the contacts themselves
static const double stateLinVelProcessVarianceDefault
Definition kinetics-observer.hpp:1488
Index kineIndex() const
Get the kinematics index of the state vector.
void resetStateUnmodeledWrenchCovMat()
Index contactOriIndexTangent(VectorContactConstIterator i) const
void updateLocalKineAndContacts_()
update of the state kinematics worldCentroidStateKinematics_ and of the contacts pose with the newly ...
static const double statePoseProcessVarianceDefault
Definition kinetics-observer.hpp:1486
void setAbsoluteOriSensor(const Orientation &measurement, const Matrix3 &CovarianceMatrix)
Set an Absolute Orientation Sensor measurement The measurement is the orientation of the observed fra...
void setWithGyroBias(bool b=true)
Set if the gyrometers bias is computed or not. This parameter is global for all the IMUs.
IndexedVector3 com_
Definition kinetics-observer.hpp:1360
Index contactIndexTangent(Index contactNbr) const
Get the index of a specific contact in the tangent sate vector.
Index unmodeledWrenchIndex() const
Get the unmodeled external wrench index of the state vector.
void setStateUnmodeledWrench(const Vector6 &, bool resetCovariance=true)
Set the State Unmodeled Wrench.
Index contactOriIndex(VectorContactConstIterator i) const
void setWorldCentroidStateKinematics(const LocalKinematics &localKine, bool resetContactWrenches=true, bool resetCovariance=true)
Set the State Kinematics.
void convertWrenchFromUserToCentroid(const Vector3 &forceUserFrame, const Vector3 &momentUserFrame, Vector3 &forceCentroidFrame, Vector3 &momentCentroidFrame)
Returns the predicted Kinematics object of the centroid in the world frame at the time of the measure...
void setStateContact(Index index, Kinematics worldContactRestPose, const Vector6 &wrench, bool resetCovariance=true)
Set the state contact kinematics and wrench.
TimeIndex k_data_
Definition kinetics-observer.hpp:1365
VectorIMU::const_iterator VectorIMUConstIterator
Definition kinetics-observer.hpp:1033
LocalKinematics worldCentroidStateKinematics_
Definition kinetics-observer.hpp:1342
void setAbsolutePoseSensorDefaultCovarianceMatrix(const Matrix6 &covMat)
Set the Absolute Pose Sensor Default Covariance Matrix.
VectorContact::const_iterator VectorContactConstIterator
Definition kinetics-observer.hpp:1075
Matrix3 stateOriInitCovMat_
Definition kinetics-observer.hpp:1529
void setAbsolutePoseSensor(const Kinematics &measurement)
Set an Absolute Pose Sensor measurement The measurement is the kinematics namely position and orienta...
friend int testOrientationsJacobians(KineticsObserver &ko, int errcode, double relativeErrorThreshold, double threshold)
Comparison between the Jacobians of orientation integration with respect to an increment vector delta...
static const double torqueSensorVarianceDefault
Definition kinetics-observer.hpp:1500
bool getContactIsSetByNum(Index num) const
virtual Index getInputSize() const
Gets the input size.
double mass_
Definition kinetics-observer.hpp:1367
static const double unmodeledWrenchProcessVarianceDefault
Definition kinetics-observer.hpp:1491
static const double stateOriProcessVarianceDefault
Definition kinetics-observer.hpp:1487
bool finiteDifferencesJacobians_
Definition kinetics-observer.hpp:1355
void clearContacts()
remove all the contacts
Index getStateSize() const
Get the State Vector Size.
Index stateSize_
Definition kinetics-observer.hpp:1333
Matrix3 linearStiffnessMatDefault_
Default Stiffness and damping.
Definition kinetics-observer.hpp:1516
TimeIndex getStateVectorTimeIndex() const
Get the State Vector Internal Time Index This is for advanced use but may be used to check how many s...
Kinematics convertUserToCentroidFrame_(const Kinematics &userKine, TimeIndex k_data)
Converts a Kinematics object from the user's frame to the centroid's frame, which is used for most of...
void addUnmodeledWrench_(const Vector ¢roidStateVector, Vector3 &force, Vector3 &torque)
Adds the unmodeled wrench from the state to the given wrench.
void computeContactForces_(LocalKinematics &worldCentroidStateKinematics, Vector3 &contactForce, Vector3 &contactTorque)
Computes the force exerted at a contact using the visco-elastic model on the given state vector....
void setGyroBiasProcessCovarianceDefault(const Matrix3 &covMat)
Set the default Gyro Bias Process Covariance.
virtual void stateDifference(const Vector &stateVector1, const Vector &stateVector2, Vector &difference)
the difference operator for the state statevector1 ⊖ statevector2 This version prevents a nwe vecto...
void setWithAccelerationEstimation(bool b=true)
Sets if the estimation computes also the accelerations.
Matrix3 absOriSensorCovMatDefault_
Definition kinetics-observer.hpp:1526
void computeLocalAccelerations_(LocalKinematics &localStateKine, const Vector3 &totalForceLocal, const Vector3 &totalMomentLocal, Vector3 &linAcc, Vector3 &angAcc)
Computes the local accelerations of the centroid frame in the world frame and adds them to its local ...
Index unmodeledForceIndexTangent() const
Get the unmodeled external linear force index of the tangent state vector.
void resetStateCovarianceMat()
Resets the covariance matrices to their original values.
void setGyroBiasStateCovariance(const Matrix3 &covMat, unsigned imuNumber)
Set the Gyro Bias State Covariance.
Vector6 getAdditionalWrench() const
Returns the input additional wrench, expressed in the centroid frame.
Index getContactMeasIndexByNum(Index num) const
Matrix12 contactProcessCovMatDefault_
Definition kinetics-observer.hpp:1546
std::vector< Contact, Eigen::aligned_allocator< Contact > > VectorContact
Definition kinetics-observer.hpp:1073
void setMass(double)
Set the total mass of the robot. This can be changed online.
void setCoMInertiaMatrix(const Matrix3 &I)
Set the 3x3 inertia matrix expressed in the user frame.
Kinematics getWorldContactPoseFromCentroid(Index numContact) const
Returns the pose of the contact in the world frame, obtained from the state pose of the centroid in t...
ExtendedKalmanFilter & getEKF()
Index unmodeledWrenchIndexTangent() const
Get the unmodeled external wrench index of the tangent state vector.
void stateNaNCorrection_()
Index contactPosIndexTangent(VectorContactConstIterator i) const
void setCoMInertiaMatrix(const Matrix3 &I, const Matrix3 &I_dot)
Set the 3x3 inertia matrix and its derivative expressed in the user frame.
void setProcessNoiseCovarianceMat(const Matrix &Q)
Set the covariance matrices for the process noises.
bool withGyroBias_
Definition kinetics-observer.hpp:1356
Index contactTorqueIndex(VectorContactConstIterator i) const
Index contactPosIndex(Index contactNbr) const
Get the index of the position of a specific contact in the sate vector.
void resetProcessGyroBiasCovMat(Index i)
Index getMeasurementSize() const
Get the Measurement vector Size.
bool withAccelerationEstimation_
Definition kinetics-observer.hpp:1358
TimeIndex k_est_
Definition kinetics-observer.hpp:1364
Vector measurementVector_
Definition kinetics-observer.hpp:1351
Index addContact(const Kinematics &pose, Index contactNumber=-1, const Matrix3 &linearStiffness=Matrix3::Constant(-1), const Matrix3 &linearDamping=Matrix3::Constant(-1), const Matrix3 &angularStiffness=Matrix3::Constant(-1), const Matrix3 &angularDamping=Matrix3::Constant(-1))
Set a new contact with the environment (use default covariance matrices)
static const double contactTorqueProcessVarianceDefault
Definition kinetics-observer.hpp:1495
Matrix3 gyroBiasProcessCovMat_
Definition kinetics-observer.hpp:1540
virtual void resetMeasurementNoise()
Removes the measurement noise.
void startNewIteration_()
void setGyroBias(const Vector3 &, unsigned numberOfIMU=1, bool resetCovariance=true)
Set the Gyro Bias Allows to initializa the value of the gyro bias of the IMU corresponding to the num...
static const double forceSensorVarianceDefault
Definition kinetics-observer.hpp:1499
kine::LocalKinematics LocalKinematics
Definition kinetics-observer.hpp:45
static const double angularStiffnessDefault
Definition kinetics-observer.hpp:1505
void removeContact(Index contactnbr)
Remove a contact.
Index unmodeledForceIndex() const
Get the unmodeled external linear force index of the state vector.
Index contactPosIndex(VectorContactConstIterator i) const
void computeContactForce_(VectorContactIterator i, LocalKinematics &worldCentroidStateKinematics, Kinematics &worldRestContactPose, Vector3 &contactForce, Vector3 &contactTorque)
Computes the force exerted at a contact using the visco-elastic model on the given state vector.
void setUnmodeledWrenchStateCovMat(const Matrix6 &newCovMat)
Set the Unmodeled Wrench State Cov Mat.
Matrix3 stateLinVelProcessCovMat_
Definition kinetics-observer.hpp:1538
Index measurementSize_
Definition kinetics-observer.hpp:1335
void setContactProcessCovMat(Index contactNbr, const Matrix12 &contactCovMat)
Set the Contact Process Covariance Matrix.
virtual Vector stateDynamics(const Vector &x, const Vector &u, TimeIndex k)
Applies the state-transition model to the given state vector using the given input to predict the fut...
virtual Matrix computeAMatrix()
Matrix getStateCovarianceMat() const
Get the State Covariance matrix.
void setAbsolutePoseSensor(const Kinematics &measurement, const Matrix6 &CovarianceMatrix)
Set an Absolute Pose Sensor measurement The measurement is the kinematics namely position and orienta...
LocalKinematics getLocalKinematicsOf(const Kinematics &userBodyKine)
Get the local kinematics of a given frame (in the user frame) in the centroid frame.
stateObservation::ExtendedKalmanFilter ekf_
Definition kinetics-observer.hpp:1354
kine::Kinematics Kinematics
Definition kinetics-observer.hpp:44
Matrix12 contactInitCovMatDefault_
Definition kinetics-observer.hpp:1534
Kinematics getGlobalCentroidKinematics() const
Get the estimated Kinematics of the centroid frame in the world frame.
Matrix3 angularStiffnessMatDefault_
Definition kinetics-observer.hpp:1517
kine::Orientation Orientation
Definition kinetics-observer.hpp:46
Matrix6 unmodeledWrenchProcessCovMat_
Definition kinetics-observer.hpp:1541
Matrix3 gyroCovMatDefault_
Definition kinetics-observer.hpp:1523
void setContactProcessCovarianceDefault(const Matrix12 &covMat)
Set the default contact Process Covariance.
Matrix3 statePosInitCovMat_
Definition kinetics-observer.hpp:1528
Index contactsIndexTangent() const
Get the index for the contact segment in the tangent state vector.
Kinematics worldCentroidKinematics_
Definition kinetics-observer.hpp:1343
static const double stateAngVelProcessVarianceDefault
Definition kinetics-observer.hpp:1489
virtual ~KineticsObserver()
Destroy the Kinetics Observer.
Index contactIndex(Index contactNbr) const
Get the index of a specific contact in the sate vector.
static const double gyroBiasInitVarianceDefault
Definition kinetics-observer.hpp:1481
Index gyroBiasIndexTangent(Index IMUNumber) const
Get the gyro bias index of the tangent state vector.
const IndexedVector3 & getAngularMomentum() const
Returns the angular momentum of the robot at the center of mass.
Index linVelIndexTangent() const
Get the linear velocity index of the tangent state vector.
Matrix measurementCovMatrix_
Definition kinetics-observer.hpp:1352
void setCoMInertiaMatrix(const Vector6 &I, const Vector6 &I_dot)
Set the inertia matrix and its derivative as a Vector6 expressed in the user frame.
const IndexedVector3 & getCenterOfMassDotDot() const
Returns the linear acceleration of the CoM of the robot in the user frame.
void setCoMAngularMomentum(const Vector3 &sigma)
Set the Angular Momentum around the CoM expressed in the user frame.
void setSamplingTime(double)
Set the Sampling Time.
Index contactForceIndex(Index contactNbr) const
Get the index of the linear force of a specific contact in the sate vector.
virtual void stateSum(const Vector &stateVector, const Vector &tangentVector, Vector &sum)
the sum operator for the state vector This version does not allocate a new vector
Matrix3 linearDampingMatDefault_
Definition kinetics-observer.hpp:1518
void resetStateKinematicsCovMat()
NoiseBase * processNoise_
Definition kinetics-observer.hpp:1371
void updateGlobalKine_()
updates the global kinematics of the centroid from the local ones, that can be more interpretable
void resetProcessContactCovMat(Index contactNbr)
AbsolutePoseSensor absPoseSensor_
Definition kinetics-observer.hpp:1328
void setWorldCentroidStateKinematics(const Kinematics &kine, bool resetCovariance=true)
Set the State Kinematics.
Index contactWrenchIndex(VectorContactConstIterator i) const
void convertUserToCentroidFrame_(const Kinematics &userKine, Kinematics ¢roidKine, TimeIndex k_data)
Converts a LocalKinematics object from the user's frame to the centroid's frame, which is used for mo...
std::vector< IMU, Eigen::aligned_allocator< IMU > > VectorIMU
Definition kinetics-observer.hpp:1031
static const double angularDampingDefault
Definition kinetics-observer.hpp:1507
Index contactKineIndex(VectorContactConstIterator i) const
Index stateTangentSize_
Definition kinetics-observer.hpp:1334
Index contactKineIndex(Index contactNbr) const
Get the index of the kinematics of a specific contact in the sate vector.
void setCoMInertiaMatrix(const Vector6 &I)
Set the inertia matrix as a Vector6 expressed in the user frame.
bool withUnmodeledWrench_
Definition kinetics-observer.hpp:1357
Vector3 initTotalCentroidTorque_
Definition kinetics-observer.hpp:1349
Index contactTorqueIndexTangent(Index contactNbr) const
Get the index of the toraue of a specific contact in the tangent sate vector.
virtual NoiseBase * getMeasurementNoise() const
Gets a pointer on the measurement noise.
void setContactInitCovMatDefault(const Matrix12 &contactCovMat)
Set the default valut for the Initial Covariance Matrix of the contact in the state.
Index gyroBiasIndexTangent(VectorIMUConstIterator i) const
Matrix6 contactWrenchSensorCovMatDefault_
Definition kinetics-observer.hpp:1524
Index contactTorqueIndex(Index contactNbr) const
Get the index of the toraue of a specific contact in the sate vector.
static const double defaultdx
default derivation steps
Definition kinetics-observer.hpp:1552
void setUnmodeledWrenchProcessCovMat(const Matrix6 &processCovMat)
Set the Unmodeled Wrench Process Covariance Mattix.
void setWithUnmodeledWrench(bool b=true)
Set if the unmodeled and unmeasured external wrench should be estimated.
static const double orientationSensorVarianceDefault
Definition kinetics-observer.hpp:1502
friend int testAnalyticalAJacobianVsFD(KineticsObserver &ko, int errcode, double relativeErrorThreshold, double threshold)
Comparison between the analytical Jacobian matrix A and the one obtained by finite differences....
Matrix12 stateKinematicsProcessCovMat_
Definition kinetics-observer.hpp:1549
Index gyroBiasIndex(VectorIMUConstIterator i) const
Getters for the indexes of the state Vector using private types.
Index contactTorqueIndexTangent(VectorContactConstIterator i) const
const IndexedVector3 & getCenterOfMass() const
Returns the position of the CoM of the robot in the user frame.
Matrix3 contactOrientationProcessCovMat_
Definition kinetics-observer.hpp:1543
unsigned maxImuNumber_
Definition kinetics-observer.hpp:1326
static const double defaultMass
Definition kinetics-observer.hpp:1475
unsigned maxContacts_
Definition kinetics-observer.hpp:1325
void resetStateGyroBiasCovMat(Index i)
std::vector< Index > getListOfContacts() const
Get the List Of Contact ids.
Index unmodeledTorqueIndexTangent() const
Get the unmodeled external torque force index of the tangent state vector.
void setIMUDefaultCovarianceMatrix(const Matrix3 &acceleroCov, const Matrix3 &gyroCov)
set the default covariance matrix for IMU.
Vector3 additionalForce_
Definition kinetics-observer.hpp:1345
void setKinematicsStateCovariance(const Matrix &)
Set the Kinematics State Covariance.
Matrix12 stateKinematicsInitCovMat_
Definition kinetics-observer.hpp:1548
static const double stateLinVelInitVarianceDefault
Definition kinetics-observer.hpp:1479
void setAdditionalWrench(const Vector3 &force, const Vector3 &torque)
Set any Additional resultant known wrench (e.g. measured external forces and moments but no contact o...
void resetProcessContactsCovMat()
static const double linearDampingDefault
Definition kinetics-observer.hpp:1506
VectorIMU::iterator VectorIMUIterator
Definition kinetics-observer.hpp:1032
KineticsObserver(unsigned maxContacts=4, unsigned maxNumberOfIMU=1)
Construct a new Kinetics Observer.
void addContactWrench_(const Kinematics ¢roidContactKine, const Vector3 ¢roidContactForce, const Vector3 ¢roidContactTorque, Vector3 &totalCentroidForce, Vector3 &totalCentroidTorque)
adds the contribution of a contact wrench at the centroid to the total wrench
const Vector & getCurrentStateVector() const
Gets the current value of the state estimation in the form of a state vector .
void resetStateContactsCovMat()
Index contactWrenchIndex(Index contactNbr) const
Get the index of the wrench of a specific contact in the sate vector.
VectorIMU imuSensors_
Definition kinetics-observer.hpp:1331
Index addContact(const Kinematics &pose, const Matrix12 &initialCovarianceMatrix, const Matrix12 &processCovarianceMatrix, Index contactNumber=-1, const Matrix3 &linearStiffness=Matrix3::Constant(-1), const Matrix3 &linearDamping=Matrix3::Constant(-1), const Matrix3 &angularStiffness=Matrix3::Constant(-1), const Matrix3 &angularDamping=Matrix3::Constant(-1))
Set a new contact with the environment.
Index contactKineIndexTangent(Index contactNbr) const
Get the index of the kinematics of a specific contact in the tangent sate vector.
Index contactWrenchIndexTangent(Index contactNbr) const
Get the index of the wrench of a specific contact in the sate tangent vector.
static const double contactOrientationProcessVarianceDefault
Definition kinetics-observer.hpp:1493
Matrix3 acceleroCovMatDefault_
Definition kinetics-observer.hpp:1522
Matrix3 angularDampingMatDefault_
Definition kinetics-observer.hpp:1519
virtual NoiseBase * getProcessNoise() const
Gets the process noise.
void setCenterOfMass(const Vector3 &com, const Vector3 &com_dot, const Vector3 &com_dot_dot)
Set the Center Of Mass kinematics expressed in the user frame.
IndexedVector3 sigma_
Definition kinetics-observer.hpp:1361
double getSamplingTime() const
Get the Sampling Time.
Index oriIndexTangent() const
Get the orientation index of the tangent state vector.
Index contactOriIndex(Index contactNbr) const
Get the index of the orientation of a specific contact in the sate vector.
Definition noise-base.hpp:29
This class is used to customize the way the difference between measurements, the state update functio...
Definition state-vector-arithmetics.hpp:28
Definition rigid-body-kinematics.hpp:355
Definitions of types and some structures.
Definition bidim-elastic-inv-pendulum-dyn-sys.hpp:21
long int TimeIndex
Definition definitions.hpp:139
Eigen::Vector3d Vector3
3D vector
Definition definitions.hpp:85
Eigen::Matrix3d Matrix3
3x3 Scalar Matrix
Definition definitions.hpp:109
Eigen::MatrixXd Matrix
Dynamic sized Matrix.
Definition definitions.hpp:100
Eigen::Matrix< double, 6, 1 > Vector6
6D vector
Definition definitions.hpp:97
Eigen::Matrix< double, 6, 6 > Matrix6
6x6 Scalar Matrix
Definition definitions.hpp:121
Eigen::Index Index
Definition definitions.hpp:138
Eigen::Matrix< double, 12, 12 > Matrix12
12x12 scalar Matrix
Definition definitions.hpp:124
Eigen::VectorXd Vector
Dynamic sized scalar vector.
Definition definitions.hpp:76
Implements integrators for the kinematics, in terms or rotations and translations.
Definition kinetics-observer.hpp:1087
Orientation ori
Definition kinetics-observer.hpp:1090
AbsoluteOriSensor()
Definition kinetics-observer.hpp:1088
CheckedMatrix3 covMatrix
Definition kinetics-observer.hpp:1091
Definition kinetics-observer.hpp:1078
Kinematics pose
Definition kinetics-observer.hpp:1081
CheckedMatrix6 covMatrix
Definition kinetics-observer.hpp:1083
AbsolutePoseSensor()
Definition kinetics-observer.hpp:1079
Definition kinetics-observer.hpp:1015
LocalKinematics centroidImuKinematics
Definition kinetics-observer.hpp:1020
Vector6 acceleroGyro
Definition kinetics-observer.hpp:1021
Matrix3 covMatrixAccelero
Definition kinetics-observer.hpp:1022
Index stateIndex
Definition kinetics-observer.hpp:1025
Index stateIndexTangent
Definition kinetics-observer.hpp:1026
~IMU()
Definition kinetics-observer.hpp:1016
Kinematics userImuKinematics
Definition kinetics-observer.hpp:1019
Matrix3 covMatrixGyro
Definition kinetics-observer.hpp:1023
IMU()
Definition kinetics-observer.hpp:1017
a structure to optimize computations
Definition kinetics-observer.hpp:1556
Orientation & ori2
Definition kinetics-observer.hpp:1563
LocalKinematics & locKine
Definition kinetics-observer.hpp:1560
Orientation & ori
Definition kinetics-observer.hpp:1561
Opt()
Definition kinetics-observer.hpp:1557
LocalKinematics locKine1
Definition kinetics-observer.hpp:1559
Orientation & ori1
Definition kinetics-observer.hpp:1562
Definition kinetics-observer.hpp:1000
Sensor(Index signalSize)
Definition kinetics-observer.hpp:1001
Vector extractFromVector(const Vector &v)
Definition kinetics-observer.hpp:1008
Index measIndexTangent
Definition kinetics-observer.hpp:1004
Index size
Definition kinetics-observer.hpp:1005
~Sensor()
Definition kinetics-observer.hpp:1002
Index measIndex
Definition kinetics-observer.hpp:1003
TimeIndex time
Definition kinetics-observer.hpp:1006
Class facilitating the manipulation of the kinematics of a frame within another and the associated op...
Definition rigid-body-kinematics.hpp:585
Class facilitating the manipulation of the local kinematics of a frame within another and the associa...
Definition rigid-body-kinematics.hpp:678