Commit a4c8a7d4 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Serialize steering methods and problem.

parent 15c12b02
......@@ -227,6 +227,7 @@ SET(${PROJECT_NAME}_SOURCES
src/steering-method/car-like.cc
src/steering-method/constant-curvature.cc
src/steering-method/dubins.cc
src/steering-method/serialization.cc
src/steering-method/snibud.cc
src/steering-method/spline.cc
src/steering-method/straight.cc
......
......@@ -324,6 +324,7 @@ namespace hpp {
ConstraintSetPtr_t constraints_;
/// Configuration shooter
ConfigurationShooterPtr_t configurationShooter_;
HPP_SERIALIZABLE();
}; // class Problem
/// \}
} // namespace core
......
......@@ -20,6 +20,7 @@
# define HPP_CORE_STEERING_METHOD_HH
# include <hpp/util/debug.hh>
# include <hpp/util/serialization.hh>
# include <hpp/core/fwd.hh>
# include <hpp/core/path.hh>
......@@ -91,6 +92,8 @@ namespace hpp {
/// \}
protected:
/// For serialization only
SteeringMethod() {}
/// Constructor
SteeringMethod (const ProblemConstPtr_t& problem) :
problem_ (problem), constraints_ (), weak_ ()
......@@ -122,6 +125,7 @@ namespace hpp {
ConstraintSetPtr_t constraints_;
/// Weak pointer to itself
SteeringMethodWkPtr_t weak_;
HPP_SERIALIZABLE();
}; // class SteeringMethod
/// \}
} // namespace core
......
......@@ -59,6 +59,8 @@ namespace hpp {
void computeRadius ();
protected:
/// For serialization only.
CarLike() {}
/// Constructor
CarLike (const ProblemConstPtr_t& problem);
......
......@@ -21,6 +21,7 @@
# include <hpp/util/debug.hh>
# include <hpp/util/pointer.hh>
# include <hpp/util/serialization-fwd.hh>
# include <hpp/core/fwd.hh>
# include <hpp/core/config.hh>
......@@ -89,7 +90,10 @@ namespace hpp {
virtual PathPtr_t impl_compute (ConfigurationIn_t q1,
ConfigurationIn_t q2) const;
protected:
/// For serialization only
ReedsShepp() {}
protected:
/// Constructor
ReedsShepp (const ProblemConstPtr_t& problem);
......@@ -112,6 +116,7 @@ namespace hpp {
private:
WeighedDistancePtr_t weighedDistance_;
ReedsSheppWkPtr_t weak_;
HPP_SERIALIZABLE();
}; // ReedsShepp
/// \}
} // namespace steeringMethod
......
......@@ -27,6 +27,7 @@
#include <hpp/core/distance.hh>
#include <hpp/core/distance/reeds-shepp.hh>
#include <hpp/core/weighed-distance.hh>
#include <hpp/core/steering-method/reeds-shepp.hh>
BOOST_CLASS_EXPORT(hpp::core::WeighedDistance)
BOOST_CLASS_EXPORT(hpp::core::distance::ReedsShepp)
......@@ -58,10 +59,9 @@ namespace distance {
template <typename Archive>
inline void ReedsShepp::serialize(Archive& ar, const unsigned int version)
{
throw std::logic_error("ReedsShepp distance not serializable.");
(void) version;
ar & boost::serialization::make_nvp("base", boost::serialization::base_object<Distance>(*this));
//ar & BOOST_SERIALIZATION_NVP(sm_);
ar & BOOST_SERIALIZATION_NVP(sm_);
ar & BOOST_SERIALIZATION_NVP(weak_);
}
......
......@@ -306,5 +306,15 @@ namespace hpp {
// ======================================================================
template <typename Archive>
inline void Problem::serialize(Archive& ar, const unsigned int version)
{
(void) version;
ar & BOOST_SERIALIZATION_NVP(robot_);
ar & BOOST_SERIALIZATION_NVP(distance_);
ar & BOOST_SERIALIZATION_NVP(steeringMethod_);
ar & BOOST_SERIALIZATION_NVP(constraints_);
}
HPP_SERIALIZATION_IMPLEMENT(Problem);
} // namespace core
} // namespace hpp
//
// Copyright (c) 2020 CNRS
// Authors: Joseph Mirabel, Florent Lamiraux
//
// This file is part of hpp-core
// hpp-core is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// hpp-core is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// hpp-core If not, see
// <http://www.gnu.org/licenses/>.
#include <boost/serialization/weak_ptr.hpp>
#include <pinocchio/serialization/eigen.hpp>
#include <hpp/util/serialization.hh>
#include <hpp/pinocchio/device.hh>
#include <hpp/core/distance.hh>
#include <hpp/core/distance/reeds-shepp.hh>
#include <hpp/core/problem.hh>
#include <hpp/core/steering-method/reeds-shepp.hh>
#include <hpp/core/weighed-distance.hh>
BOOST_CLASS_EXPORT(hpp::core::steeringMethod::ReedsShepp)
namespace hpp {
namespace core {
template <typename Archive>
inline void SteeringMethod::serialize(Archive& ar, const unsigned int version)
{
(void) version;
ar & BOOST_SERIALIZATION_NVP(problem_);
ar & BOOST_SERIALIZATION_NVP(constraints_);
ar & BOOST_SERIALIZATION_NVP(weak_);
}
namespace steeringMethod {
template <typename Archive>
inline void ReedsShepp::serialize(Archive& ar, const unsigned int version)
{
(void) version;
ar & boost::serialization::make_nvp("base", boost::serialization::base_object
<SteeringMethod>(*this));
ar & BOOST_SERIALIZATION_NVP(weighedDistance_);
ar & BOOST_SERIALIZATION_NVP(weak_);
}
HPP_SERIALIZATION_IMPLEMENT(ReedsShepp);
} // namespace steeringMethod
} // namespace core
} // namespace hpp
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