Commit 9e3474f8 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

ContactSequence : add method haveZMPtrajectories

parent 6045f354
...@@ -159,6 +159,8 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth ...@@ -159,6 +159,8 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth
.def("haveFriction", &CS::haveFriction, .def("haveFriction", &CS::haveFriction,
"check that all the contact patch used in the sequence have" "check that all the contact patch used in the sequence have"
"a friction coefficient initialized.") "a friction coefficient initialized.")
.def("haveZMPtrajectories", &CS::haveZMPtrajectories,
"check that all the contact phases have a ZMP trajectory.")
.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,
......
...@@ -823,6 +823,31 @@ struct ContactSequenceTpl : public serialization::Serializable<ContactSequenceTp ...@@ -823,6 +823,31 @@ struct ContactSequenceTpl : public serialization::Serializable<ContactSequenceTp
return true; return true;
} }
/**
* @brief haveZMPtrajectories check that all the contact phases have a zmp trajectory
* @return
*/
bool haveZMPtrajectories(){
size_t i = 0;
for(const ContactPhase& phase : m_contact_phases){
if(!phase.m_zmp){
std::cout<<"ZMP trajectory not defined for phase : "<<i<<std::endl;
return false;
}
if(phase.m_zmp->min() != phase.timeInitial()){
std::cout<<"ZMP trajectory do not start at t_init for phase : "<<i<<std::endl;
return false;
}
if(phase.m_zmp->max() != phase.timeFinal()){
std::cout<<"ZMP trajectory do not end at t_final for phase : "<<i<<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