From 263652c823b5dd783831d1173c1489fcf2e1a417 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Fri, 17 Nov 2017 10:27:54 +0000
Subject: [PATCH] Added a boolean to enable/disable the watchdog in the
 actions. Added this boolean in the configuration files. Extended the maximum
 watchdog time to 10 minutes.

---
 cfg/PlayMotionModule.cfg   | 3 ++-
 src/play_motion_module.cpp | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cfg/PlayMotionModule.cfg b/cfg/PlayMotionModule.cfg
index 0459d84..1be1b6f 100755
--- a/cfg/PlayMotionModule.cfg
+++ b/cfg/PlayMotionModule.cfg
@@ -44,7 +44,8 @@ play_action = gen.add_group("Play motion action")
 gen.add("rate_hz",                 double_t,  0,                               "Gripper module rate in Hz",      1.0,      1.0,  100.0)
 
 play_action.add("action_max_retries",int_t,   0,                               "Maximum number of retries for the action start",    1,   1,    10)
-play_action.add("feedback_watchdog_time_s",double_t,    0,                     "Maximum time between feedback messages",    1,   0.01,    50)
+play_action.add("feedback_watchdog_time_s",double_t,    0,                     "Maximum time between feedback messages",    1,   0.01,    600)
+play_action.add("enable_watchdog", bool_t,    0,                               "Enable action watchdog",         True)
 play_action.add("timeout_s",       double_t,  0,                               "Maximum time allowed to complete the action",    1,   0.1,    30)
 play_action.add("enable_timeout",  bool_t,    0,                               "Enable action timeout",          True)
 play_action.add("enabled",         bool_t,    0,                               "Enable action execution",        True)
diff --git a/src/play_motion_module.cpp b/src/play_motion_module.cpp
index 69d9676..003a96c 100644
--- a/src/play_motion_module.cpp
+++ b/src/play_motion_module.cpp
@@ -104,7 +104,10 @@ void CPlayMotionModule::reconfigure_callback(play_motion_module::PlayMotionModul
   this->set_rate(config.rate_hz);
   /* motion action parameters */
   this->play_motion_action.set_max_num_retries(config.action_max_retries);
-  this->play_motion_action.set_feedback_watchdog_time(config.feedback_watchdog_time_s);
+  if(config.enable_watchdog)
+    this->play_motion_action.enable_watchdog(config.feedback_watchdog_time_s);
+  else
+    this->play_motion_action.disable_watchdog();
   if(this->config.enable_timeout)
     this->play_motion_action.enable_timeout(config.timeout_s);
   else
-- 
GitLab