[robotpy] Mirror robotpy's commands-v2 (#8369)

Project import generated by Copybara.

GitOrigin-RevId: 715c8e8372d936f447f2937aab6b1a22dc619126
This commit is contained in:
PJ Reiniger
2025-11-14 00:55:54 -05:00
committed by GitHub
parent 6e6f8dd7cc
commit 1a99a348cb
84 changed files with 8974 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# validated: 2024-01-19 DS aaea85ff1656 ScheduleCommand.java
from __future__ import annotations
from .command import Command
class ScheduleCommand(Command):
"""
Schedules the given commands when this command is initialized. Useful for forking off from
CommandGroups. Note that if run from a composition, the composition will not know about the
status of the scheduled commands, and will treat this command as finishing instantly.
"""
def __init__(self, *commands: Command):
"""
Creates a new ScheduleCommand that schedules the given commands when initialized.
:param toSchedule: the commands to schedule
"""
super().__init__()
self._toSchedule = set(commands)
def initialize(self):
for command in self._toSchedule:
command.schedule()
def isFinished(self) -> bool:
return True
def runsWhenDisabled(self) -> bool:
return True