EasyStack Docs

EasyOpMode

Esta página aún no está traducida. Se muestra la versión en inglés.

EasyOpMode is a base class for your OpModes. It extends the SDK LinearOpMode and gives you a clear lifecycle, so you write only the parts that belong to your robot. You implement initialize() and onUpdate(); runOpMode() is final and runs the lifecycle for you.

#Lifecycle

Every EasyOpMode runs the same steps, in this order:

  • 1. Reset: the command scheduler is reset.
  • 2. initialize(): create your hardware here and register components with addComponents(...).
  • 3. Components init: every registered component receives init(hardwareMap).
  • 4. waitForStart(): the OpMode waits for Play. If stop is requested here, the OpMode ends.
  • 5. Start: components receive start(), then onStart() runs once.
  • 6. Loop: each cycle runs EasyDash.tick(), the components loop(), onUpdate() and telemetry.update().
  • 7. Stop: components receive stop() in reverse order, then onStop() runs and the scheduler is reset.

#What You Write

  • abstract void initialize(): build the hardware, create subsystems and add components.
  • void onStart(): optional. Runs once after Play.
  • abstract void onUpdate(): your loop body.
  • void onStop(): optional. Stop mechanisms here.
  • protected scheduler: the shared EasyCommandScheduler instance.
  • addComponents(EasyComponent...): registers components. Duplicates and nulls are ignored.

#What EasyOpMode Does Not Do

EasyOpMode does not run the command scheduler by itself. It only runs the loop() of the components you added. If you use commands, triggers or default commands, add an EasyCommandComponent.

EasyOpMode also does not call EasyGamepad.update(). Call it at the start of onUpdate().

telemetry.update() is called for you at the end of every cycle, so do not call it again in onUpdate().

#Example

Java
@TeleOp(name = "Shooter")
public class ShooterTeleOp extends EasyOpMode {

    private final Shooter shooter = new Shooter();
    private EasyGamepad driver;

    @Override
    public void initialize() {
        driver = new EasyGamepad(gamepad1);
        addComponents(
                new EasySubsystemComponent(shooter),
                new EasyCommandComponent());

        driver.aButton().onPress(shooter.runOnce(shooter::toggle));
    }

    @Override
    public void onUpdate() {
        driver.update();
        telemetry.addData("RPM", shooter.getRpm());
    }

    @Override
    public void onStop() {
        shooter.stop();
    }
}

The dashboard loop time is measured automatically because EasyOpMode calls EasyDash.tick() on every cycle.

Última actualización 2026-11-16

EasyStack - FTC Java library

This site records page views of visitors to understand how the documentation is used. Nothing is sold or shared with third parties.