Lesson 2.?: Binding Commands to Triggers

Accompanying code lesson: TODO

There are 6 methods that each schedule/cancel a command depending on how the state changes: onFalse(), onTrue(), toggleOnFalse(), toggleOnTrue(), whileFalse(), and whileTrue() . Each methods' behaviors are shown in the diagram below:

How each binding method behave based on when the boolean state flips true or flips false. Based on a diagram by BoVLB.

The syntax for binding a Command to a Trigger is as follows:

trigger.whileTrue(subsystem.command())

For binding to a controller button, the syntax is as follows:

controller.a().whileTrue(subsystem.command())

Code examples:

Last updated

Was this helpful?