From 9bdf7ff85a2930dc912cc2511e1093272703260d Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 23 Aug 2016 22:13:01 +0200
Subject: [PATCH] Fix bug in graph::helper due to WaypointEdge

* See FIXME for more info
---
 src/graph/helper.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/graph/helper.cc b/src/graph/helper.cc
index bf40b21..5a97b8d 100644
--- a/src/graph/helper.cc
+++ b/src/graph/helper.cc
@@ -116,8 +116,15 @@ namespace hpp {
           template <int gCase>
             struct CaseTraits {
               static const bool pregrasp = (gCase & WithPreGrasp);
-              static const bool intersec = !((gCase & NoGrasp) || (gCase & NoPlace));
               static const bool preplace = (gCase & WithPrePlace);
+              /// FIXME
+              // It should be
+              // static const bool intersec = !((gCase & NoGrasp) || (gCase & NoPlace));
+              // but when NoPlace | WithPreGrasp, we need a LevelSetEdge after
+              // the pregrasp waypoint node. Sadly the current implementation of
+              // WaypointEdge does not allow the last edge of type other than Edge.
+              static const bool intersec = pregrasp || preplace || ((gCase & GraspOnly) && (gCase & PlaceOnly));
+
               static const bool valid =
                    ( (gCase & WithPreGrasp) || (gCase & GraspOnly) || (gCase & NoGrasp) )
                 && ( (gCase & WithPrePlace) || (gCase & PlaceOnly) || (gCase & NoPlace) )
-- 
GitLab