From 46e37fc445d8437cce89128e980c79d7f70db783 Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Sun, 2 Aug 2015 11:31:47 +0200 Subject: [PATCH] Update to commit 9d86cf4 in hpp-core about validation reports: - Make 2 GraphPathValidation::validate deprecated, and - implement a new one that takes a reference to a PathValidationReportPtr_t as input, - update code accordingly. --- include/hpp/manipulation/fwd.hh | 1 + .../hpp/manipulation/graph-path-validation.hh | 25 +++++++++++++++++-- src/graph-path-validation.cc | 11 +++++++- src/manipulation-planner.cc | 6 +++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/include/hpp/manipulation/fwd.hh b/include/hpp/manipulation/fwd.hh index bf933f7..cc19d68 100644 --- a/include/hpp/manipulation/fwd.hh +++ b/include/hpp/manipulation/fwd.hh @@ -90,6 +90,7 @@ namespace hpp { typedef core::ConfigurationShooter ConfigurationShooter; typedef core::ConfigurationShooterPtr_t ConfigurationShooterPtr_t; typedef core::ValidationReport ValidationReport; + typedef core::PathValidationReportPtr_t PathValidationReportPtr_t; typedef std::pair< GripperPtr_t, HandlePtr_t> Grasp_t; typedef boost::shared_ptr <Grasp_t> GraspPtr_t; diff --git a/include/hpp/manipulation/graph-path-validation.hh b/include/hpp/manipulation/graph-path-validation.hh index 661ecce..6c3dfc9 100644 --- a/include/hpp/manipulation/graph-path-validation.hh +++ b/include/hpp/manipulation/graph-path-validation.hh @@ -50,7 +50,10 @@ namespace hpp { public: /// Check that the path is valid regarding the constraint graph and call /// the encapsulated PathValidation::validate. - bool validate (const PathPtr_t& path, bool reverse, PathPtr_t& validPart); + /// \deprecated Use the method that takes as input a reference to a + /// ValidationReportPtr_t instead. + bool validate (const PathPtr_t& path, bool reverse, + PathPtr_t& validPart) HPP_MANIPULATION_DEPRECATED; /// Call the GraphPathValidation::validate without validation report. /// @@ -61,9 +64,27 @@ namespace hpp { /// \retval report information about the validation process. unused in /// this case, /// \return whether the whole path is valid. + /// \deprecated Use the method that takes as input a reference to a + /// ValidationReportPtr_t instead. virtual bool validate (const PathPtr_t& path, bool reverse, PathPtr_t& validPart, - ValidationReport& report); + ValidationReport& report) + HPP_MANIPULATION_DEPRECATED; + + /// Check that path is valid regarding the constraint graph. + /// + /// \param path the path to check for validity, + /// \param reverse if true check from the end, + /// \retval the extracted valid part of the path, pointer to path if + /// path is valid, + /// \retval report information about the validation process. unused in + /// this case, + /// \return whether the whole path is valid. + /// + /// \notice Call the encapsulated PathValidation::validate. + virtual bool validate (const PathPtr_t& path, bool reverse, + PathPtr_t& validPart, + PathValidationReportPtr_t& report); /// Set the encapsulated path validator. void innerValidation (const PathValidationPtr_t& pathValidation) diff --git a/src/graph-path-validation.cc b/src/graph-path-validation.cc index 94a070e..74646b6 100644 --- a/src/graph-path-validation.cc +++ b/src/graph-path-validation.cc @@ -47,6 +47,14 @@ namespace hpp { return impl_validate (path, reverse, validPart); } + bool GraphPathValidation::validate (const PathPtr_t& path, bool reverse, + PathPtr_t& validPart, + PathValidationReportPtr_t&) + { + assert (path); + return impl_validate (path, reverse, validPart); + } + bool GraphPathValidation::impl_validate ( const PathVectorPtr_t& path, bool reverse, PathPtr_t& validPart) { @@ -95,7 +103,8 @@ namespace hpp { return impl_validate (pathVector, reverse, validPart); PathPtr_t pathNoCollision; - if (pathValidation_->validate (path, reverse, pathNoCollision)) { + PathValidationReportPtr_t report; + if (pathValidation_->validate (path, reverse, pathNoCollision, report)) { validPart = path; return true; } diff --git a/src/manipulation-planner.cc b/src/manipulation-planner.cc index b92c140..9bc5c03 100644 --- a/src/manipulation-planner.cc +++ b/src/manipulation-planner.cc @@ -133,7 +133,8 @@ namespace hpp { } } else projPath = path; GraphPathValidationPtr_t pathValidation (problem_.pathValidation ()); - pathValidation->validate (projPath, false, validPath); + PathValidationReportPtr_t report; + pathValidation->validate (projPath, false, validPath, report); if (validPath->length () == 0) addFailure (PATH_VALIDATION, edge); else { @@ -190,7 +191,8 @@ namespace hpp { if (pathProjector) { if (!pathProjector->apply (path, projPath)) continue; } else projPath = path; - if (pathValidation->validate (projPath, false, validPath)) { + PathValidationReportPtr_t report; + if (pathValidation->validate (projPath, false, validPath, report)) { roadmap ()->addEdge (*itn1, *itn2, projPath); core::interval_t timeRange = projPath->timeRange (); roadmap ()->addEdge (*itn2, *itn1, projPath->extract -- GitLab