Commit 6045f354 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

Contact sequence : add method haveFriction

parent 67b2d585
...@@ -156,6 +156,9 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth ...@@ -156,6 +156,9 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth
.def("haveRootTrajectories", &CS::haveRootTrajectories, .def("haveRootTrajectories", &CS::haveRootTrajectories,
"check that a root trajectory exist for each contact phases.\n" "check that a root trajectory exist for each contact phases.\n"
"Also check that it start and end at the correct time interval.") "Also check that it start and end at the correct time interval.")
.def("haveFriction", &CS::haveFriction,
"check that all the contact patch used in the sequence have"
"a friction coefficient initialized.")
.def("getAllEffectorsInContact",&getAllEffectorsInContactAsList, .def("getAllEffectorsInContact",&getAllEffectorsInContactAsList,
"return a list of names of all the effectors used to create contacts during the sequence") "return a list of names of all the effectors used to create contacts during the sequence")
.def("concatenateCtrajectories", &CS::concatenateCtrajectories, .def("concatenateCtrajectories", &CS::concatenateCtrajectories,
......
...@@ -804,6 +804,25 @@ struct ContactSequenceTpl : public serialization::Serializable<ContactSequenceTp ...@@ -804,6 +804,25 @@ struct ContactSequenceTpl : public serialization::Serializable<ContactSequenceTp
} }
/**
* @brief haveFriction check that all the contact patch used in the sequence have
* a friction coefficient initialized
* @return
*/
bool haveFriction() const{
size_t i = 0;
for(const ContactPhase& phase : m_contact_phases){
for(const std::string& eeName : phase.effectorsInContact()){
if(phase.contactPatches().at(eeName).friction() <= 0.){
std::cout<<"Friction not defined for phase "<<i<<" and effector "<<eeName<<std::endl;
return false;
}
}
++i;
}
return true;
}
/** /**
* @brief getAllEffectorsInContact return a vector of names of all the effectors used to create contacts during the sequence * @brief getAllEffectorsInContact return a vector of names of all the effectors used to create contacts during the sequence
* @return * @return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment