Created
January 17, 2026 07:23
-
-
Save cole-wilson/76ba03b62dcff141855664d559e7d473 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def logitech_twist(controller_state): | |
| twist = Twist() | |
| twist.linear.x = controller_state["axes"][4] # right stick vertical | |
| twist.linear.y = controller_state["axes"][3] # right stick horizontal | |
| twist.linear.z = -controller_state["axes"][1] # left stick vertical | |
| twist.angular.y = float(controller_state["dpad"][1]) # pitch | |
| twist.angular.x = -float(controller_state["dpad"][0]) # roll | |
| yaw_r = controller_state["axes"][5] # right trigger | |
| yaw_l = controller_state["axes"][2] # left trigger | |
| yaw_r = (yaw_r + 1) / 2 | |
| yaw_l = (yaw_l + 1) / 2 * (-1) | |
| twist.angular.z = -(yaw_r + yaw_l) | |
| return twist | |
| def series_x_twist(controller_state): | |
| twist = Twist() | |
| twist.linear.x = controller_state["axes"][4] # right stick vertical | |
| twist.linear.y = controller_state["axes"][3] # right stick horizontal | |
| twist.linear.z = -controller_state["axes"][1] # left stick | |
| twist.angular.y = float(controller_state["dpad"][1]) # pitch | |
| twist.angular.x = -float(controller_state["dpad"][0]) # roll | |
| yaw_r = controller_state["axes"][5] # right trigger | |
| yaw_l = controller_state["axes"][2] # left trigger | |
| yaw_r = (yaw_r + 1) / 2 | |
| yaw_l = (yaw_l + 1) / 2 * (-1) | |
| twist.angular.z = -(yaw_r + yaw_l) | |
| return twist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment