commands2.cmd functions
- commands2.cmd.deadline(deadline: Command, *commands: Command) Command[source]
Runs a group of commands at the same time. Ends once a specific command finishes, and cancels the others.
- Parameters:
deadline – the deadline command
commands – the commands to include
- Returns:
the command group
- commands2.cmd.either(on_true: Command, on_false: Command, selector: Callable[[], bool]) Command[source]
Runs one of two commands, based on the boolean selector function.
- Parameters:
on_true – the command to run if the selector function returns true
on_false – the command to run if the selector function returns false
selector – the selector function
- Returns:
the command
- commands2.cmd.none() Command[source]
Constructs a command that does nothing, finishing immediately.
- Returns:
the command
- commands2.cmd.parallel(*commands: Command) Command[source]
Runs a group of commands at the same time. Ends once all commands in the group finish.
- Parameters:
commands – the commands to include
- Returns:
the command
- commands2.cmd.print_(message: str) Command[source]
Constructs a command that prints a message and finishes.
- Parameters:
message – the message to print
- Returns:
the command
- commands2.cmd.race(*commands: Command) Command[source]
Runs a group of commands at the same time. Ends once any command in the group finishes, and cancels the others.
- Parameters:
commands – the commands to include
- Returns:
the command group
- commands2.cmd.repeating_sequence(*commands: Command) Command[source]
Runs a group of commands in series, one after the other. Once the last command ends, the group is restarted.
- Parameters:
commands – the commands to include
- Returns:
the command group
- commands2.cmd.run(action: Callable[[], Any], *requirements: Subsystem) Command[source]
Constructs a command that runs an action every iteration until interrupted.
- Parameters:
action – the action to run
requirements – subsystems the action requires
- Returns:
the command
- commands2.cmd.run_end(run: Callable[[], Any], end: Callable[[], Any], *requirements: Subsystem) Command[source]
Constructs a command that runs an action every iteration until interrupted, and then runs a second action.
- Parameters:
run – the action to run every iteration
end – the action to run on interrupt
requirements – subsystems the action requires
- Returns:
the command
- commands2.cmd.run_once(action: Callable[[], Any], *requirements: Subsystem) Command[source]
Constructs a command that runs an action once and finishes.
- Parameters:
action – the action to run
requirements – subsystems the action requires
- Returns:
the command
- commands2.cmd.select(commands: Dict[Hashable, Command], selector: Callable[[], Hashable]) Command[source]
Runs one of several commands, based on the selector function.
- Parameters:
selector – the selector function
commands – map of commands to select from
- Returns:
the command
- commands2.cmd.sequence(*commands: Command) Command[source]
Runs a group of commands in series, one after the other.
- Parameters:
commands – the commands to include
- Returns:
the command group
- commands2.cmd.start_end(run: Callable[[], Any], end: Callable[[], Any], *requirements: Subsystem) Command[source]
Constructs a command that runs an action once and another action when the command is interrupted.
- Parameters:
start – the action to run on start
end – the action to run on interrupt
requirements – subsystems the action requires
- Returns:
the command
- commands2.cmd.start_run(start: Callable[[], Any], run: Callable[[], Any], *requirements: Subsystem) Command[source]
Constructs a command that runs an action once and another action every iteration until interrupted.
- Parameters:
start – the action to run on start
run – the action to run every iteration
requirements – subsystems the action requires
- Returns:
the command