[copybara] Resync robotpy (#8585)

Project import generated by Copybara.
    
GitOrigin-RevId: fd000778e9b78c72cc7ca7b2ebe476129b78c6e0
This commit is contained in:
PJ Reiniger
2026-02-08 10:36:35 -05:00
committed by GitHub
parent 4aa21e947d
commit 227c89ab23
53 changed files with 1049 additions and 170 deletions

View File

@@ -2,3 +2,5 @@ from . import _init__simulation
from ._simulation import *
del _init__simulation
from .mockhooks import waitForProgramStart

View File

@@ -0,0 +1,24 @@
import time
import typing as T
from ._simulation import getProgramStarted
def waitForProgramStart(timeout: T.Optional[float] = None, delta: float = 0.001):
"""
Polls robot program and returns when it has reported that it started
:param timeout: Amount of time to wait
:param delta: Amount of time to sleep between checks
"""
# This is basically the same thing that the C version of this function
# does. Implemented in python so that CTRL-C works.
until = None
if timeout and timeout > 0:
until = time.monotonic() + timeout
while not getProgramStarted():
if until is not None and time.monotonic() > until:
raise TimeoutError("Program did not start")
time.sleep(delta)

View File

@@ -1,7 +1,7 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"semiwrap~=0.2.1",
"semiwrap~=0.2.6",
"hatch-meson~=0.1.0",
"hatchling",
"pyntcore==0.0.0",

View File

@@ -8,6 +8,7 @@ strip_prefixes:
functions:
HALSIM_SetRuntimeType:
HALSIM_WaitForProgramStart:
ignore: true
HALSIM_SetProgramStarted:
HALSIM_GetProgramStarted:
HALSIM_SetProgramState: