Skip to content

Commit b221d1f

Browse files
author
earlaud
committed
Add actuation limit task
1 parent 8a73a0d commit b221d1f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/simple-mpc/inverse-dynamics.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <tsid/formulations/inverse-dynamics-formulation-acc-force.hpp>
66
#include <tsid/solvers/solver-HQP-factory.hxx>
77
#include <tsid/solvers/utils.hpp>
8+
#include <tsid/tasks/task-actuation-bounds.hpp>
89
#include <tsid/tasks/task-joint-bounds.hpp>
910
#include <tsid/tasks/task-joint-posVelAcc-bounds.hpp>
1011
#include <tsid/tasks/task-joint-posture.hpp>
@@ -114,6 +115,12 @@ namespace simple_mpc
114115
true, true, true, false); // For now do not impose acceleration bound as it is not provided in URDF
115116
formulation_.addMotionTask(*boundsTask_, 1.0, 0); // No weight needed as it is set as constraint
116117

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+
117124
// Create an HQP solver
118125
solver_ = tsid::solvers::SolverHQPFactory::createNewSolver(tsid::solvers::SOLVER_HQP_PROXQP, "solver-proxqp");
119126
solver_->resize(formulation_.nVar(), formulation_.nEq(), formulation_.nIn());
@@ -216,6 +223,7 @@ namespace simple_mpc
216223
std::shared_ptr<tsid::tasks::TaskJointPosture> postureTask_;
217224
std::shared_ptr<tsid::tasks::TaskSE3Equality> baseTask_;
218225
std::shared_ptr<tsid::tasks::TaskJointPosVelAccBounds> boundsTask_;
226+
std::shared_ptr<tsid::tasks::TaskActuationBounds> actuationTask_;
219227
tsid::solvers::SolverHQPBase * solver_;
220228
tsid::solvers::HQPOutput last_solution_;
221229
tsid::trajectories::TrajectorySample samplePosture_; // TODO: no need to store it

0 commit comments

Comments
 (0)