From 192c685b2961ca67e5693be45097c547e0805eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Tue, 18 Apr 2023 13:43:04 +0200 Subject: [PATCH] update: velocity selection, button mapping --- rmp220_teleop/rmp220_teleop.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rmp220_teleop/rmp220_teleop.py b/rmp220_teleop/rmp220_teleop.py index 44751e6..7d712e9 100644 --- a/rmp220_teleop/rmp220_teleop.py +++ b/rmp220_teleop/rmp220_teleop.py @@ -16,12 +16,19 @@ class TeleopTwistJoy(Node): 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[7]: + if joy_msg.buttons[4]: #lb + self.twist.linear.x = 0.5 * joy_msg.axes[1] + self.twist.angular.z = 0.5 * joy_msg.axes[0] + elif joy_msg.buttons[5]: #rb + self.twist.linear.x = 3 * joy_msg.axes[1] + self.twist.angular.z = 1.5 * joy_msg.axes[0] + else: + self.twist.linear.x = 1 * joy_msg.axes[1] + self.twist.angular.z = 1.0 * joy_msg.axes[0] + if joy_msg.buttons[7]: #start self.enable = True enable_chassis(self) - if joy_msg.buttons[6]: + if joy_msg.buttons[6]: #back self.enable = False disable_chassis(self)