While I would be interested in a ToggleButton type that provides this functionality we found the following much easier.
Example of how our shooter works.
We use the following pattern for structuring our subsystems.
Code:
void raiseShooter();
void lowerShooter();
bool isRaised();
Then we have 3 commands.
RaiseShooterCommand:
Code:
void Execute() {
shooter->raiseShooter();
}
LowerShooterCommand:
Code:
void Execute() {
shooter->lowerShooter();
}
ToggleShooterCommand:
Code:
void Execute() {
if (shooter->isRaised())
shooter->lowerShooter();
else
shooter->raiseShooter();
}
The controls use the ToggleShooterCommand. Any command groups for sequences or auton use the explicit RaiseShooterCommand and LowerShooterCommand.