Skip to content

Commit

Permalink
Updated the callback function to publish wrench message from input
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldokan authored Sep 28, 2023
1 parent cb79638 commit 29f51c6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mission/joystick_interface/scripts/joystick_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()
Expand All @@ -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

0 comments on commit 29f51c6

Please sign in to comment.