Class EasyTeleOp

java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.teleop.EasyTeleOp
Direct Known Subclasses:
ControlMap

public abstract class EasyTeleOp extends com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
A whole TeleOp where you only write what is special about YOUR robot: its mechanisms, the operator's buttons, and any extra screen lines. Everything every TeleOp needs is done for you:
  • Driving on gamepad 1 (DriverControls): left stick drive, right stick X turn, left trigger slow. Mecanum and tank. Robot-centric to start; Y = field-centric on/off (mecanum).
  • Field-centric "forward" continues from autonomous (DriverHeading); BACK resets it.
  • The alliance from autonomous (alliance()), the 2:00 match timer with gamepad buzzes at 1:00 and 0:20, the tuning menu on GUIDE (PRACTICE profile only), debug telemetry on START + BACK, warnings for slow code, a tuned value or the PRACTICE profile.
  • Every mechanism updated every loop, and EVERYTHING stopped at the end, even after an error.

 @TeleOp(name = "Main TeleOp")
 public class MainTeleOp extends EasyTeleOp {
     private Robot robot;

     @Override protected RobotConfig robotConfig() { return new RobotSettings(); }
     @Override protected Subsystems createSubsystems() { robot = new Robot(hardwareMap); return robot.all; }

     @Override protected void bindButtons(ControllerBindings driver, ControllerBindings operator) {
         operator.bindPress(Pad.G2, Btn.RB, robot.claw::toggle);
     }
 }
 

Order in each loop: buttons, driving, everyLoop(), mechanisms' update(), telemetry. Nothing here waits. Your code must not wait either (docs/guides/non-blocking.md). Docs: docs/modules/teleop.md. Tutorial: docs/tutorials/20-easy-teleop.md.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    How long BACK is held to reset "forward" when a tap of BACK has another job, seconds.
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.Gamepad
     
    static final double
    How long GUIDE is held to open the tuning menu when there is a button map, seconds.
    com.qualcomm.robotcore.hardware.HardwareMap
     
    static final int
     
    int
    Deprecated.
    org.firstinspires.ftc.robotcore.external.Telemetry
     

    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 void
    Extra lines for the Driver Station during INIT (before START), every INIT loop.
    protected void
    Extra lines for the Driver Station, every loop.
    protected Alliance
    The alliance autonomous chose (BLUE if no autonomous ran in the last few minutes).
    protected Runnable
    What a tap of BACK does, or null (default): then BACK resets "forward".
    protected void
    Your buttons.
    protected List<String>
    The button map's lines for the help page, or null (default) for none.
    protected double[]
    Seconds left when both gamepads buzz.
    protected void
    Changes how driving feels, once, in INIT, right after the drive is made.
    protected DriverHeading
    createHeading(com.qualcomm.robotcore.hardware.IMU imu)
    The driver's heading for field-centric driving: from the IMU (with autonomous's saved heading).
    protected com.qualcomm.robotcore.hardware.IMU
     
    protected Subsystems
    Your mechanisms: kept updated every loop and stopped at the end.
    protected void
    drive(com.qualcomm.robotcore.hardware.Gamepad gamepad)
    Drives the robot from gamepad 1, every loop (not while the tuning menu is open).
    protected DriveConfig
    The drivetrain settings.
    protected DriverControls
    The driving (field-centric on/off, slow mode).
    protected void
    Your own code for every loop, e.g.
    The gamepad 1 button that switches field-centric driving on and off (mecanum with an IMU only).
    protected DriverHeading
    The heading compared with the driver, or null if there is no IMU.
    protected boolean
    True while the tuning menu is open.
    protected MatchTimer
    The 2:00 match timer (started at START).
    protected void
    Runs once, right after START, before the first loop.
    final void
     
    protected RobotConfig
    Your robot's settings, shared with autonomous (see RobotConfig).
    protected RobotTelemetry
    The Driver Station screen helper (warnings, standard and debug lines).
    final void
    The whole TeleOp.
    protected double
    Speed at a full squeeze of the slow trigger, 0 to 1.
    protected boolean
    True to start in field-centric mode.

    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

    • BACK_HOLD_SEC

      public static final double BACK_HOLD_SEC
      How long BACK is held to reset "forward" when a tap of BACK has another job, seconds.
      See Also:
    • GUIDE_HOLD_SEC

      public static final double GUIDE_HOLD_SEC
      How long GUIDE is held to open the tuning menu when there is a button map, seconds.
      See Also:
    • 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

    • EasyTeleOp

      public EasyTeleOp()
  • Method Details

    • robotConfig

      protected RobotConfig robotConfig()
      Your robot's settings, shared with autonomous (see RobotConfig). Return new RobotSettings(). If you do not have one, override driveConfig() and createImu() instead.
    • driveConfig

      protected DriveConfig driveConfig()
      The drivetrain settings. Default: robotConfig().drive().
    • createHeading

      protected DriverHeading createHeading(com.qualcomm.robotcore.hardware.IMU imu)
      The driver's heading for field-centric driving: from the IMU (with autonomous's saved heading). The robot in five files uses its odometry instead when it has one.
      Parameters:
      imu - the IMU from createImu(), or null
    • createImu

      protected com.qualcomm.robotcore.hardware.IMU createImu()
    • createSubsystems

      protected Subsystems createSubsystems()
      Your mechanisms: kept updated every loop and stopped at the end. Default: none.
    • bindButtons

      protected void bindButtons(ControllerBindings driver, ControllerBindings operator)
      Your buttons. Put gamepad 2 buttons on operator. Extra gamepad 1 buttons go on driver: those pause while the tuning menu is open (it uses gamepad 1). Already taken on gamepad 1: Y (field-centric; see fieldCentricButton()), BACK, START + BACK, GUIDE.
    • everyLoop

      protected void everyLoop()
      Your own code for every loop, e.g. a stick that moves the lift by hand. Runs after the buttons and driving, before the mechanisms update. Must be quick: never wait here.
    • addTelemetry

      protected void addTelemetry(RobotTelemetry t)
      Extra lines for the Driver Station, every loop. The mechanisms' lines are already shown.
    • buttonHelp

      protected List<String> buttonHelp()
      The button map's lines for the help page, or null (default) for none. With a map, a tap of GUIDE shows it during the match and holding GUIDE 1 s opens the tuning menu; without one, GUIDE opens the tuning menu.
    • backTap

      protected Runnable backTap()
      What a tap of BACK does, or null (default): then BACK resets "forward". With a job here (a Controls.java TeleOp: pause everything), holding BACK BACK_HOLD_SEC resets "forward".
    • addInitTelemetry

      protected void addInitTelemetry(RobotTelemetry t)
      Extra lines for the Driver Station during INIT (before START), every INIT loop.
    • onStart

      protected void onStart()
      Runs once, right after START, before the first loop. Must be quick: start things here, never wait. Nothing may move before START, so this is the first moment a mechanism may move.
    • startFieldCentric

      protected boolean startFieldCentric()
      True to start in field-centric mode. Default false (robot-centric).
    • fieldCentricButton

      protected ControllerBindings.Btn fieldCentricButton()
      The gamepad 1 button that switches field-centric driving on and off (mecanum with an IMU only). Default Y. Return null for none (then field-centric stays as startFieldCentric() says).
    • slowSpeed

      protected double slowSpeed()
      Speed at a full squeeze of the slow trigger, 0 to 1. Default 0.3.
    • configureDriving

      protected void configureDriving(DriverControls driving)
      Changes how driving feels, once, in INIT, right after the drive is made. Example: driving.sticks(0.08, 3); for a bigger deadband and a stronger curve.
    • buzzAtSecondsLeft

      protected double[] buzzAtSecondsLeft()
      Seconds left when both gamepads buzz. Default 60 and 20 (1:00 and 0:20 left). Change it to the moments that matter in this season's game.
    • drive

      protected void drive(com.qualcomm.robotcore.hardware.Gamepad gamepad)
      Drives the robot from gamepad 1, every loop (not while the tuning menu is open). Default: the standard controls. Replace it to drive your own way, with driving()'s drive(...) or tank(...). Example, two-stick tank style:
      
       @Override protected void drive(Gamepad gamepad) {
           driving().tank(-gamepad.left_stick_y, -gamepad.right_stick_y, 1);
       }
       
    • alliance

      protected Alliance alliance()
      The alliance autonomous chose (BLUE if no autonomous ran in the last few minutes).
    • robotTelemetry

      protected RobotTelemetry robotTelemetry()
      The Driver Station screen helper (warnings, standard and debug lines).
    • driving

      protected DriverControls driving()
      The driving (field-centric on/off, slow mode).
    • heading

      protected DriverHeading heading()
      The heading compared with the driver, or null if there is no IMU.
    • matchTimer

      protected MatchTimer matchTimer()
      The 2:00 match timer (started at START).
    • isTuningMenuOpen

      protected boolean isTuningMenuOpen()
      True while the tuning menu is open. Gamepad 1 belongs to the menu then: do not read its sticks.
    • runOpMode

      public final void runOpMode()
      The whole TeleOp. The FTC SDK calls this when you press INIT. final: your class cannot replace it, so the safety steps here always run.
      Specified by:
      runOpMode in class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
    • requestOpModeStop

      public final void requestOpModeStop()