Components
A component is a small object with four optional hooks. Components keep the OpMode short and let you reuse behavior between OpModes. EasyOpMode calls their hooks at the right moment of the lifecycle.
#EasyComponent
The interface has four default methods. Override only the ones you need:
public interface EasyComponent {
default void init(HardwareMap hardwareMap) {}
default void start() {}
default void loop() {}
default void stop() {}
}init(hardwareMap): called once afterinitialize(), beforewaitForStart().start(): called once after Play.loop(): called every cycle beforeonUpdate().stop(): called when theOpModeends, in reverse order of registration.
#EasyCommandComponent
Runs the command scheduler. It calls scheduler.run() every loop and scheduler.cancelAll() on stop. A second constructor takes a custom EasyCommandScheduler.
Without it, commands, triggers and default commands never run.
#EasySubsystemComponent
Takes any number of subsystems. It calls init(hardwareMap) on each one, then loop() every cycle. The subsystems are also registered with the dashboard.
addComponents(
new EasySubsystemComponent(shooter, intake),
new EasyCommandComponent());#Order Matters
Components run in the order they were added. Put the subsystem component before the command component when your subsystems must update before commands run.
#Writing Your Own Component
public class BatteryWarning implements EasyComponent {
private VoltageSensor sensor;
@Override
public void init(HardwareMap hardwareMap) {
sensor = hardwareMap.voltageSensor.iterator().next();
}
@Override
public void loop() {
if (sensor.getVoltage() < 11.5) {
EasyDash.warn("Low battery");
}
}
}Last updated 2026-11-16