9 #include <Tasks/QPMotionConstr.h>
10 #include <Tasks/QPSolver.h>
23 positive_lambda_constraint_.addToSolver(this->robots().mbs(), solver_);
28 positive_lambda_constraint_.addToSolver(robots().mbs(), solver_);
39 void addTask(tasks::qp::Task * task);
42 inline
void addTask(
std::shared_ptr<tasks::qp::Task> task)
47 shPtrTasksStorage.emplace_back(task);
56 void removeTask(tasks::qp::Task * task);
58 void setContacts(ControllerToken,
const std::vector<mc_rbdyn::Contact> & contacts)
final;
64 template<
typename... Fun>
67 constraint->addToSolver(robots().mbs(), solver_);
68 solver_.updateConstrSize();
69 solver_.updateNrVars(robots().mbs());
75 template<
typename... Fun>
78 constraint->removeFromSolver(solver_);
79 solver_.updateConstrSize();
80 solver_.updateNrVars(robots().mbs());
88 std::pair<int, const tasks::qp::BilateralContact &> contactById(
const tasks::qp::ContactId &
id)
const;
94 Eigen::VectorXd lambdaVec(
int cIndex)
const;
96 const sva::ForceVecd desiredContactForce(
const mc_rbdyn::Contact &
id)
const final;
114 void updateConstrSize();
117 inline tasks::qp::SolverData &
data() noexcept {
return solver_.data(); }
120 inline const tasks::qp::SolverData &
data() const noexcept {
return solver_.data(); }
123 tasks::qp::QPSolver &
solver() noexcept {
return solver_; }
126 const tasks::qp::QPSolver &
solver() const noexcept {
return solver_; }
152 double solveTime() final;
154 double solveAndBuildTime() final;
156 const Eigen::VectorXd & result() const;
162 tasks::qp::PositiveLambda positive_lambda_constraint_;
164 std::vector<tasks::qp::UnilateralContact> uniContacts_;
166 std::vector<tasks::qp::BilateralContact> biContacts_;
170 bool runJointsFeedback(
bool wVelocity);
191 bool runClosedLoop(
bool integrateControlState);
194 std::vector<
std::vector<
double>> prev_encoders_{};
195 std::vector<std::vector<double>> encoders_alpha_{};
196 std::vector<std::vector<std::vector<double>>> control_q_{};
197 std::vector<std::vector<std::vector<double>>> control_alpha_{};
200 std::vector<mc_solver::DynamicsConstraint *> dynamicsConstraints_;
202 bool run_impl(FeedbackType fType = FeedbackType::None)
final;