View Single Post
  #2   Spotlight this post!  
Unread 19-01-2017, 00:21
Bradley Boxer's Avatar
Bradley Boxer Bradley Boxer is offline
Registered User
AKA: Bradley Boxer
FRC #0303 (TEST Team 303)
Team Role: Programmer
 
Join Date: May 2015
Rookie Year: 2015
Location: United States
Posts: 26
Bradley Boxer is an unknown quantity at this point
Re: XboxController Class vs Joystick Class for KOP Xbox Controller

The XboxController class is new this year in wpilib, so most FRC example code will be written with the API that does not include it. If you look at the source code for the XboxController class (at C:\Users\(your user)\wpilib\java\current\lib\WPILib-sources\edu\wpi\first\wpilibj), you can see that it boils down to getRawAxis() and getRawButton() calls in GamepadBase, but does the figuring out of which controller button corresponds to which index for you.

For example, the method getAButton() literally just returns getRawButton(1).

Note: I assume it works the same way in C++, as I only checked the java source code.
__________________
The opinions expressed in this post are mine and do not necessarily reflect those of my team.

Last edited by Bradley Boxer : 19-01-2017 at 00:24. Reason: clarity
Reply With Quote