GenInequalityConstraint.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 
9 namespace mc_solver
10 {
11 
12 namespace utils
13 {
14 
35 template<typename UpdateT>
36 struct GenInequalityConstraint : public Constraint<tasks::qp::GenInequality, UpdateT>
37 {
39 
40  // XXX The following is a hack to work-around the absence of constructor inheritance in GCC 4.7
41  // We enable different constructor based on the UpdateT class
42 
43  template<typename U = UpdateT, typename = typename std::enable_if<std::is_same<U, utils::UpdateRobot>::value>::type>
44  explicit GenInequalityConstraint(unsigned int rIndex) : Base(rIndex)
45  {
46  }
47 
48  template<typename U = UpdateT, typename = typename std::enable_if<std::is_same<U, utils::UpdateLambda>::value>::type>
49  explicit GenInequalityConstraint(const tasks::qp::ContactId & cid) : Base(cid)
50  {
51  }
52 
53  template<typename U = UpdateT, typename = typename std::enable_if<std::is_same<U, utils::UpdateForce>::value>::type>
54  GenInequalityConstraint(const mc_solver::QPSolver & solver, const tasks::qp::ContactId & cid) : Base(solver, cid)
55  {
56  }
57 
58  const Eigen::MatrixXd & AGenInEq() const override { return this->AFull_; }
59 
60  std::string descGenInEq(const std::vector<rbd::MultiBody> &, int i) override
61  {
62  std::stringstream ss;
63  ss << "Failure at line " << i << " for inequality " << this->nameGenInEq();
64  return ss.str();
65  }
66 };
67 
68 } // namespace utils
69 
89 {
90  explicit GenInequalityConstraintRobot(unsigned int rIndex)
91  : utils::GenInequalityConstraint<utils::UpdateRobot>(rIndex)
92  {
93  }
94 };
95 
123 {
124  explicit GenInequalityConstraintLambda(const tasks::qp::ContactId & cid)
125  : utils::GenInequalityConstraint<utils::UpdateLambda>(cid)
126  {
127  }
128 };
129 
152 {
153  GenInequalityConstraintForce(const mc_solver::QPSolver & solver, const tasks::qp::ContactId & cid)
154  : utils::GenInequalityConstraint<utils::UpdateForce>(solver, cid)
155  {
156  }
157 };
158 
159 } // namespace mc_solver
mc_solver::utils::GenInequalityConstraint
Definition: GenInequalityConstraint.h:36
mc_solver::QPSolver
Definition: QPSolver.h:85
Constraint.h
mc_solver::utils::GenInequalityConstraint::GenInequalityConstraint
GenInequalityConstraint(const mc_solver::QPSolver &solver, const tasks::qp::ContactId &cid)
Definition: GenInequalityConstraint.h:54
mc_solver::GenInequalityConstraintForce::GenInequalityConstraintForce
GenInequalityConstraintForce(const mc_solver::QPSolver &solver, const tasks::qp::ContactId &cid)
Definition: GenInequalityConstraint.h:153
mc_solver::utils::GenInequalityConstraint::GenInequalityConstraint
GenInequalityConstraint(const tasks::qp::ContactId &cid)
Definition: GenInequalityConstraint.h:49
mc_solver::utils::UpdateLambda
Update< UpdateNrVarsLambda > UpdateLambda
Definition: Update.h:72
mc_solver::GenInequalityConstraintRobot
Definition: GenInequalityConstraint.h:88
mc_solver::utils::GenInequalityConstraint::AGenInEq
const Eigen::MatrixXd & AGenInEq() const override
Definition: GenInequalityConstraint.h:58
mc_solver::GenInequalityConstraintRobot::GenInequalityConstraintRobot
GenInequalityConstraintRobot(unsigned int rIndex)
Definition: GenInequalityConstraint.h:90
mc_solver::utils::UpdateForce::UpdateForce
UpdateForce(const mc_solver::QPSolver &solver, const tasks::qp::ContactId &cid)
mc_solver::utils::UpdateRobot
Update< UpdateNrVarsRobot > UpdateRobot
Definition: Update.h:71
mc_solver::GenInequalityConstraintForce
Definition: GenInequalityConstraint.h:151
mc_solver::GenInequalityConstraintLambda::GenInequalityConstraintLambda
GenInequalityConstraintLambda(const tasks::qp::ContactId &cid)
Definition: GenInequalityConstraint.h:124
mc_solver::utils::Constraint
Definition: Constraint.h:28
mc_solver
Definition: Contact.h:17
mc_solver::utils::GenInequalityConstraint::GenInequalityConstraint
GenInequalityConstraint(unsigned int rIndex)
Definition: GenInequalityConstraint.h:44
mc_solver::utils::GenInequalityConstraint::descGenInEq
std::string descGenInEq(const std::vector< rbd::MultiBody > &, int i) override
Definition: GenInequalityConstraint.h:60
mc_solver::GenInequalityConstraintLambda
Definition: GenInequalityConstraint.h:122