5 #ifndef _H_MCRBDYN_CONTACT_H_
6 #define _H_MCRBDYN_CONTACT_H_
11 #include <Tasks/QPContacts.h>
13 #include <SpaceVecAlg/SpaceVecAlg>
22 QPContactPtr() : unilateralContact(nullptr), bilateralContact(nullptr) {}
30 std::vector<sva::PTransformd>
points;
44 const sva::PTransformd & X_es_rs);
51 constexpr
static int nrConeGen = 4;
52 constexpr
static double defaultFriction = 0.7;
53 constexpr
static unsigned int nrBilatPoints = 4;
57 const std::string & robotSurface,
58 const std::string & envSurface,
59 double friction = defaultFriction);
61 const std::string & robotSurface,
62 const std::string & envSurface,
63 const sva::PTransformd & X_es_rs,
64 double friction = defaultFriction);
68 const std::string & r1Surface,
69 const std::string & r2Surface,
70 double friction = defaultFriction,
71 int ambiguityId = -1);
75 const std::string & r1Surface,
76 const std::string & r2Surface,
77 const sva::PTransformd & X_r2s_r1s,
78 double friction = defaultFriction,
79 int ambiguityId = -1);
83 const std::string & r1Surface,
84 const std::string & r2Surface,
85 const sva::PTransformd & X_r2s_r1s,
86 const sva::PTransformd & X_b_s,
87 double friction = defaultFriction,
88 int ambiguityId = -1);
92 const std::string & robotSurface,
93 const std::string & envSurface,
94 const sva::PTransformd & X_es_rs,
103 unsigned int r1Index()
const;
105 unsigned int r2Index()
const;
107 const std::shared_ptr<mc_rbdyn::Surface> & r1Surface()
const;
109 const std::shared_ptr<mc_rbdyn::Surface> & r2Surface()
const;
111 const sva::PTransformd & X_r2s_r1s()
const;
113 void X_r2s_r1s(
const sva::PTransformd & in);
115 const sva::PTransformd & X_b_s()
const;
117 const int & ambiguityId()
const;
119 bool isFixed()
const;
122 double friction()
const;
125 void friction(
double friction);
127 std::pair<std::string, std::string> surfaces()
const;
135 std::vector<sva::PTransformd> r1Points();
137 std::vector<sva::PTransformd> r2Points();
146 const sva::PTransformd * X_es_rs =
nullptr)
const;
148 std::string toStr()
const;
153 inline const Eigen::Vector6d &
dof() const noexcept {
return dof_; }
155 inline void dof(
const Eigen::Vector6d & dof) noexcept { dof_ =
dof; }
158 bool operator!=(
const Contact & rhs)
const;
161 std::unique_ptr<ContactImpl> impl;
162 Eigen::Vector6d dof_ = Eigen::Vector6d::Ones();
164 const sva::PTransformd & X_b1_b2,
165 const std::vector<sva::PTransformd> & points)
const;
170 static std::vector<mc_rbdyn::Contact> loadVector(
const mc_rbdyn::Robots & robots,