intent Command
fun intentCommand(name: String, vararg requirements: Subsystem, canExecute: () -> Boolean = { true }, onStart: () -> Unit, isComplete: () -> Boolean, onFinish: (Boolean) -> Unit = {}): IntentCommand
DSL-style builder for simple intent commands without creating a class.
Use this for simple, one-off intents that don't need a dedicated class.
Example:
val stowIntent = intentCommand(
"Stow",
Elevator, Arm,
onStart = {
Elevator.state = ElevatorState.DEFAULT
Arm.state = ArmState.STOW
},
isComplete = { Elevator.isAtTarget() && Arm.isAtTarget() }
)
button.onTrue(stowIntent)Content copied to clipboard
Return
An IntentCommand instance
Parameters
name
Human-readable name for the intent
requirements
Subsystems required by this intent
can Execute
Lambda to check prerequisites (default: always true)
on Start
Lambda to configure states when intent starts
is Complete
Lambda to check if intent goal is achieved
on Finish
Lambda for cleanup (default: no-op)