class wpilib.command.ConditionalCommand(name, onTrue=None, onFalse=None)[source]

Bases: wpilib.command.Command

A ConditionalCommand is a Command that starts one of two commands.

A ConditionalCommand uses m_condition to determine whether it should run m_onTrue or m_onFalse.

A ConditionalCommand adds the proper Command to the Scheduler during initialize() and then isFinished() will return true once that Command has finished executing.

If no Command is specified for m_onFalse, the occurrence of that condition will be a no-op.

@see Command @see Scheduler

Creates a new ConditionalCommand with given name and onTrue and onFalse Commands.

Users of this constructor should also override condition().

  • name – the name for this command group
  • onTrue – The Command to execute if {@link ConditionalCommand#condition()} returns true
  • onFalse – The Command to execute if {@link ConditionalCommand#condition()} returns false

The Condition to test to determine which Command to run.

Returns:true if m_onTrue should be run or false if m_onFalse should be run.