From 858e03f385f69b85a29ef48d5c44ecbb02504d61 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 10 Sep 2025 22:59:27 -0500 Subject: [PATCH] feat: add rumble on headless ready, change turn to cubic Controller rumbles for 200ms when __init__() finishes, and angular is now cubic so turning control follows a curve rather than a straight line (y=x^3 instead of y=x) --- src/headless_pkg/src/headless_node.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/headless_pkg/src/headless_node.py b/src/headless_pkg/src/headless_node.py index 291e0eb..3f9c6f6 100755 --- a/src/headless_pkg/src/headless_node.py +++ b/src/headless_pkg/src/headless_node.py @@ -91,12 +91,6 @@ class Headless(Node): self.gamepad.init() print(f'Gamepad Found: {self.gamepad.get_name()}') - # Rumble when gamepad connected (if supported) - if self.gamepad.get_axis_count() > 0: # type: ignore - # check for rumble support - if hasattr(self.gamepad, 'get_rumble'): - self.gamepad.rumble(0.4, 0.6, 200) - # Now initialize the ROS2 node super().__init__("headless") self.create_timer(0.15, self.send_controls) @@ -104,6 +98,9 @@ class Headless(Node): self.arm_publisher = self.create_publisher(ArmManual, '/arm/control/manual', 10) self.core_twist_pub_ = self.create_publisher(Twist, '/core/twist', qos_profile=control_qos) self.core_state_pub_ = self.create_publisher(CoreCtrlState, '/core/control/state', qos_profile=control_qos) + + # Rumble when node is ready (returns False if not supported) + self.gamepad.rumble(0.4, 0.6, 150) def run(self): # This thread makes all the update processes run in the background @@ -185,7 +182,7 @@ class Headless(Node): # Forward/back and Turn input.linear.x = -1.0 * left_stick_y - input.angular.z = -1.0 * right_stick_x + input.angular.z = -1.0 * right_stick_x ** 3 # Cubic for finer control (curve) # Publish self.core_twist_pub_.publish(input)