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.withTimeout() 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:
  • onInit – the Callable to run on command init

  • onEnd – the Callable to run on command end

  • requirements – the subsystems required by this command