DynamicsConstraint.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 
10 
11 #include <Tasks/QPMotionConstr.h>
12 
13 namespace mc_solver
14 {
15 
21 {
22 public:
32  DynamicsConstraint(const mc_rbdyn::Robots & robots, unsigned int robotIndex, double timeStep, bool infTorque = false);
33 
47  unsigned int robotIndex,
48  double timeStep,
49  const std::array<double, 3> & damper,
50  double velocityPercent = 1.0,
51  bool infTorque = false);
52 
57  inline tasks::qp::MotionConstr & motionConstr() noexcept
58  {
59  assert(backend_ == QPSolver::Backend::Tasks);
60  return *static_cast<tasks::qp::MotionConstr *>(motion_constr_.get());
61  }
62 
68  {
69  assert(backend_ == QPSolver::Backend::TVM);
70  return *(static_cast<mc_tvm::DynamicFunctionPtr *>(motion_constr_.get())->get());
71  }
72 
73  void addToSolverImpl(QPSolver & solver) override;
74 
75  void removeFromSolverImpl(QPSolver & solver) override;
76 
77  inline unsigned int robotIndex() const noexcept { return robotIndex_; }
78 
79 protected:
90  unsigned int robotIndex_;
91 };
92 
93 } // namespace mc_solver
#define MC_SOLVER_DLLAPI
Definition: api.h:50
std::unique_ptr< void, void(*)(void *)> void_ptr
Definition: void_ptr.h:14
Definition: Contact.h:18
std::shared_ptr< DynamicFunction > DynamicFunctionPtr
Definition: DynamicFunction.h:117
Definition: Robots.h:16
Definition: DynamicsConstraint.h:21
DynamicsConstraint(const mc_rbdyn::Robots &robots, unsigned int robotIndex, double timeStep, bool infTorque=false)
DynamicsConstraint(const mc_rbdyn::Robots &robots, unsigned int robotIndex, double timeStep, const std::array< double, 3 > &damper, double velocityPercent=1.0, bool infTorque=false)
void removeFromSolverImpl(QPSolver &solver) override
unsigned int robotIndex() const noexcept
Definition: DynamicsConstraint.h:77
mc_tvm::DynamicFunction & dynamicFunction()
Definition: DynamicsConstraint.h:67
unsigned int robotIndex_
Definition: DynamicsConstraint.h:90
tasks::qp::MotionConstr & motionConstr() noexcept
Definition: DynamicsConstraint.h:57
void addToSolverImpl(QPSolver &solver) override
mc_rtc::void_ptr motion_constr_
Definition: DynamicsConstraint.h:88
Definition: KinematicsConstraint.h:20
Definition: QPSolver.h:86
Definition: DynamicFunction.h:32