mirror of
https://github.com/SHC-ASTRA/rover-ros2.git
synced 2026-02-11 09:20:40 +00:00
fix: -float is not float???
Tested with controller but on Clucky
This commit is contained in:
@@ -91,6 +91,12 @@ 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)
|
||||
@@ -178,8 +184,8 @@ class Headless(Node):
|
||||
right_bumper = self.gamepad.get_button(5)
|
||||
|
||||
# Forward/back and Turn
|
||||
input.linear.x = -left_stick_y
|
||||
input.angular.z = -right_stick_x
|
||||
input.linear.x = -1.0 * left_stick_y
|
||||
input.angular.z = -1.0 * right_stick_x
|
||||
|
||||
# Publish
|
||||
self.core_twist_pub_.publish(input)
|
||||
@@ -205,8 +211,8 @@ class Headless(Node):
|
||||
core_brake_mode = new_brake_mode
|
||||
core_speed_mode = new_speed_mode
|
||||
state_msg = CoreCtrlState()
|
||||
state_msg.brake_mode = core_brake_mode
|
||||
state_msg.speed_mode = core_speed_mode
|
||||
state_msg.brake_mode = bool(core_brake_mode)
|
||||
state_msg.speed_mode = int(core_speed_mode)
|
||||
self.core_state_pub_.publish(state_msg)
|
||||
self.get_logger().info(f"[Core State] Brake: {core_brake_mode}, Speed: {core_speed_mode}")
|
||||
|
||||
|
||||
Submodule src/ros2_interfaces_pkg updated: 821cdddee0...680c7b03c0
Reference in New Issue
Block a user