...
 
Commits (10)
......@@ -32,10 +32,11 @@ INCLUDE(cmake/ide.cmake)
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
SET(CMAKE_CXX_STANDARD 11)
# Project dependencies
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED PKG_CONFIG_REQUIRES "pinocchio >= 2.0.0")
ADD_PROJECT_DEPENDENCY(curves 0.4.1 REQUIRED PKG_CONFIG_REQUIRES "curves >= 0.4.1")
ADD_PROJECT_DEPENDENCY(curves 0.5.1 REQUIRED PKG_CONFIG_REQUIRES "curves >= 0.5.1")
IF(NOT CURVES_WITH_PINOCCHIO_SUPPORT)
MESSAGE(FATAL_ERROR "you need to use a curves version compiled with pinocchio support")
ENDIF(NOT CURVES_WITH_PINOCCHIO_SUPPORT)
......
Subproject commit a5c65a0ee51191be3f2e2667b95830706c211bb2
Subproject commit fb4c22c319ec5320f9a85527eb1a4130954846f5
No preview for this file type
No preview for this file type
......@@ -658,9 +658,15 @@ struct ContactPhaseTpl : public serialization::Serializable<ContactPhaseTpl<_Sca
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int /*version*/) {
void serialize(Archive& ar, const unsigned int version) {
// ar& boost::serialization::make_nvp("placement", m_placement);
curves::serialization::register_types<Archive>(ar);
unsigned int curve_version; // Curves API version related to the archive multicontact-api API version
if(version <2){
curve_version = 0;
}else{
curve_version = 1;
}
curves::serialization::register_types<Archive>(ar, curve_version);
ar& boost::serialization::make_nvp("c_init", m_c_init);
ar& boost::serialization::make_nvp("dc_init", m_dc_init);
ar& boost::serialization::make_nvp("ddc_init", m_ddc_init);
......
......@@ -15,7 +15,7 @@
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/version.hpp>
const unsigned int API_VERSION = 1; // must be increased everytime the save() method of a class is modified
const unsigned int API_VERSION = 2; // must be increased everytime the save() method of a class is modified
// Macro used to define the serialization version of a templated class
#define DEFINE_CLASS_TEMPLATE_VERSION(Template, Type) \
......
......@@ -73,7 +73,6 @@ BOOST_AUTO_TEST_CASE(step_in_place_COM) {
BOOST_CHECK(cs.haveCentroidalTrajectories());
BOOST_CHECK(!cs.haveFriction());
BOOST_CHECK(!cs.haveContactModelDefined());
}
BOOST_AUTO_TEST_CASE(step_in_place_REF) {
......@@ -88,7 +87,6 @@ BOOST_AUTO_TEST_CASE(step_in_place_REF) {
BOOST_CHECK(cs.haveEffectorsTrajectories(1e-6, false));
BOOST_CHECK(cs.haveFriction());
BOOST_CHECK(cs.haveContactModelDefined());
}
BOOST_AUTO_TEST_CASE(step_in_place_WB) {
......
......@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(contact_model_points_positions) {
BOOST_CHECK(mp.contact_points_positions().isApprox(positions));
Matrix6X generators = mp.generatorMatrix();
BOOST_CHECK_EQUAL(generators.rows(), 6);
BOOST_CHECK_EQUAL(generators.cols(), 6*3);
BOOST_CHECK_EQUAL(generators.cols(), 6 * 3);
mp.num_contact_points(2);
BOOST_CHECK_EQUAL(mp.num_contact_points(), 2);
......@@ -827,9 +827,8 @@ BOOST_AUTO_TEST_CASE(contact_phase) {
cp2.addContactForceTrajectory("right_hand", buildRandomPolynomial12D());
cp2.addContactNormalForceTrajectory("right_hand", buildRandomPolynomial1D());
int num_ctc = 0;
for (ContactPhase::CurveMap_t::const_iterator mit = cp2.contactForces().begin(); mit != cp2.contactForces().end();
++mit) {
BOOST_CHECK(mit->first == "right_hand" || mit->first == "left_leg");
for (auto const& mit : cp2.contactForces()) {
BOOST_CHECK(mit.first == "right_hand" || mit.first == "left_leg");
num_ctc++;
}
BOOST_CHECK(num_ctc == 2);
......@@ -1741,8 +1740,8 @@ BOOST_AUTO_TEST_CASE(contact_sequence_have_contact_model_defined) {
cs1.append(cp0);
cs1.append(cp1);
// cp.addContact("right_hand", ContactPatch(SE3::Identity().setRandom()));
// cp.addContact("left_foot", ContactPatch(SE3::Identity().setRandom()));
// cp.addContact("right_hand", ContactPatch(SE3::Identity().setRandom()));
// cp.addContact("left_foot", ContactPatch(SE3::Identity().setRandom()));
BOOST_CHECK(!cs1.haveContactModelDefined());
ContactModel mp1(0.3, ContactType::CONTACT_PLANAR);
Matrix3X positions = Matrix3X::Random(3, 4);
......@@ -1763,14 +1762,13 @@ BOOST_AUTO_TEST_CASE(contact_sequence_have_contact_model_defined) {
cs1.contactPhase(2).contactPatch("left_foot").m_contact_model = mp2;
BOOST_CHECK(!cs1.haveContactModelDefined());
mp3.m_contact_type = ContactType::CONTACT_PLANAR; // no effect
mp3.m_contact_type = ContactType::CONTACT_PLANAR; // no effect
BOOST_CHECK(!cs1.haveContactModelDefined());
cs1.contactPhase(2).contactPatch("right_hand").m_contact_model.m_contact_type = ContactType::CONTACT_PLANAR;
BOOST_CHECK(cs1.haveContactModelDefined());
}
BOOST_AUTO_TEST_CASE(contact_sequence_concatenate_com_traj) {
ContactSequence cs1 = ContactSequence(0);
ContactPhase cp0 = buildRandomContactPhase(0, 2);
......
......@@ -45,5 +45,22 @@ BOOST_AUTO_TEST_CASE(api_0) {
BOOST_CHECK(!cs.haveContactModelDefined());
}
BOOST_AUTO_TEST_CASE(api_1) {
ContactSequence cs;
cs.loadFromBinary(path + "previous_versions/api_1.cs");
BOOST_CHECK_EQUAL(cs.size(), 9);
BOOST_CHECK(cs.haveConsistentContacts());
BOOST_CHECK(cs.haveTimings());
BOOST_CHECK(cs.haveCentroidalValues());
BOOST_CHECK(cs.haveCentroidalTrajectories());
BOOST_CHECK(cs.haveEffectorsTrajectories(1e-1));
BOOST_CHECK(cs.haveJointsTrajectories());
BOOST_CHECK(cs.haveJointsDerivativesTrajectories());
BOOST_CHECK(cs.haveContactForcesTrajectories());
BOOST_CHECK(cs.haveZMPtrajectories());
BOOST_CHECK(cs.haveFriction());
BOOST_CHECK(cs.haveContactModelDefined());
}
BOOST_AUTO_TEST_SUITE_END()