Class Steps
Auto). Each method adds a step and
hands the list back, so they chain:
s.start("Back wall, 2nd tile from the left, facing the field", 0)
.menuYesNo("Score", true)
.run("Hold the piece", robot.claw::close)
.move("Leave the wall", 4, 0, 0.4)
.onlyIf("Score")
.run("Lift up", () -> robot.lift.goTo("high")) // rises during the next moves
.move("Drive to the goal", 24, 0, 0.6)
.turn("Face the goal", 45, 0.5) // mirrored for RED
.waitUntil("Lift at the top", robot.lift::isAtTarget, 2.0)
.run("Drop", robot.claw::open)
.end()
.parkWithSeconds(4)
.move("Park", 20, 90, 0.7);
Moves and turns: directions in degrees, clockwise from forward for moves (0 forward, 90 right),
counterclockwise + for turns; written for BLUE and mirrored for RED. Distances in inches, powers
0 to 1. Each move or turn waits until it is done; run starts something and goes on at once
(the mechanisms keep moving during the next steps).
The list is read in INIT (to learn the menu, the start position and the park time: no step runs
then), again in INIT each time the drivers change a menu line (so a start(...) or
parkWithSeconds(...) inside an onlyIf follows the choice), and once after START.
So write only steps here, no other code with side effects.
Docs: docs/modules/robot.md (section "Autos")
-
Method Summary
Modifier and TypeMethodDescriptionaction(Action, double)with up to 10 seconds.Runs an action from Actions.java and waits until it is done (at mosttimeoutSec).Starts an action and goes on at once: it runs during the next steps.The option chosen for this label.Drives to a point on the field, using the odometry, and turns to a heading at the same time (mecanum).driveTo(String label, double xIn, double yIn, double headingDeg, double maxPower, double toleranceIn) driveTo(String, double, double, double, double)with your own "close enough", inches.driveTo(String label, double xIn, double yIn, double headingDeg, double maxPower, double toleranceIn, PathAt... along) driveTo(String, double, double, double, double, PathAt...)with your own "close enough", inches.driveTo(String, double, double, double, double)that also starts things on the way:PathAt.inchesLeft(12, ...),PathAt.fraction(0.5, ...),PathAt.near(...).end()Ends the latestonlyIf(java.lang.String).Follows a path with the robot's path follower (Robot.java'sfollower(...)line, e.g.follow(String, Object)with your own time limit, seconds.follow(String, Object, PathAt...)with your own time limit, seconds.follow(String, Object)that also starts things ALONG the path, while the robot keeps driving.booleanTrue if the yes/no choice is "yes".menuChoice(String label, String... options) A choice between options in the INIT menu, read withonlyIf(String, String)orchoice(java.lang.String).A yes/no choice in the INIT menu (D-pad), read withonlyIf(java.lang.String)orisYes(java.lang.String).Drives a distance in a direction (clockwise from forward: 0 forward, 90 right, 180 back).The steps up toend()run only if the yes/no choice is "yes".The steps up toend()run only if this option was chosen.parkWithSeconds(double seconds) The steps after this are PARK steps, and they get the lastsecondsof autonomous: when only that many seconds are left, the step running before it stops at once and the rest before it are skipped; the park steps always run.Runs a command now and goes on at once (e.g.Where to place the robot (shown in INIT) and which way it faces, degrees from "straight away from your driver", counterclockwise + (TeleOp's field-centric forward uses it).Where to place the robot: the note for the drive team (shown in INIT), and the spot as seen from your drivers' wall, written for BLUE:xIninches to the right of the field's centre line,yInfrom the centre toward the far wall (negative = your half), heading 0 = facing away from you, counterclockwise +.Any other step (a mechanism's step, or your own: seeAutoStep).Turns by an angle (counterclockwise +).Turns to a heading (0 = the way it faced at the start, counterclockwise +).waitSeconds(String label, double seconds) Waits this long (the mechanisms keep working).waitUntil(String label, BooleanSupplier condition, double timeoutSec) Waits until something is true, at mosttimeoutSec(the report says if it timed out).
-
Method Details
-
start
Where to place the robot (shown in INIT) and which way it faces, degrees from "straight away from your driver", counterclockwise + (TeleOp's field-centric forward uses it). -
start
Where to place the robot: the note for the drive team (shown in INIT), and the spot as seen from your drivers' wall, written for BLUE:xIninches to the right of the field's centre line,yInfrom the centre toward the far wall (negative = your half), heading 0 = facing away from you, counterclockwise +. RED uses it like the routes: mirrored left-right, or (withmirrorForRed()false, a field turned half a turn like BIOBUZZ) the same numbers from the red wall. The simulator puts the robot there.s.start("Against our wall, 2nd tile from the left, facing the field", -36, -63, 0) -
isYes
True if the yes/no choice is "yes". -
choice
The option chosen for this label. -
onlyIf
The steps up toend()run only if the yes/no choice is "yes". -
onlyIf
The steps up toend()run only if this option was chosen. -
end
Ends the latestonlyIf(java.lang.String). -
move
Drives a distance in a direction (clockwise from forward: 0 forward, 90 right, 180 back). Waits until done. -
driveTo
Drives to a point on the field, using the odometry, and turns to a heading at the same time (mecanum). Seen from your drivers' wall, written for BLUE like the start spot:xIninches right of the centre line,yIninches from the centre toward the far wall, heading 0 = facing away, counterclockwise +. Waits until it is there (within 1 inch).Needs an
odometry(...)line in Robot.java, andTunables.Odometry.checked = trueon a real robot (the Odometry Tuner); until then the step is skipped and the report says why. -
driveTo
public Steps driveTo(String label, double xIn, double yIn, double headingDeg, double maxPower, PathAt... along) driveTo(String, double, double, double, double)that also starts things on the way:PathAt.inchesLeft(12, ...),PathAt.fraction(0.5, ...),PathAt.near(...). The "path" is the straight line from where the robot is when the step starts to the point. (PathAt.part(n)needs a path with parts: onlypart(1)works here.) -
driveTo
public Steps driveTo(String label, double xIn, double yIn, double headingDeg, double maxPower, double toleranceIn) driveTo(String, double, double, double, double)with your own "close enough", inches. -
driveTo
public Steps driveTo(String label, double xIn, double yIn, double headingDeg, double maxPower, double toleranceIn, PathAt... along) driveTo(String, double, double, double, double, PathAt...)with your own "close enough", inches. -
follow
Follows a path with the robot's path follower (Robot.java'sfollower(...)line, e.g. Pedro Pathing through the "pedro" module), and waits until it is at the end. The path is written for BLUE like everything else: on RED with mirroring on, the follower mirrors it. At most 10 s. Like driveTo, it is skipped untilTunables.Odometry.checked = true(not in the simulator).- Parameters:
path- the path (for Pedro:PedroPath.line(...)or a Pedro Path)
-
follow
follow(String, Object)that also starts things ALONG the path, while the robot keeps driving. Each happens once:
If the path ends early, the report says which did not happen. Sees.follow("To the goal", TO_GOAL, PathAt.fraction(0.5, "Intake on", robot.intake::in), // halfway along the whole path PathAt.inchesLeft(12, "Spin up", robot.launcher::spinUp)); // 12 in before the endPathAt. -
follow
follow(String, Object)with your own time limit, seconds. -
follow
follow(String, Object, PathAt...)with your own time limit, seconds. -
turn
Turns by an angle (counterclockwise +). Waits until done. -
turnTo
Turns to a heading (0 = the way it faced at the start, counterclockwise +). Waits until done. -
run
Runs a command now and goes on at once (e.g.() -> robot.lift.goTo("high")). -
waitSeconds
Waits this long (the mechanisms keep working). -
waitUntil
Waits until something is true, at mosttimeoutSec(the report says if it timed out). -
action
Runs an action from Actions.java and waits until it is done (at mosttimeoutSec). -
action
action(Action, double)with up to 10 seconds. -
alongside
Starts an action and goes on at once: it runs during the next steps. -
step
Any other step (a mechanism's step, or your own: seeAutoStep). -
parkWithSeconds
The steps after this are PARK steps, and they get the lastsecondsof autonomous: when only that many seconds are left, the step running before it stops at once and the rest before it are skipped; the park steps always run. The report says which were cut short or skipped. Docs: docs/modules/robot.md, "Keep time to park".- Parameters:
seconds- how long the park steps take, plus a little (from a timed run)
-