-
Notifications
You must be signed in to change notification settings - Fork 3
Command Groups
Command Groups have been much improved from the WPILib version. In Kotlin, Command Groups can be used like so:
val AutonomousAction = DriveForwards() and LiftArm() then OpenClaw()
AutonomousAction.start()
This AutonomousAction
Command Group will run the DriveForwards
command in parallel with the LiftArm
command, then run OpenClaw
after the previous two have completed.
Command Groups differ in a minor but important way from WPILib Command Groups. In WPILib, the addParallel
command will start a command that runs in parallel with future commands. This isn't the expected result when writing Command Groups the Sertain way. In Sertain, parallel (or commands on either side of the and
operator) commands will be run with the ones that come before it, and ensure that those complete before continuing past the next then
statement. This can be thought about as converting the last parallel command in the sequence to a sequential command.