Skip to content

fix(gamepad): Gamepad on macos often does not need fallback.#3420

Open
Mxbonn wants to merge 2 commits intohuggingface:mainfrom
Mxbonn:gamepad_macos
Open

fix(gamepad): Gamepad on macos often does not need fallback.#3420
Mxbonn wants to merge 2 commits intohuggingface:mainfrom
Mxbonn:gamepad_macos

Conversation

@Mxbonn
Copy link
Copy Markdown

@Mxbonn Mxbonn commented Apr 20, 2026

        if sys.platform == "darwin":
            # NOTE: On macOS, pygame doesn’t reliably detect input from some controllers so we fall back to hidapi
        if self.hidapi_fallback:
            from .gamepad_utils import GamepadControllerHID as Gamepad
        else:
            from .gamepad_utils import GamepadController as Gamepad

GamepadControllerHID and GamepadController are not fully compatible. E.g. they have different joystick behaviour, it seems like GamepadControllerHID is mainly created as a fallback for the Logitech RumblePad 2 on macos (based on the comments).

From my own testing, the original Gamepad controller works fine on macos for the Xbox controller, thus it seems to make more sense to add the fallback as an explicit option instead of swapping it for every macos user.

Copilot AI review requested due to automatic review settings April 20, 2026 18:26
@github-actions github-actions Bot added the robots Issues concerning robots HW interfaces label Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts macOS gamepad handling so LeRobot doesn’t automatically switch all macOS users to the HIDAPI-based controller, keeping the default pygame controller and making HIDAPI an opt-in fallback.

Changes:

  • Adds a hidapi_fallback flag to GamepadTeleop to control whether GamepadControllerHID or GamepadController is used.
  • Emits a macOS warning when not using the HIDAPI fallback to help users troubleshoot controller detection issues.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lerobot/teleoperators/gamepad/teleop_gamepad.py Outdated
Comment thread src/lerobot/teleoperators/gamepad/teleop_gamepad.py Outdated
@s1lent4gnt s1lent4gnt self-assigned this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

robots Issues concerning robots HW interfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants