Package com.crossbotics.ftchelper.match
Class InitMenu
java.lang.Object
com.crossbotics.ftchelper.match.InitMenu
A menu for the INIT screen: choose alliance, start delay, route and more with the gamepad,
before pressing START. The robot does not move in INIT, so this is safe.
InitMenu menu = new InitMenu(gamepad1)
.alliance() // X = blue, B = red
.delay(10) // 0..10 s start delay
.choice("Route", "Near", "Far") // any list of options
.profile(); // practice / competition (saved)
while (opModeInInit()) {
menu.update();
menu.addTelemetry(t);
t.update();
}
Alliance a = menu.getAlliance();
if (menu.get("Route").equals("Far")) { ... }
Controls: D-pad up/down = choose a line, D-pad left/right = change it. Shortcuts: X = blue, B = red.
Each "add" method returns this same menu, so you can chain them as in the example.
update() never waits: it reads the buttons once and returns, so the INIT loop keeps running.
Docs: docs/modules/match.md (section "InitMenu"). EasyAuto builds this menu for you
(Tutorial 16).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidShows the menu.alliance()Adds the alliance choice (starts at the alliance remembered from earlier, else BLUE).Adds a choice from a list.delay(double maxSeconds) Adds a start delay choice, 0 tomaxSeconds, in 1-second steps.The chosen option of a choice line, e.g.The chosen alliance (BLUE if there is no alliance line).doubleThe chosen start delay in seconds (0 if there is no delay line).booleanTrue if a yes/no line is YES.profile()Adds the practice/competition profile choice (saved on the hub when changed).voidupdate()Reads the gamepad.Adds a yes/no choice.
-
Constructor Details
-
InitMenu
public InitMenu(com.qualcomm.robotcore.hardware.Gamepad gamepad) - Parameters:
gamepad- the gamepad used to choose (usually gamepad1)
-
-
Method Details
-
alliance
Adds the alliance choice (starts at the alliance remembered from earlier, else BLUE). -
delay
Adds a start delay choice, 0 tomaxSeconds, in 1-second steps. -
choice
Adds a choice from a list. The first option is the default. (String... optionsmeans you can pass as many text options as you like.) -
yesNo
Adds a yes/no choice. -
profile
Adds the practice/competition profile choice (saved on the hub when changed). -
update
public void update()Reads the gamepad. Call every loop during INIT. -
addTelemetry
Shows the menu. -
getAlliance
The chosen alliance (BLUE if there is no alliance line). -
getDelaySec
public double getDelaySec()The chosen start delay in seconds (0 if there is no delay line). -
get
The chosen option of a choice line, e.g.get("Route"). -
isYes
True if a yes/no line is YES.
-