From 26039502ba304322bb14b2fa970f95122d648915 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Mon, 1 Sep 2014 14:32:21 +0200
Subject: [PATCH] GraphSteeringMethod and GraphPathValidation return empty Path
 when failing

---
 src/graph-path-validation.cc | 2 +-
 src/graph-steering-method.cc | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/graph-path-validation.cc b/src/graph-path-validation.cc
index e9b5172..c6d80ae 100644
--- a/src/graph-path-validation.cc
+++ b/src/graph-path-validation.cc
@@ -102,7 +102,7 @@ namespace hpp {
         }
         possibleEdges.pop_back();
       }
-      validPart = path->extract (std::make_pair (tmin, tmin));
+      validPart = PathPtr_t ();
       return false;
     }
   } // namespace manipulation
diff --git a/src/graph-steering-method.cc b/src/graph-steering-method.cc
index 84ae64b..64ea88a 100644
--- a/src/graph-steering-method.cc
+++ b/src/graph-steering-method.cc
@@ -31,7 +31,6 @@ namespace hpp {
     PathPtr_t GraphSteeringMethod::impl_compute (ConfigurationIn_t q1, ConfigurationIn_t q2) const
     {
       value_type length = (*distance_) (q1,q2);
-      PathPtr_t path = core::StraightPath::create (robot_.lock(), q1, q2, length);
       std::vector< graph::Edges_t > possibleEdges =
         graph_->getEdge (graph_->getNode (q1), graph_->getNode (q2));
       ConstraintSetPtr_t constraints;
@@ -40,12 +39,13 @@ namespace hpp {
         constraints->offsetFromConfig(q1);
         assert (constraints->isSatisfied (q1));
         if (constraints->isSatisfied (q2)) {
+          PathPtr_t path = core::StraightPath::create (robot_.lock(), q1, q2, length);
           path->constraints (constraints);
-          break;
+          return path;
         }
         possibleEdges.pop_back ();
       }
-      return path;
+      return PathPtr_t ();
     }
   } // namespace manipulation
 } // namespace hpp
-- 
GitLab