From a4c0f9c0e4e1546f4d0710554ebae1632f01d714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Mon, 14 Aug 2023 12:56:19 +0200 Subject: [PATCH] works but needs improvement --- rmp220_middleware/rmp220_middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmp220_middleware/rmp220_middleware.py b/rmp220_middleware/rmp220_middleware.py index e2049f8..fa805e5 100644 --- a/rmp220_middleware/rmp220_middleware.py +++ b/rmp220_middleware/rmp220_middleware.py @@ -76,7 +76,7 @@ class StateMachineNode(Node): self.disable_chassis() def cmd_vel_callback(self, msg): - if self.state == State.ENABLED and (msg.linear.x >= 0.03 or msg.angular.z >= 0.03): + if self.state == State.ENABLED and (abs(msg.linear.x) >= 0.03 or abs(msg.angular.z) >= 0.03): self.cmd_vel_pub.publish(msg) self.timeout = 20.0 # Reset timeout when receiving commands if msg.linear.x == 0.0 and msg.angular.z == 0.0: @@ -92,7 +92,7 @@ class StateMachineNode(Node): self.cmd_vel_pub.publish(msg) self.timeout = 10.0 # Reset timeout when receiving commands - if msg.linear.x > 0.03 or msg.angular.z > 0.03: + if abs(msg.linear.x) > 0.03 or abs(msg.angular.z) > 0.03: self.latest_cmd_vel = msg else: self.latest_cmd_vel = Twist()