Package com.crossbotics.ftchelper.robot
Class Auto<R extends RobotDefinition>
java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.auto.EasyAuto
com.crossbotics.ftchelper.robot.Auto<R>
One autonomous, in one short file: the list of
Steps. Everything else (INIT menu with
alliance and start delay, red/blue mirroring, the 30 s timer, the park reserve, stopping
everything at the end, the report) is EasyAuto's.
@Autonomous(name = "Score and Park", preselectTeleOp = "TeleOp")
public class ScoreAndPark extends Auto<Robot> {
@Override protected void steps(Steps s, Robot robot) {
s.start("Back wall, 2nd tile from the left, facing the field", 0)
.run("Hold the piece", robot.claw::close)
.move("Drive to the goal", 24, 0, 0.6)
.action(Actions.scoreHigh(robot))
.parkWithSeconds(4)
.move("Park", 20, 90, 0.7);
}
}
A new autonomous: copy the file, change its name and its steps.
Checked before the match: autonomous refuses to run until Tunables.Drive.calibrated is
true (after the Drive Tuner), and a step that names a part not on the robot stops in INIT.
Docs: docs/modules/robot.md (section "Autos")
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.HardwareMapstatic final intintDeprecated.org.firstinspires.ftc.robotcore.external.TelemetryFields inherited from class com.crossbotics.ftchelper.auto.EasyAuto
SIMULATOR_PROPERTYFields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddChoices(InitMenu initMenu) Extra INIT choices, e.g.protected final voidExtra lines for the Driver Station during INIT (before START), every INIT loop.protected final voidbuildRoutine(AutoRoutine routine) Adds the steps.protected final SubsystemsYour mechanisms, kept working during every step.protected final FieldPoseendPose()The pose to hand to TeleOp at the end, or null (the default: the heading from the drive's IMU only).protected final StringWhat to do when the drive is not tuned, shown on the Driver Station instead of running.protected final doubleSeconds kept at the end for the steps afterthenPark().final voidprotected final Rrobot()The robot this autonomous runs (set up in INIT).protected final RobotConfigYour robot's settings, shared with TeleOp (seeRobotConfig).protected final doubleWhich way the robot faces at the start, compared with "straight away from your driver", in degrees (left = positive).protected final StringWhere to place the robot, shown in INIT so the drive team sets it up right.protected final double[]Where to place the robot, as seen from the BLUE drivers' wall (for RED: mirrored like the routes whenEasyAuto.mirrorForRed(), else the same numbers from the red wall): {x, y} in inches, x to the right of the field's centre line, y from the centre toward the far wall (negative = your half).protected abstract voidThe steps.Methods inherited from class com.crossbotics.ftchelper.auto.EasyAuto
alliance, alliancesOnOneWall, autoDrive, autoDriveConfig, choice, createImu, driveConfig, maxStartDelaySec, mirrorForRed, runOpModeMethods inherited from class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
idle, init, init_loop, isStarted, isStopRequested, loop, opModeInInit, opModeIsActive, sleep, start, stop, waitForStartMethods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
getRuntime, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, resetRuntime, terminateOpModeNow, updateTelemetry
-
Field Details
-
MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED
public static final int MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED- See Also:
-
gamepad1
public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad1 -
gamepad2
public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad2 -
telemetry
public org.firstinspires.ftc.robotcore.external.Telemetry telemetry -
hardwareMap
public volatile com.qualcomm.robotcore.hardware.HardwareMap hardwareMap -
msStuckDetectStop
Deprecated.
-
-
Constructor Details
-
Auto
public Auto()
-
-
Method Details
-
steps
The steps. Read once in INIT (for the menu and start; nothing runs) and once after START.- Parameters:
s- the step listrobot- the robot (set up: its modules can be named in steps)
-
robot
The robot this autonomous runs (set up in INIT). -
robotConfig
Description copied from class:EasyAutoYour robot's settings, shared with TeleOp (seeRobotConfig). Returnnew RobotSettings(). If you do not have one, overrideEasyAuto.driveConfig(),EasyAuto.autoDriveConfig()andEasyAuto.createImu()instead.- Overrides:
robotConfigin classEasyAuto
-
createSubsystems
Description copied from class:EasyAutoYour mechanisms, kept working during every step. Default: none. Returning null also means none. It is called again (after START) if the drivers change the profile in INIT, so the mechanisms get the new profile's values: make new objects here, do not keep old ones.- Overrides:
createSubsystemsin classEasyAuto
-
addChoices
Description copied from class:EasyAutoExtra INIT choices, e.g.menu.choice("Route", "Near", "Far").- Overrides:
addChoicesin classEasyAuto
-
startPosition
Description copied from class:EasyAutoWhere to place the robot, shown in INIT so the drive team sets it up right.- Overrides:
startPositionin classEasyAuto
-
startSpotIn
protected final double[] startSpotIn()Description copied from class:EasyAutoWhere to place the robot, as seen from the BLUE drivers' wall (for RED: mirrored like the routes whenEasyAuto.mirrorForRed(), else the same numbers from the red wall): {x, y} in inches, x to the right of the field's centre line, y from the centre toward the far wall (negative = your half). Null (default) = not given. The heading isEasyAuto.startHeadingDeg(). The simulator puts the robot there in INIT.- Overrides:
startSpotInin classEasyAuto
-
startHeadingDeg
protected final double startHeadingDeg()Description copied from class:EasyAutoWhich way the robot faces at the start, compared with "straight away from your driver", in degrees (left = positive). Default 0. TeleOp's field-centric "forward" uses it (see drive/DriverHeading.java). Example: the robot starts turned a quarter turn left, so return 90. Write it for BLUE, like the routes: it is mirrored for RED whenEasyAuto.mirrorForRed()is true.- Overrides:
startHeadingDegin classEasyAuto
-
parkReserveSec
protected final double parkReserveSec()Description copied from class:EasyAutoSeconds kept at the end for the steps afterthenPark(). Default 0.- Overrides:
parkReserveSecin classEasyAuto
-
notTunedHelp
Description copied from class:EasyAutoWhat to do when the drive is not tuned, shown on the Driver Station instead of running. Default: the Drive Tuner, thencalibrationConfirmed = truein your settings.- Overrides:
notTunedHelpin classEasyAuto
-
addInitTelemetry
Description copied from class:EasyAutoExtra lines for the Driver Station during INIT (before START), every INIT loop.- Overrides:
addInitTelemetryin classEasyAuto
-
endPose
Description copied from class:EasyAutoThe pose to hand to TeleOp at the end, or null (the default: the heading from the drive's IMU only). With odometry: x inches right, y away from the drivers' wall, heading 0 = facing away. -
buildRoutine
Description copied from class:EasyAutoAdds the steps. Runs AFTER INIT, soEasyAuto.alliance()andEasyAuto.choice(String)are known.- Specified by:
buildRoutinein classEasyAuto
-
requestOpModeStop
public final void requestOpModeStop()
-