23 , contactForcesVariable(m.getName()+
"_fc")
24 , Jct_isUpToDate(false)
29 : pimpl(new
Pimpl(model))
36 pimpl->model.disconnect<
EVT_CHANGE_VALUE>(*
this, &ModelContacts::invalidate);
41 ocra_assert(std::find(pimpl->contactFeatures.begin(), pimpl->contactFeatures.end(), &contactFeature) == pimpl->contactFeatures.end()
42 &&
"This contact point was already added");
43 ocra_assert(std::find(pimpl->forceVariables.begin(), pimpl->forceVariables.end(), &f) == pimpl->forceVariables.end()
44 &&
"This force variable was already added");
48 pimpl->contactForcesVariable.add(f);
49 pimpl->forceVariables.push_back(&f);
52 pimpl->contactFeatures.push_back(&contactFeature);
62 std::vector<Variable*>::iterator it = std::find(pimpl->forceVariables.begin(), pimpl->forceVariables.end(), &f);
64 if (it != pimpl->forceVariables.end())
67 pimpl->forceVariables.erase(it);
68 pimpl->contactForcesVariable.remove(f);
69 pimpl->contactFeatures.erase(pimpl->contactFeatures.begin()+i);
78 while (pimpl->forceVariables.size()>0)
80 pimpl->contactFeatures.pop_back();
81 pimpl->contactForcesVariable.remove(*pimpl->forceVariables.back());
82 pimpl->forceVariables.pop_back();
90 return pimpl->contactForcesVariable;
95 if(!pimpl->Jct_isUpToDate)
100 pimpl->Jct_isUpToDate =
true;
108 return static_cast<int>(pimpl->contactFeatures.size());
113 return std::make_pair(pimpl->forceVariables[index], pimpl->contactFeatures[index]);
118 return *pimpl->forceVariables[index];
123 return *pimpl->contactFeatures[index];
131 void ModelContacts::invalidate(
int timestamp)
133 pimpl->Jct_isUpToDate =
false;
virtual const Eigen::MatrixXd & computeJacobian(const Feature &featureDes) const =0
Declaration file of the Model class.
A class hierarchy to compute task errors based on control frames.
Feature interface, used by tasks to compute errors and jacobians.
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
This class represents a variable in a mathematical sense.
A concatenation of base variables and other composite variables.
virtual int getDimension() const =0
#define ocra_assert(ocra_expression)
Declaration file of the Variable class.
double distance(double a, double b)