|
5 | 5 | #include <tsid/formulations/inverse-dynamics-formulation-acc-force.hpp> |
6 | 6 | #include <tsid/solvers/solver-HQP-factory.hxx> |
7 | 7 | #include <tsid/solvers/utils.hpp> |
| 8 | +#include <tsid/tasks/task-actuation-bounds.hpp> |
8 | 9 | #include <tsid/tasks/task-joint-bounds.hpp> |
9 | 10 | #include <tsid/tasks/task-joint-posVelAcc-bounds.hpp> |
10 | 11 | #include <tsid/tasks/task-joint-posture.hpp> |
@@ -114,6 +115,12 @@ namespace simple_mpc |
114 | 115 | true, true, true, false); // For now do not impose acceleration bound as it is not provided in URDF |
115 | 116 | formulation_.addMotionTask(*boundsTask_, 1.0, 0); // No weight needed as it is set as constraint |
116 | 117 |
|
| 118 | + // Add actuation limit task |
| 119 | + actuationTask_ = std::make_shared<tsid::tasks::TaskActuationBounds>("actuation-limits", robot_); |
| 120 | + actuationTask_->setBounds( |
| 121 | + model_handler_.getModel().lowerEffortLimit.tail(nu), model_handler_.getModel().upperEffortLimit.tail(nu)); |
| 122 | + formulation_.addActuationTask(*actuationTask_, 1.0, 0); // No weight needed as it is set as constraint |
| 123 | + |
117 | 124 | // Create an HQP solver |
118 | 125 | solver_ = tsid::solvers::SolverHQPFactory::createNewSolver(tsid::solvers::SOLVER_HQP_PROXQP, "solver-proxqp"); |
119 | 126 | solver_->resize(formulation_.nVar(), formulation_.nEq(), formulation_.nIn()); |
@@ -216,6 +223,7 @@ namespace simple_mpc |
216 | 223 | std::shared_ptr<tsid::tasks::TaskJointPosture> postureTask_; |
217 | 224 | std::shared_ptr<tsid::tasks::TaskSE3Equality> baseTask_; |
218 | 225 | std::shared_ptr<tsid::tasks::TaskJointPosVelAccBounds> boundsTask_; |
| 226 | + std::shared_ptr<tsid::tasks::TaskActuationBounds> actuationTask_; |
219 | 227 | tsid::solvers::SolverHQPBase * solver_; |
220 | 228 | tsid::solvers::HQPOutput last_solution_; |
221 | 229 | tsid::trajectories::TrajectorySample samplePosture_; // TODO: no need to store it |
|
0 commit comments