From d40130aed263b2acfcb30870d3f603f7c7183959 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu>
Date: Tue, 15 Jan 2013 14:10:19 +0000
Subject: [PATCH] Changed the iri_action server main thread to differentiate
 between user cancelation and new goal preemption. When the goal is cancelled
 by the user, the stop function is called. However, it is not called when the
 current goal is preempted by a new goal.

---
 include/iri_action_server/iri_action_server.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/iri_action_server/iri_action_server.h b/include/iri_action_server/iri_action_server.h
index 65dd292..0278082 100755
--- a/include/iri_action_server/iri_action_server.h
+++ b/include/iri_action_server/iri_action_server.h
@@ -431,7 +431,8 @@ void IriActionServer<ActionSpec>::executeCallback(const GoalConstPtr& goal)
         //is_active = false;
 
         // stop action
-        //stop_action_callback_();
+        if(!as_.isNewGoalAvailable())
+          stop_action_callback_();
         as_.setPreempted();
       }
       // check if action has finished
-- 
GitLab