From 29f51c6b52e3e345546fa63281605dbc4f1d86cb Mon Sep 17 00:00:00 2001 From: Aldokan <114017858+Aldokan@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:24:08 +0200 Subject: [PATCH] Updated the callback function to publish wrench message from input --- .../scripts/joystick_interface.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mission/joystick_interface/scripts/joystick_interface.py b/mission/joystick_interface/scripts/joystick_interface.py index 74f5adfc..76ab8ff2 100755 --- a/mission/joystick_interface/scripts/joystick_interface.py +++ b/mission/joystick_interface/scripts/joystick_interface.py @@ -10,7 +10,7 @@ class JoystickInterface(Node): def __init__(self): rclpy.init() - + super().__init__('joystick_interface_node') #Mapping copy pasted from the original file self.joystick_buttons_map = [ "A", @@ -37,11 +37,12 @@ def __init__(self): "dpad_vertical", ] - super().__init__('joystick_interface_node') + #self.wrench_publisher = self.create_publisher(Wrench, 'wrench_topic', 1) + + #self.node = rclpy.create_node('joystick_interface') self.subscriber = self.create_subscription(Joy, 'joy', self.joystick_cb, 1) - - #self.wrench_publisher = self.create_publisher(Wrench, 'wrench_topic', 1) + rclpy.shutdown() def create_2d_wrench_message(self, x, y, yaw): wrench_msg = Wrench() @@ -62,13 +63,11 @@ def joystick_cb(self, msg): a = msg.buttons return a - def main(args=None): - #rclpy.init(args=args) + rclpy.init(args=args) print("hello from main") joystick_interface = JoystickInterface().subscriber rclpy.spin(joystick_interface) joystick_interface.destroy_node() - rclpy.shutdown() return