Class DSGamepadChooser
java.lang.Object
org.wpilib.driverstation.DSGamepadChooser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA single named set of selectable options. -
Constructor Summary
ConstructorsConstructorDescriptionDSGamepadChooser(int port) Constructs a DSGamepadChooser.DSGamepadChooser(Gamepad gamepad) Constructs a DSGamepadChooser. -
Method Summary
Modifier and TypeMethodDescriptionaddDoubleOptions(String name, double min, double max, double delta) Adds a selectable with floating point options frommintomax, inclusive, stepping bydelta.addIntegerOptions(String name, int min, int max, int delta) Adds a selectable with integer options frommintomax, inclusive, stepping bydelta.addOptions(String name, String... options) Adds a selectable with the given options.addOptions(String name, List<String> options) Adds a selectable with the given options.Get the gamepad used to change selections.Gets the names of all selectables.getSelected(String name) Gets the currently selected option for a selectable.doublegetSelectedDouble(String name) Gets the currently selected double option for a selectable.intgetSelectedIndex(String name) Gets the currently selected option index for a selectable.intgetSelectedInteger(String name) Gets the currently selected integer option for a selectable.Gets the selectable currently controlled by D-pad left and right.voidupdate()Updates selectable selection and adds the current selections to the driver station display.
-
Constructor Details
-
DSGamepadChooser
public DSGamepadChooser(int port) Constructs a DSGamepadChooser.- Parameters:
port- The port index on the Driver Station that the gamepad is plugged into (0-5).
-
DSGamepadChooser
Constructs a DSGamepadChooser.- Parameters:
gamepad- The gamepad used to change selections.
-
-
Method Details
-
getGamepad
-
addOptions
Adds a selectable with the given options.The first option is selected by default.
- Parameters:
name- selectable nameoptions- available options- Returns:
- the created selectable
-
addOptions
Adds a selectable with the given options.The first option is selected by default.
- Parameters:
name- selectable nameoptions- available options- Returns:
- the created selectable
-
addIntegerOptions
public DSGamepadChooser.GamepadSelectable addIntegerOptions(String name, int min, int max, int delta) Adds a selectable with integer options frommintomax, inclusive, stepping bydelta.The first option is selected by default.
- Parameters:
name- selectable namemin- minimum optionmax- maximum optiondelta- amount between options- Returns:
- the created selectable
-
addDoubleOptions
public DSGamepadChooser.GamepadSelectable addDoubleOptions(String name, double min, double max, double delta) Adds a selectable with floating point options frommintomax, inclusive, stepping bydelta.The first option is selected by default.
- Parameters:
name- selectable namemin- minimum optionmax- maximum optiondelta- amount between options- Returns:
- the created selectable
-
update
public void update()Updates selectable selection and adds the current selections to the driver station display.The D-pad up and down buttons select which selectable is active. The D-pad left and right buttons change the selected option in the active selectable.
Call
DriverStationDisplay.updateLines()externally to flush display updates. -
getSelected
-
getSelectedInteger
Gets the currently selected integer option for a selectable.- Parameters:
name- selectable name- Returns:
- the currently selected option
-
getSelectedDouble
Gets the currently selected double option for a selectable.- Parameters:
name- selectable name- Returns:
- the currently selected option
-
getSelectedIndex
Gets the currently selected option index for a selectable.- Parameters:
name- selectable name- Returns:
- the currently selected option index
-
getSelectableNames
-
getSelectedSelectable
Gets the selectable currently controlled by D-pad left and right.- Returns:
- the selected selectable
-