From b5d897fb61620db3b57de31543059eaf08368098 Mon Sep 17 00:00:00 2001 From: Roelof Oomen Date: Wed, 18 Dec 2024 13:06:55 +0100 Subject: [PATCH 1/2] Add Ruckig composite profile serialization --- .../profiles/ruckig_trajectory_smoothing_profile.h | 6 ++++++ .../ruckig_trajectory_smoothing_profile.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tesseract_task_composer/planning/include/tesseract_task_composer/planning/profiles/ruckig_trajectory_smoothing_profile.h b/tesseract_task_composer/planning/include/tesseract_task_composer/planning/profiles/ruckig_trajectory_smoothing_profile.h index 8b99bce65b..40132a64ab 100644 --- a/tesseract_task_composer/planning/include/tesseract_task_composer/planning/profiles/ruckig_trajectory_smoothing_profile.h +++ b/tesseract_task_composer/planning/include/tesseract_task_composer/planning/profiles/ruckig_trajectory_smoothing_profile.h @@ -64,6 +64,11 @@ struct RuckigTrajectorySmoothingCompositeProfile : public Profile /** @brief max_jerk_scaling_factor The max jerk scaling factor passed to the solver */ double max_jerk_scaling_factor{ 1.0 }; + +protected: + friend class boost::serialization::access; + template + void serialize(Archive&, const unsigned int); // NOLINT }; struct RuckigTrajectorySmoothingMoveProfile : public Profile @@ -96,6 +101,7 @@ struct RuckigTrajectorySmoothingMoveProfile : public Profile }; } // namespace tesseract_planning +BOOST_CLASS_EXPORT_KEY(tesseract_planning::RuckigTrajectorySmoothingCompositeProfile) BOOST_CLASS_EXPORT_KEY(tesseract_planning::RuckigTrajectorySmoothingMoveProfile) #endif // TESSERACT_TASK_COMPOSER_RUCKIG_TRAJECTORY_SMOOTHING_PROFILE_H diff --git a/tesseract_task_composer/planning/src/profiles/ruckig_trajectory_smoothing_profile.cpp b/tesseract_task_composer/planning/src/profiles/ruckig_trajectory_smoothing_profile.cpp index 12113f0cf6..471fcff534 100644 --- a/tesseract_task_composer/planning/src/profiles/ruckig_trajectory_smoothing_profile.cpp +++ b/tesseract_task_composer/planning/src/profiles/ruckig_trajectory_smoothing_profile.cpp @@ -52,6 +52,17 @@ std::size_t RuckigTrajectorySmoothingCompositeProfile::getStaticKey() return std::type_index(typeid(RuckigTrajectorySmoothingCompositeProfile)).hash_code(); } +template +void RuckigTrajectorySmoothingCompositeProfile::serialize(Archive& ar, const unsigned int /*version*/) +{ + ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Profile); + ar& BOOST_SERIALIZATION_NVP(duration_extension_fraction); + ar& BOOST_SERIALIZATION_NVP(max_duration_extension_factor); + ar& BOOST_SERIALIZATION_NVP(max_velocity_scaling_factor); + ar& BOOST_SERIALIZATION_NVP(max_acceleration_scaling_factor); + ar& BOOST_SERIALIZATION_NVP(max_jerk_scaling_factor); +} + RuckigTrajectorySmoothingMoveProfile::RuckigTrajectorySmoothingMoveProfile() : Profile(RuckigTrajectorySmoothingMoveProfile::getStaticKey()) { @@ -81,5 +92,7 @@ void RuckigTrajectorySmoothingMoveProfile::serialize(Archive& ar, const unsigned } // namespace tesseract_planning #include +TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(tesseract_planning::RuckigTrajectorySmoothingCompositeProfile) TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(tesseract_planning::RuckigTrajectorySmoothingMoveProfile) +BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_planning::RuckigTrajectorySmoothingCompositeProfile) BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_planning::RuckigTrajectorySmoothingMoveProfile) From 51f87af5e1d30a195d03e5d8b680feb78592d95d Mon Sep 17 00:00:00 2001 From: Roelof Oomen Date: Wed, 18 Dec 2024 15:58:58 +0100 Subject: [PATCH 2/2] Do not delete special member functions (#551) --- .../include/tesseract_command_language/profile.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tesseract_command_language/include/tesseract_command_language/profile.h b/tesseract_command_language/include/tesseract_command_language/profile.h index 2a97d726d2..205a76b814 100644 --- a/tesseract_command_language/include/tesseract_command_language/profile.h +++ b/tesseract_command_language/include/tesseract_command_language/profile.h @@ -43,10 +43,6 @@ class Profile Profile() = default; Profile(std::size_t key); - Profile(const Profile&) = delete; - Profile& operator=(const Profile&) = delete; - Profile(Profile&&) = delete; - Profile&& operator=(Profile&&) = delete; virtual ~Profile() = default; /** @@ -56,6 +52,11 @@ class Profile std::size_t getKey() const; protected: + Profile(const Profile&) = default; + Profile& operator=(const Profile&) = default; + Profile(Profile&&) = default; + Profile& operator=(Profile&&) = default; + std::size_t key_{ 0 }; friend class boost::serialization::access; template