Not just commands. Reusable pieces of code with
nesting,
virtual multi-threading and
looptime budgeting support.
SequentialCommandGroup collectAndLoad
=sequentially(
Spindexer.INSTANCE.reset,
wait(500),
racing(
Intake.INSTANCE.absorb,
waitUntil(() ->Intake.INSTANCE.isFull())
),
Spindexer.INSTANCE.loadToOuttake
);
SequentialCommandGroup shootAndReload
=sequentially(
Outtake.INSTANCE.shoot,
Spindexer.INSTANCE.loadToOuttake
);
Autonomous made easy
Write your autonomous routines as commands, and run them with
just a single line of code.
packageorg.firstinspires.ftc.teamcode;
import...
publicclass RedAuto extends CoreAuto {
public MyOpMode() {
super(
// Step 1: Register auto modules
modulesArrayOf(
Intake.INSTANCE,
Chassis.INSTANCE,
Spindexer.INSTANCE,
Outtake.INSTANCE
),
// Step 2: Pass a command to run at init
initCommand,
// Step 3: And another to run when played
redAutoCommand,
);
}
// Done! You have your auto!
}
Use everywhere
You can start using CoreControl in your OpModes by extending CoreTeleOp, in which you can register
modules and commands.
MyOpMode.java
packageorg.firstinspires.ftc.teamcode;
import...
publicclass MyOpMode extends CoreTeleOp {
public MyOpMode() {
super(
// Register your own modules!
Intake.INSTANCE,
Chassis.INSTANCE,
Spindexer.INSTANCE,
Outtake.INSTANCE,
true// display automatic telemetry
// about them!
);
}
// Smart buttons!
Button collect
=newButton( () ->gamepad1.square);
Button shoot
=newButton( () ->gamepad1.circle);
// Modules are already initialized automatically!
@OverridepublicvoidonInit() {
Outtake.INSTANCE.goToHome.register();
}
// Modules' loop logic is run automatically!
@OverridepublicvoidonMainLoop() {
if (collect.wasPressed()&&shoot.isNotHeld())
collectAndLoad.register();
if (shoot.wasPressed())
if (shoot.wasDoublePressed())
shootAndReload.repeat(3).register();
else
shootAndReload.register();
}
}
Unit-testing trivialized
Write unit tests for your modules with minimal boilerplate. Bind commands to buttons, and get a
fully functional test OpMode in 30 seconds and 10 or so lines of code.
packageorg.firstinspires.ftc.teamcode;
import...
publicclass IntakeTest extends TestOpMode {
public MyOpMode() {
super(Intake.INSTANCE);
// Just one module to get unit-tested!
}
ActionButton testAbsorb
=newActionButton(
() ->gamepad1.cross,
Intake.INSTANCE.absorb,
ButtonState.WHEN_PRESSED
);
ActionButton testEject
=newActionButton(
() ->gamepad1.circle,
Intake.INSTANCE.eject,
ButtonState.WHEN_PRESSED
);
// Those buttons automatically register
// commands when pressed!
}
From zero to working in less than an hour.
Skip the boilerplate. With CoreControl, you can
code a fully functional robot from scratch in record time.