From 6b6f1ccc8fedff5c330a6f76bf7b3453cc935018 Mon Sep 17 00:00:00 2001
From: "Christian R. G. Dreher" <c.dreher@kit.edu>
Date: Thu, 8 Jul 2021 17:23:13 +0200
Subject: [PATCH] feature: Implement disableAndStop and enable for
 PlatformUnitExecutor

---
 .../server/execution/PlatformUnitExecutor.cpp    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/source/Navigation/libraries/server/execution/PlatformUnitExecutor.cpp b/source/Navigation/libraries/server/execution/PlatformUnitExecutor.cpp
index e72437e9..da191506 100644
--- a/source/Navigation/libraries/server/execution/PlatformUnitExecutor.cpp
+++ b/source/Navigation/libraries/server/execution/PlatformUnitExecutor.cpp
@@ -17,7 +17,21 @@ namespace armarx::nav::server
 
     void PlatformUnitExecutor::move(const core::Twist& twist)
     {
-        platformUnit->move(twist.linear.x(), twist.linear.y(), twist.angular.z());
+        if (enabled.get())
+        {
+            platformUnit->move(twist.linear.x(), twist.linear.y(), twist.angular.z());
+        }
+    }
+
+    void PlatformUnitExecutor::disableAndStop()
+    {
+        enabled.set(false);
+        platformUnit->move(0, 0, 0);
+    }
+
+    void PlatformUnitExecutor::enable()
+    {
+        enabled.set(true);
     }
 
 }
-- 
GitLab