Skip to content

DriverStation.isJoystickConnected Does not correctly report disconnected joysticks. #7700

Open
@m10653

Description

@m10653

Describe the bug
The methods DriverStation.isJoystickConnected(0) and controller.isConnected() produce incorrect results when controllers are reconnected. Starting with no controllers plugged in, the methods correctly report false. Plugging in a controller updates the status to true, as expected. However, disconnecting the controller does not update the status back to false.

Moving the controller to a different port in the Driver Station forces the status to update. Restarting the Driver Station does not resolve the issue or update the connection status.

To Reproduce
Steps to reproduce the behavior:

  1. Have no controllers plugged in.
  2. Start driver station
  3. View state of DriverStation.isJoystickConnected(0)
  4. Connect Controller to port 0
  5. View state of DriverStation.isJoystickConnected(0) (Should now be true)
  6. Disconnect controller
  7. View state of DriverStation.isJoystickConnected(0) Value is still true)
  • Link to code:

Expected behavior
The connected state between the driver station and the robot code should be the same and correctly reflect the connected state of the Controller.

Desktop (please complete the following information):

  • OS: Windows 10
  • Project Information: WPILib Information:
    Project Version: 2025.1.1
    VS Code Version: 1.96.2
    WPILib Extension Version: 2025.1.1
    C++ Extension Version: 1.23.2
    Java Extension Version: 1.38.0
    Java Debug Extension Version: 0.58.2024090204
    Java Dependencies Extension Version 0.24.1
    Java Version: 17
    Java Location: C:\Users\Public\wpilib\2025\jdk
    Vendor Libraries:
    AdvantageKit (4.0.0)
    PathplannerLib (2025.1.1)
    CTRE-Phoenix (v6) (25.1.0)
    ReduxLib (2025.0.0)
    REVLib (2025.0.0)
    Studica (2025.0.0)
    URCL (2025.0.0)
    WPILib-New-Commands (1.0.0)

Additional context
Using a xbox360 controller. Also verified same behavior on off brand controller as well.

Interesting note the DriverStation.getJoystickType(0) call does register a change on disconnect of a controller. It changes from 1 (when connected) to 255 (when disconnected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions