11 #include <tvm/ControlProblem.h>
12 #include <tvm/LinearizedControlProblem.h>
13 #include <tvm/scheme/WeightedLeastSquares.h>
31 void setContacts(
ControllerToken,
const std::vector<mc_rbdyn::Contact> & contacts)
final;
33 const sva::ForceVecd desiredContactForce(
const mc_rbdyn::Contact &
id)
const final;
35 double solveTime()
final;
37 double solveAndBuildTime()
final;
40 inline tvm::LinearizedControlProblem &
problem() noexcept {
return problem_; }
43 inline const tvm::LinearizedControlProblem &
problem() const noexcept {
return problem_; }
71 tvm::LinearizedControlProblem problem_;
73 tvm::scheme::WeightedLeastSquares solver_;
78 tvm::TaskWithRequirementsPtr contactConstraint_;
80 tvm::VariableVector f1_;
82 std::vector<tvm::TaskWithRequirementsPtr> f1Constraints_;
84 tvm::VariableVector f2_;
86 std::vector<tvm::TaskWithRequirementsPtr> f2Constraints_;
89 std::vector<ContactData> contactsData_;
98 bool runJointsFeedback(
bool wVelocity);
120 bool runClosedLoop(
bool integrateControlState);
126 std::vector<std::vector<double>> prev_encoders_{};
127 std::vector<std::vector<double>> encoders_alpha_{};
128 std::vector<std::vector<std::vector<double>>> control_q_{};
129 std::vector<std::vector<std::vector<double>>> control_alpha_{};
132 std::unordered_map<std::string, DynamicsConstraint *> dynamics_;
134 bool run_impl(FeedbackType fType = FeedbackType::None)
final;
143 using ContactIterator = std::vector<mc_rbdyn::Contact>::iterator;
144 ContactIterator removeContact(
size_t idx);
145 std::tuple<size_t, bool> addVirtualContactImpl(
const mc_rbdyn::Contact & contact);
146 void addContactToDynamics(
const std::string & robot,
148 const std::vector<sva::PTransformd> & points,
149 tvm::VariableVector & forces,
150 std::vector<tvm::TaskWithRequirementsPtr> & constraints,
151 const Eigen::MatrixXd & frictionCone,