From 33a99d98c3fd7b14716021831fad5cfefe2743f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Tue, 18 Apr 2023 11:34:11 +0200 Subject: [PATCH] update: enable/disable button --- rmp220_teleop/rmp220_teleop.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rmp220_teleop/rmp220_teleop.py b/rmp220_teleop/rmp220_teleop.py index 8f253d1..345497f 100644 --- a/rmp220_teleop/rmp220_teleop.py +++ b/rmp220_teleop/rmp220_teleop.py @@ -13,10 +13,17 @@ class TeleopTwistJoy(Node): self.joy_sub = self.create_subscription(Joy, 'joy', self.joy_callback, 10) self.timer = self.create_timer(0.01, self.timer_callback) self.twist = Twist() + self.enable = False def joy_callback(self, joy_msg): self.twist.linear.x = 1 * joy_msg.axes[1] self.twist.angular.z = 1.0 * joy_msg.axes[0] + if joy_msg.buttons[8]: + self.enable = True + enable_chassis() + if joy_msg.buttons[4]: + self.enable = False + disable_chassis() def timer_callback(self): self.cmd_vel_pub.publish(self.twist)