From Team 449 Wiki

OI stands for Operator Input, and is how we refer to the input gathering and processing part of the code, e.g. joysticks and button-to-command mapping.


We use multiple different kinds of button objects to represent using different things as buttons- SimpleButton represents a typical button that's activated when pressed, TriggerButton is for triggers and joysticks that are activated when pushed a certain amount in a certain direction, ButtonDigitalInput is activated by a switch connected to the RoboRIO, and dPadButton is activated when the D-pad on a controller is pressed in a certain direction. All of these extend MappedButton, a Jackson-compatible wrapper on WPILib's Button class. Any future types of buttons made should extend MappedButton as well.

Button Mapping

Buttons are mapped to commands via having a List of CommandButton objects in the config file. A CommandButton take a command, a button object, and an action of the button (e.g. being pressed, being released, while held, etc.) We don't need to do anything with the list, as the construction of the CommandButton does the binding.


Throttles are what we call our wrapper objects for a single joystick axis. Currently there are 5, ThrottleBasic, ThrottleDeadbanded, ThrottleExponential, ThrottlePolynomial, and ThrottleSum. All of them implement the Throttle interface. ThrottleBasic is just a simple throttle from a joystick, with an option for inversion. ThrottleDeadbanded extends ThrottleBasic and adds a deadband and an IIR filter. ThrottleExponential extends ThrottleDeadbanded and adds exponential scaling. ThrottlePolynomial also extends ThrottleDeadbanded and adds polynomial scaling. All scaling and smoothing is applied properly to the deadband so the deadband only rescales the input, rather than creating an abrupt jump. ThrottleSum takes any number of other throttles and adds their output.


The actual OI objects are contain multiple Throttles and occasionally some Buttons, and do math and logic with the throttle outputs and occasionally a D-pad to turn user input into numbers the drive code understands. Currently most OI objects extend OIUnidirectional, which is for tank-style robots that have a left side and a right side, but that will change when we start using holonomic drive systems like Meccanum and swerve. The two types of OIUnidirectional we have are OITank, where the left and right sticks control the velocities of the left and right sides of the drive directly, and OIArcade, where one stick controls forward-back velocity and the other controls turning, such that the output to the left is forward+rot and the right is forward-rot. However, for arcade, we often scale the rotational throttle's output by the output of the forwards throttle, so we get fine control of the angle while standing still and fast turning while going fast. This is implemented in OIArcadeWithDPad. The non-unidirectional OI is an OIFieldOriented, which is for "field-oriented" OIs where the angle the driver points a joystick is the angle the robot goes at relative to the field itself, not the robot's previous position like with arcade drive. It's implemented by OIFieldOrientedPosCos, which is a single-stick implementation that only allows the robot to point within 90 degrees of where it was turned on.