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>

public abstract class Auto<R extends RobotDefinition> extends EasyAuto
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

    Fields
    Modifier and Type
    Field
    Description
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.HardwareMap
     
    static final int
     
    int
    Deprecated.
    org.firstinspires.ftc.robotcore.external.Telemetry
     

    Fields inherited from class com.crossbotics.ftchelper.auto.EasyAuto

    SIMULATOR_PROPERTY

    Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

    blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    addChoices(InitMenu initMenu)
    Extra INIT choices, e.g.
    protected final void
    Extra lines for the Driver Station during INIT (before START), every INIT loop.
    protected final void
    Adds the steps.
    protected final Subsystems
    Your mechanisms, kept working during every step.
    protected final FieldPose
    The pose to hand to TeleOp at the end, or null (the default: the heading from the drive's IMU only).
    protected final String
    What to do when the drive is not tuned, shown on the Driver Station instead of running.
    protected final double
    Seconds kept at the end for the steps after thenPark().
    final void
     
    protected final R
    The robot this autonomous runs (set up in INIT).
    protected final RobotConfig
    Your robot's settings, shared with TeleOp (see RobotConfig).
    protected final double
    Which way the robot faces at the start, compared with "straight away from your driver", in degrees (left = positive).
    protected final String
    Where 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 when EasyAuto.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 void
    steps(Steps s, R robot)
    The steps.

    Methods inherited from class com.crossbotics.ftchelper.auto.EasyAuto

    alliance, alliancesOnOneWall, autoDrive, autoDriveConfig, choice, createImu, driveConfig, maxStartDelaySec, mirrorForRed, runOpMode

    Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode

    idle, init, init_loop, isStarted, isStopRequested, loop, opModeInInit, opModeIsActive, sleep, start, stop, waitForStart

    Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

    getRuntime, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, resetRuntime, terminateOpModeNow, updateTelemetry

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 public int msStuckDetectStop
      Deprecated.
  • Constructor Details

    • Auto

      public Auto()
  • Method Details

    • steps

      protected abstract void steps(Steps s, R robot)
      The steps. Read once in INIT (for the menu and start; nothing runs) and once after START.
      Parameters:
      s - the step list
      robot - the robot (set up: its modules can be named in steps)
    • robot

      protected final R robot()
      The robot this autonomous runs (set up in INIT).
    • robotConfig

      protected final RobotConfig robotConfig()
      Description copied from class: EasyAuto
      Your robot's settings, shared with TeleOp (see RobotConfig). Return new RobotSettings(). If you do not have one, override EasyAuto.driveConfig(), EasyAuto.autoDriveConfig() and EasyAuto.createImu() instead.
      Overrides:
      robotConfig in class EasyAuto
    • createSubsystems

      protected final Subsystems createSubsystems()
      Description copied from class: EasyAuto
      Your 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:
      createSubsystems in class EasyAuto
    • addChoices

      protected final void addChoices(InitMenu initMenu)
      Description copied from class: EasyAuto
      Extra INIT choices, e.g. menu.choice("Route", "Near", "Far").
      Overrides:
      addChoices in class EasyAuto
    • startPosition

      protected final String startPosition()
      Description copied from class: EasyAuto
      Where to place the robot, shown in INIT so the drive team sets it up right.
      Overrides:
      startPosition in class EasyAuto
    • startSpotIn

      protected final double[] startSpotIn()
      Description copied from class: EasyAuto
      Where to place the robot, as seen from the BLUE drivers' wall (for RED: mirrored like the routes when EasyAuto.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 is EasyAuto.startHeadingDeg(). The simulator puts the robot there in INIT.
      Overrides:
      startSpotIn in class EasyAuto
    • startHeadingDeg

      protected final double startHeadingDeg()
      Description copied from class: EasyAuto
      Which 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 when EasyAuto.mirrorForRed() is true.
      Overrides:
      startHeadingDeg in class EasyAuto
    • parkReserveSec

      protected final double parkReserveSec()
      Description copied from class: EasyAuto
      Seconds kept at the end for the steps after thenPark(). Default 0.
      Overrides:
      parkReserveSec in class EasyAuto
    • notTunedHelp

      protected final String notTunedHelp()
      Description copied from class: EasyAuto
      What to do when the drive is not tuned, shown on the Driver Station instead of running. Default: the Drive Tuner, then calibrationConfirmed = true in your settings.
      Overrides:
      notTunedHelp in class EasyAuto
    • addInitTelemetry

      protected final void addInitTelemetry(RobotTelemetry t)
      Description copied from class: EasyAuto
      Extra lines for the Driver Station during INIT (before START), every INIT loop.
      Overrides:
      addInitTelemetry in class EasyAuto
    • endPose

      protected final FieldPose endPose()
      Description copied from class: EasyAuto
      The 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.
      Overrides:
      endPose in class EasyAuto
    • buildRoutine

      protected final void buildRoutine(AutoRoutine routine)
      Description copied from class: EasyAuto
      Adds the steps. Runs AFTER INIT, so EasyAuto.alliance() and EasyAuto.choice(String) are known.
      Specified by:
      buildRoutine in class EasyAuto
    • requestOpModeStop

      public final void requestOpModeStop()