From f88bd47b79583799ce09c6bd6d255edaf03d72bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu>
Date: Mon, 30 Oct 2017 14:39:40 +0000
Subject: [PATCH] Removed the status check in the is_finished() and cancel()
 functions to be able to perform the desired operations when a timeout or
 watchdog error have been reported.

---
 include/iri_ros_tools/module_action.h | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/include/iri_ros_tools/module_action.h b/include/iri_ros_tools/module_action.h
index cc6c7f0..a74dc2f 100644
--- a/include/iri_ros_tools/module_action.h
+++ b/include/iri_ros_tools/module_action.h
@@ -664,12 +664,9 @@ void CModuleAction<action_ros>::cancel(void)
 {
   actionlib::SimpleClientGoalState action_state(actionlib::SimpleClientGoalState::PENDING);
  
-  if(this->status==ACTION_RUNNING)
-  { 
-    action_state=action_client->getState();
-    if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
-      this->action_client->cancelGoal();
-  }
+  action_state=action_client->getState();
+  if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
+    this->action_client->cancelGoal();
 }
 
 template<class action_ros>
@@ -677,14 +674,9 @@ bool CModuleAction<action_ros>::is_finished(void)
 {
   actionlib::SimpleClientGoalState action_state(actionlib::SimpleClientGoalState::PENDING);
   
-  if(this->status==ACTION_RUNNING)
-  {
-    action_state=action_client->getState();
-    if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
-      return false;
-    else
-      return true;
-  } 
+  action_state=action_client->getState();
+  if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
+    return false;
   else
     return true;
 }
-- 
GitLab