Operator Input‎ > ‎

Joysticks and Game Controllers

Types of Controllers

There are two main classes of controllers used to drive robots in FRC:
  • Joysticks
  • Game Controllers
Game controllers are the vast majority of the controllers used by FRC teams.  Typical Game Controllers include:
The predominant Joystick in use is:


XBOX - team 5911 - Hafsa
Logitech - team 1310 - Cole
Playstation - team 1310 - Tomasz
X3DPro Joystick - 5596 Khalil

Turning Algorithm
team 1310 - Cole
team 5596 - Khalil

Game Controllers

The typical Game Controller has the following features:
  • 2 joysticks - left and right
  • 4 primary or face buttons on the right hand
  • 2 or 3 game mode buttons in the center (back, start)
  • left and right bumper buttons
  • left and right analog triggers
  • Point of View (POV) rocker control or D-pad
From Wikipedia (XBox 360 controller):
From wikipedia

The Trouble with Game Controllers

One unfortunate property of Game Controllers is that the DriverStation maps each of the game controller types from the various manufacturers differently.  The buttons, sticks, and triggers may differ between controllers, and can even differ based on mode within a controller (the F310 has X mode and D mode).  

This means that if you switch controller types, or even switch a setting on a controller, the code may not work properly.

Our Solution

In order to separate the button numbers from the buttons, we implemented a GameController class:

 Function WPILib  Toronto Framework
 Declaration private Joystick joystick = new Joystick(1); private GameController gameController = new GameController_Logitech(1);
 Get Speed and Turn double speed = joystick.getRawAxis(1);
 double turn    = joystick.getRawAxis(4);
 double speed = gameController.getAxis(Stick.LEFT, Axis.Y);
 double turn    = gameController.getAxis(Stick.RIGHT, Axis.X);
 Get Button  boolean buttonAPressed = joystick.getRawButton(1); boolean buttonAPressed = gameController.getButton(Button.A);

The Toronto Framework code allows the coder to easily program for the correct game controller stick and axis without needing to know the axis number or button numbers from the SmartDashboard.  To change the controller to a PlayStation controller, a GameController_PlayStation class needs to be instantiated instead of a Logitech game controller, and all of the code remains the same.  The buttons A,B,X,Y would be mapped by position to the Square, Circle, Cross, Triangle buttons on Playstation controller.  This is much easier than using the WPILib code where each instance of getRawAxis, or getRawButton would need to be updated for the new game controller type.