StartEndCommand

class commands2.StartEndCommand(*args, **kwargs)[source]

Bases: FunctionalCommand

A command that runs a given Callable when it is initialized, and another Callable when it ends. Useful for running and then stopping a motor, or extending and then retracting a solenoid. Has no end condition as-is; either subclass it or use commands2.Command.with_timeout() or commands2.Command.until() to give it one.

Creates a new StartEndCommand. Will run the given Callables when the command starts and when it ends.

Parameters:
  • on_init – the Callable to run on command init

  • on_end – the Callable to run on command end

  • requirements – the subsystems required by this command