Can't get axis values of Xbox controller

My team has recently switched to MK4 swerve modules and we’re having some trouble with the Xbox controller. In the Swerve drive specialties example code (and every example code that I’ve come across on Chiefdelphi), the way you get the double value is
double forwardback = -modifyAxis(m_controller.getY(GenericHID.Hand.kLeft)) * DrivetrainSubsystem.MAX_VELOCITY_METERS_PER_SECOND;

The issue I’m having is GenericHID.Hand.kLeft doesn’t exist. In fact, if you were to go into the GenericHID.class file, there is no enum called Hand, and kLeft/kRight don’t exist. How am I supposed to get the axis values of the Xbox controller if these don’t exist? If I am missing something, please let me know. Thanks!

Check the 11th bullet point under the “General Library” heading

1 Like

Use the official XboxController class instead. The class has methods for reading a specific axis (left or right).

https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj/XboxController.html

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.