EasySubsystemBase
#EasySubsystemBase
EasySubsystemBase implements EasySubsystem, registers the subsystem with the dashboard and adds command factories that work with EasyCommandScheduler. It is abstract, so you still write init() yourself.#Registration
The constructor registers the new subsystem with the dashboard (EasyDash.subsystem), so it shows up in the Devices tab with its current command and state:
Intake intake = new Intake();No other call is needed. Create each subsystem once and share that instance, because every instance that is created registers itself again.
#Default and Current Command
intake.setDefaultCommand(intake.run(() -> intake.setPower(0.0)));
EasyCommand active = intake.getCurrentCommand();| Method | Description |
|---|---|
setDefaultCommand(command) | Sets the default command of this subsystem in the scheduler. A default command is the one that runs when no other command is using the subsystem. |
getCurrentCommand() | Returns the command that the scheduler reports for this subsystem. |
#Command Factories
The base class creates commands that already require this subsystem, so you do not need to pass this yourself:
| Method | Creates | Behavior |
|---|---|---|
run(action) | RunCommand | Runs the action on every loop while the command is scheduled. It does not finish on its own. |
runOnce(action) | InstantCommand | Runs the action once and finishes. |
startEnd(start, end) | StartEndCommand | Runs start when the command begins and end when it ends or is interrupted. It does not finish on its own. |
runEnd(action, end) | RunCommand with finallyDo | Runs the action on every loop, and runs end when the command ends or is interrupted. |
A command that does not finish on its own is ended by a decorator such as until() or withTimeout(), by a command group, or by another command taking over the subsystem.
EasyCommand collect = intake.startEnd(
() -> intake.setPower(1.0),
() -> intake.setPower(0.0));
EasyCommand pulse = intake.runOnce(() -> intake.setPower(0.5))
.andThen(new WaitCommand(300))
.andThen(intake.runOnce(() -> intake.setPower(0.0)));runEnd() is run() with a cleanup action. The inner command is wrapped with finallyDo, which runs end after the inner command ends and ignores whether it was interrupted.
Última actualización 2026-11-16