|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <simple-mpc/inverse-dynamics/kinodynamics.hpp> |
| 4 | +#include <tsid/tasks/task-com-equality.hpp> |
| 5 | + |
| 6 | +namespace simple_mpc |
| 7 | +{ |
| 8 | + |
| 9 | + class CentroidalID : public KinodynamicsID |
| 10 | + { |
| 11 | + public: |
| 12 | + typedef Eigen::VectorXd TargetContactForce; |
| 13 | + // typedef Eigen::Matrix<double, Eigen::Dynamic, 1, 0, 6, 1> TargetContactForce; |
| 14 | + typedef PINOCCHIO_ALIGNED_STD_VECTOR(pinocchio::SE3) FeetPoseVector; |
| 15 | + typedef PINOCCHIO_ALIGNED_STD_VECTOR(pinocchio::Motion) FeetVelocityVector; |
| 16 | + |
| 17 | + struct Settings : public KinodynamicsID::Settings |
| 18 | + { |
| 19 | + // Tasks gains |
| 20 | + DEFINE_FIELD(double, kp_com, 0.) |
| 21 | + DEFINE_FIELD(double, kp_feet_tracking, 0.) |
| 22 | + |
| 23 | + // Tasks weights |
| 24 | + DEFINE_FIELD(double, w_com, -1.) // Disabled by default |
| 25 | + DEFINE_FIELD(double, w_feet_tracking, -1.) // Disabled by default |
| 26 | + }; |
| 27 | + |
| 28 | + CentroidalID(const RobotModelHandler & model_handler, double control_dt, const Settings settings); |
| 29 | + |
| 30 | + void setTarget( |
| 31 | + const Eigen::Ref<const Eigen::Vector<double, 3>> & com_position, |
| 32 | + const Eigen::Ref<const Eigen::Vector<double, 3>> & com_velocity, |
| 33 | + const FeetPoseVector & feet_pose, |
| 34 | + const FeetVelocityVector & feet_velocity, |
| 35 | + const std::vector<bool> & contact_state_target, |
| 36 | + const std::vector<TargetContactForce> & f_target); |
| 37 | + |
| 38 | + using KinodynamicsID::getAccelerations; |
| 39 | + using KinodynamicsID::solve; |
| 40 | + |
| 41 | + private: |
| 42 | + using KinodynamicsID::KinodynamicsID; |
| 43 | + using KinodynamicsID::setTarget; |
| 44 | + |
| 45 | + public: |
| 46 | + // Order matters to be instantiated in the right order |
| 47 | + const Settings settings_; |
| 48 | + |
| 49 | + private: |
| 50 | + std::shared_ptr<tsid::tasks::TaskComEquality> comTask_; |
| 51 | + std::vector<tsid::tasks::TaskSE3Equality> trackingTasks_; |
| 52 | + tsid::trajectories::TrajectorySample sampleCom_; // TODO: no need to store it |
| 53 | + std::vector<tsid::trajectories::TrajectorySample> trackingSamples_; // TODO: no need to store it |
| 54 | + std::vector<bool> feet_tracked_; |
| 55 | + }; |
| 56 | + |
| 57 | +} // namespace simple_mpc |
0 commit comments