From 6f1c8deb7d664ed11d2686f1a311a2f817fd60cf Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Sun, 19 May 2019 13:05:56 +0200
Subject: [PATCH] Keep the default validation from hpp-core + Fix minor issues

---
 src/problem-solver.cc | 14 +++++++++-----
 src/problem.cc        |  4 ----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/problem-solver.cc b/src/problem-solver.cc
index 40e21eb..a75cd75 100644
--- a/src/problem-solver.cc
+++ b/src/problem-solver.cc
@@ -129,7 +129,8 @@ namespace hpp {
       pathValidations.add ("Graph-Dichotomy"  , GraphPathValidation::create<core::continuousValidation::Dichotomy  >);
       pathValidations.add ("Graph-Progressive", GraphPathValidation::create<core::continuousValidation::Progressive>);
 
-      pathValidationType ("Graph-Discretized", 0.05);
+      // TODO Uncomment to make Graph-Discretized the default.
+      //pathValidationType ("Graph-Discretized", 0.05);
 
       pathOptimizers.add ("RandomShortcut",
           pathOptimization::RandomShortcut::create);
@@ -202,6 +203,9 @@ namespace hpp {
       core::ProblemSolver::initializeProblem (problem_);
       if (constraintGraph_)
         problem_->constraintGraph (constraintGraph_);
+      value_type tolerance;
+      const std::string& type = parent_t::pathValidationType (tolerance);
+      problem_->setPathValidationFactory (pathValidations.get(type), tolerance);
     }
 
     void ProblemSolver::constraintGraph (const std::string& graphName)
@@ -373,10 +377,10 @@ namespace hpp {
         const value_type& tolerance)
     {
       parent_t::pathValidationType(type, tolerance);
-      assert (problem_);
-      problem_->setPathValidationFactory (
-          pathValidations.get(type),
-          tolerance);
+      if (problem_)
+        problem_->setPathValidationFactory (
+            pathValidations.get(type),
+            tolerance);
     }
 
     void ProblemSolver::resetRoadmap ()
diff --git a/src/problem.cc b/src/problem.cc
index 6cb988c..8d98825 100644
--- a/src/problem.cc
+++ b/src/problem.cc
@@ -104,10 +104,6 @@ namespace hpp {
       core::Problem::checkProblem ();
       if (!graph_)
         throw std::runtime_error ("No graph in the problem.");
-      if (!pathValidation ())
-        throw std::runtime_error ("No GraphPathValidation in the problem.");
-      if (!core::Problem::steeringMethod ())
-        throw std::runtime_error ("No SteeringMethod in the problem.");
     }
   } // namespace manipulation
 } // namespace hpp
-- 
GitLab