Package com.crossbotics.ftchelper.robot
Class Lights.Rule
java.lang.Object
com.crossbotics.ftchelper.robot.Lights.Rule
- Enclosing class:
Lights
One rule, started with
Lights.show(LightColor). Add blinking() or
forSeconds(...) if you like, then finish it with when, whenStarts, whenCountGoesUp or inLastSeconds.-
Method Summary
Modifier and TypeMethodDescriptionblinking()Blinks on and off, 2 times a second.blinking(double timesPerSecond) Blinks on and off this many times a second.forSeconds(double seconds) ForwhenStarts(java.util.function.BooleanSupplier)andwhenCountGoesUp(java.util.function.IntSupplier): how long the flash lasts (default 0.5 s).inLastSeconds(double seconds) Shows the color in the last seconds of TeleOp's 2:00, counted from START (likeMatchTimer: a reminder, about a second off from the field clock).when(BooleanSupplier condition) Shows the color while this is true (checked every loop, in the order the rules were written).whenCountGoesUp(IntSupplier count) Flashes the color (0.5 s, orforSeconds(double)) each time this number goes up: one flash per piece really fired, even whenfire(3)fires three in a row (whenStarts(java.util.function.BooleanSupplier)withisShootingflashes once for all three).whenStarts(BooleanSupplier condition) Flashes the color (0.5 s, orforSeconds(double)) each time this turns from false to true: a piece picked up, the launcher starting to shoot.
-
Method Details
-
blinking
Blinks on and off, 2 times a second. -
blinking
Blinks on and off this many times a second.- Parameters:
timesPerSecond- more than 0 (e.g. 1 = once a second, 0.5 = every 2 s), at most 5 (FTC R202 J: faster blinking can be stopped by the referees)
-
forSeconds
ForwhenStarts(java.util.function.BooleanSupplier)andwhenCountGoesUp(java.util.function.IntSupplier): how long the flash lasts (default 0.5 s).- Parameters:
seconds- more than 0
-
when
Shows the color while this is true (checked every loop, in the order the rules were written).- Parameters:
condition- e.g.robot.intake::isRunningor() -> robot.lift.position() > 1000- Returns:
- the light, for the next rule
-
whenStarts
Flashes the color (0.5 s, orforSeconds(double)) each time this turns from false to true: a piece picked up, the launcher starting to shoot. Something already true at the start does not flash. For one flash per piece fired usewhenCountGoesUp(java.util.function.IntSupplier)with the launcher's shot count.- Parameters:
condition- e.g.robot.intake::isRunning- Returns:
- the light, for the next rule
-
whenCountGoesUp
Flashes the color (0.5 s, orforSeconds(double)) each time this number goes up: one flash per piece really fired, even whenfire(3)fires three in a row (whenStarts(java.util.function.BooleanSupplier)withisShootingflashes once for all three). The number it has at the start does not flash.- Parameters:
count- e.g.() -> robot.launcher.part().getShotsFired()(pieces fed into the wheel)- Returns:
- the light, for the next rule
-
inLastSeconds
Shows the color in the last seconds of TeleOp's 2:00, counted from START (likeMatchTimer: a reminder, about a second off from the field clock).- Parameters:
seconds- e.g. 20 for "the last 20 seconds"- Returns:
- the light, for the next rule
-