sr-robot3 2024.0.1__py3-none-any.whl → 2025.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sr/robot3/utils.py CHANGED
@@ -2,6 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import logging
5
+ import os
5
6
  import signal
6
7
  import socket
7
8
  from abc import ABC, abstractmethod
@@ -14,6 +15,8 @@ from serial.tools.list_ports_common import ListPortInfo
14
15
  T = TypeVar('T')
15
16
  logger = logging.getLogger(__name__)
16
17
 
18
+ IN_SIMULATOR = os.environ.get('WEBOTS_SIMULATOR', '') == '1'
19
+
17
20
 
18
21
  class BoardIdentity(NamedTuple):
19
22
  """
@@ -34,6 +37,13 @@ class BoardIdentity(NamedTuple):
34
37
  sw_version: str = ""
35
38
 
36
39
 
40
+ class BoardInfo(NamedTuple):
41
+ """A container for the information about a board connection."""
42
+ url: str
43
+ serial_number: str
44
+ type_str: str
45
+
46
+
37
47
  class Board(ABC):
38
48
  """
39
49
  This is the base class for all boards.
@@ -228,6 +238,36 @@ def ensure_atexit_on_term() -> None:
228
238
  signal.signal(signal.SIGTERM, handle_signal)
229
239
 
230
240
 
241
+ def get_simulator_boards(board_filter: str = '') -> list[BoardInfo]:
242
+ """
243
+ Get a list of all boards configured in the simulator.
244
+
245
+ This is used to support discovery of boards in the simulator environment.
246
+
247
+ :param board_filter: A filter to only return boards of a certain type
248
+ :return: A list of board connection information
249
+ """
250
+ if 'WEBOTS_ROBOT' not in os.environ:
251
+ return []
252
+
253
+ simulator_data = os.environ['WEBOTS_ROBOT'].splitlines()
254
+ simulator_boards = []
255
+
256
+ for board_data in simulator_data:
257
+ board_data = board_data.rstrip('/')
258
+ board_fragment, serial_number = board_data.rsplit('/', 1)
259
+ board_url, board_type = board_fragment.rsplit('/', 1)
260
+
261
+ board_info = BoardInfo(url=board_url, serial_number=serial_number, type_str=board_type)
262
+
263
+ if board_filter and board_info.type_str != board_filter:
264
+ continue
265
+
266
+ simulator_boards.append(board_info)
267
+
268
+ return simulator_boards
269
+
270
+
231
271
  def list_ports() -> None:
232
272
  """
233
273
  Print a list of all connected USB serial ports.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sr-robot3
3
- Version: 2024.0.1
3
+ Version: 2025.0.0
4
4
  Summary: Student Robotics API for Python 3
5
5
  Author-email: Student Robotics <kit-team@studentrobotics.org>
6
6
  License: MIT License
@@ -37,22 +37,24 @@ Classifier: Topic :: Education
37
37
  Requires-Python: >=3.8
38
38
  Description-Content-Type: text/markdown
39
39
  License-File: LICENSE
40
- Requires-Dist: pyserial <4,>=3
41
- Requires-Dist: april-vision <3,>=2.1
42
- Requires-Dist: paho-mqtt <2,>=1.6
43
- Requires-Dist: pydantic <2,>=1.9.1
44
- Requires-Dist: typing-extensions ; python_version < "3.10"
40
+ Requires-Dist: pyserial<4,>=3
41
+ Requires-Dist: april-vision==2.2.0
42
+ Requires-Dist: paho-mqtt<3,>=2
43
+ Requires-Dist: pydantic<2,>=1.9.1
44
+ Requires-Dist: typing-extensions; python_version < "3.10"
45
+ Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
45
46
  Provides-Extra: dev
46
- Requires-Dist: flake8 ; extra == 'dev'
47
- Requires-Dist: isort ; extra == 'dev'
48
- Requires-Dist: mypy ; extra == 'dev'
49
- Requires-Dist: build ; extra == 'dev'
50
- Requires-Dist: types-pyserial ; extra == 'dev'
51
- Requires-Dist: pytest ; extra == 'dev'
52
- Requires-Dist: pytest-cov ; extra == 'dev'
53
- Requires-Dist: types-paho-mqtt ; extra == 'dev'
47
+ Requires-Dist: flake8; extra == "dev"
48
+ Requires-Dist: isort; extra == "dev"
49
+ Requires-Dist: build; extra == "dev"
50
+ Requires-Dist: types-pyserial; extra == "dev"
51
+ Requires-Dist: pytest; extra == "dev"
52
+ Requires-Dist: pytest-cov; extra == "dev"
53
+ Requires-Dist: paho-mqtt<3,>=2; extra == "dev"
54
+ Requires-Dist: mypy==1.10.0; python_version < "3.9" and extra == "dev"
55
+ Requires-Dist: mypy<2,>=1.7; python_version >= "3.9" and extra == "dev"
54
56
  Provides-Extra: vision
55
- Requires-Dist: opencv-python-headless <5,>=4 ; extra == 'vision'
57
+ Requires-Dist: opencv-python-headless<5,>=4; extra == "vision"
56
58
 
57
59
  # sr-robot3
58
60
 
@@ -0,0 +1,29 @@
1
+ sr/robot3/__init__.py,sha256=lW7j65ruMEkRNJjZzp8929TefPMaMhqXzpsGPJqMkRs,1476
2
+ sr/robot3/_version.py,sha256=-X88o2Nur4PzeUeRdAC4dP3gTVlb9JWw08awOdH4TYg,417
3
+ sr/robot3/arduino.py,sha256=9rGsvGDb1JoHB4c7W61R16Y3eb0-UZ9TE49Qu7BJIZE,16934
4
+ sr/robot3/astoria.py,sha256=0EIXoxvs1glkGuzLDYG7HptKucc8q7sdWAQiu96NG24,8547
5
+ sr/robot3/camera.py,sha256=b2r8-ttQgLqbMv9BI6qWb5sHjeg4Zb5VrGo2uWMYGd8,8686
6
+ sr/robot3/exceptions.py,sha256=A8cpuvFaIFazWSrp9QNts9ikINWymgoGALv4JAL-SU8,1381
7
+ sr/robot3/game_specific.py,sha256=X8vLUbTRdNPZEggC6LxZzaNb9oqMly8-3PyQoD3B1ho,282
8
+ sr/robot3/kch.py,sha256=CxMbRztCNz75Uikv3KaViV6zYlXsJuBbI6qg2AsQW4Q,12500
9
+ sr/robot3/logging.py,sha256=1KO1yW2RP9qSUHr-i1NOMM68szxML5qJyDKtdt34uyg,3464
10
+ sr/robot3/marker.py,sha256=6LzT59xjEFroljcDsejfcUeU-5dlDAEWbPepp-25fOY,5403
11
+ sr/robot3/motor_board.py,sha256=6yYhz0WSLzPvAzREIYUmCLeCtc6Qwkm7hdTOPFgRZ70,11356
12
+ sr/robot3/mqtt.py,sha256=1xKQ0uwkupURWFXrvsD75TE-GlltfbrpVNqoabgmsrc,6679
13
+ sr/robot3/power_board.py,sha256=3Skbc7kmG1pr2K6n94POkMOXT4jzbOiYCz2cb60CWv8,17734
14
+ sr/robot3/py.typed,sha256=dXL7b_5DnfZ_09rOcxu7D-0rT56DRm26uGUohPJOPQc,94
15
+ sr/robot3/raw_serial.py,sha256=rdh0lyS9tJDyHbAZKyJSO8lKvdJ3-_iZzvmUSOdbo08,7368
16
+ sr/robot3/robot.py,sha256=cqUrPFver_yAjdTPBLqPjsoliSuNdiHn7RGrpXLsuMA,15888
17
+ sr/robot3/serial_wrapper.py,sha256=CDRVFbIILf4ahiToIHrVf02hz_GXpFeazDHdw3rGgX0,9327
18
+ sr/robot3/servo_board.py,sha256=1GppUoqdx9wUA551bO95dEbtCGdzS10twv8OZ3S6t8U,12505
19
+ sr/robot3/timeout.py,sha256=qBPCOwnOW9h0fLnL-peraO9RsaKWc92TcTYNgyTzo_g,2678
20
+ sr/robot3/utils.py,sha256=dA2WyB73hnw41jLkOpk6ail7mfrW3oxKU0KrpQuHv1Y,9146
21
+ sr/robot3/calibrations/__init__.py,sha256=TTL-lkU5tj3EszSEInRTftNvX5rsMyRUSHf12RlJ4QY,130
22
+ sr/robot3/simulator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ sr/robot3/simulator/camera.py,sha256=thenTnlyHzHrosUg9juUSfYCs2U4dfkS7vFoto1b3_k,3138
24
+ sr/robot3/simulator/time_server.py,sha256=MwFJM7p3vqf4balmGwIMXcCLBVJQgnq2X4gY_agalwc,2859
25
+ sr_robot3-2025.0.0.dist-info/LICENSE,sha256=d9EjkBp2jG1JOJ3zKfKRwBtPe1nhh1VByrw4iH3A9WA,1101
26
+ sr_robot3-2025.0.0.dist-info/METADATA,sha256=iQFR8uEwpNe7S497QqT56Pash4wDEbw2Ud0V7K6ZjJY,5322
27
+ sr_robot3-2025.0.0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
28
+ sr_robot3-2025.0.0.dist-info/top_level.txt,sha256=XFzWuC7umCVdV-O6IuC9Rl0qehvEC-U34M9WJ2-2h3E,3
29
+ sr_robot3-2025.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,26 +0,0 @@
1
- sr/robot3/__init__.py,sha256=lW7j65ruMEkRNJjZzp8929TefPMaMhqXzpsGPJqMkRs,1476
2
- sr/robot3/_version.py,sha256=97B6f2hqYAk0gPcgMK-iH6WlH9zRXwoLvU-uET4OYWg,166
3
- sr/robot3/arduino.py,sha256=gFiDxGNJV0T0JPMfBzYv_CSbmfGR3ReEWKB4WYHbp4Y,14403
4
- sr/robot3/astoria.py,sha256=dyrK_vMFHl9F-E9sXgDGNbuW3SLcTCQzNgu_-d7uB0Q,8435
5
- sr/robot3/camera.py,sha256=UKvJFLGVptZLquNpGne34AaEnqw07CpH8C-gaxPdUrQ,6621
6
- sr/robot3/exceptions.py,sha256=A8cpuvFaIFazWSrp9QNts9ikINWymgoGALv4JAL-SU8,1381
7
- sr/robot3/game_specific.py,sha256=X8vLUbTRdNPZEggC6LxZzaNb9oqMly8-3PyQoD3B1ho,282
8
- sr/robot3/kch.py,sha256=uPdzxdbFxCS0F7UdkUsIuh7xXyKs8Jw4QpHBeVw_k-U,5413
9
- sr/robot3/logging.py,sha256=1KO1yW2RP9qSUHr-i1NOMM68szxML5qJyDKtdt34uyg,3464
10
- sr/robot3/marker.py,sha256=6LzT59xjEFroljcDsejfcUeU-5dlDAEWbPepp-25fOY,5403
11
- sr/robot3/motor_board.py,sha256=qfwbchUdfdZoSfeTwNuG24GR2cCmo_5vdFSkQtPIQxk,10109
12
- sr/robot3/mqtt.py,sha256=6JQdPlx1LpVE1g_n2hbQ2vAOUKwWrtNcZlH-F_q-0Lc,6300
13
- sr/robot3/power_board.py,sha256=hcz6rLxcJNPKpaIaPUOj0ddUYjJc6__JuCzndY7v1Fo,16275
14
- sr/robot3/py.typed,sha256=dXL7b_5DnfZ_09rOcxu7D-0rT56DRm26uGUohPJOPQc,94
15
- sr/robot3/raw_serial.py,sha256=rdh0lyS9tJDyHbAZKyJSO8lKvdJ3-_iZzvmUSOdbo08,7368
16
- sr/robot3/robot.py,sha256=K9574dDSau8F33xl4zD9PdUVDY2iHYV_hbYYck9Z6Zc,13417
17
- sr/robot3/serial_wrapper.py,sha256=CisWk4NhP9CWw9mKJvSTC3XJ0kJLSYM1e4smt2iuuMc,9055
18
- sr/robot3/servo_board.py,sha256=EUTxCXq79wGWK2CAmc3nzviGBeJpNq1F_wz-CX2FKmY,11234
19
- sr/robot3/timeout.py,sha256=7-DaLgS95Fvw8nndBxxVibzrZJIWficxJBE0oD8Pa2Y,1843
20
- sr/robot3/utils.py,sha256=SZqTmVOSY8MUdj7cQeUkLTLzxoBbOEJMocZy4C4ZmNQ,7954
21
- sr/robot3/calibrations/__init__.py,sha256=TTL-lkU5tj3EszSEInRTftNvX5rsMyRUSHf12RlJ4QY,130
22
- sr_robot3-2024.0.1.dist-info/LICENSE,sha256=d9EjkBp2jG1JOJ3zKfKRwBtPe1nhh1VByrw4iH3A9WA,1101
23
- sr_robot3-2024.0.1.dist-info/METADATA,sha256=iNwskOb8Xh-X3MZAbhzeIxhEi8RjfKrv0Z6s671xvIM,5177
24
- sr_robot3-2024.0.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
25
- sr_robot3-2024.0.1.dist-info/top_level.txt,sha256=XFzWuC7umCVdV-O6IuC9Rl0qehvEC-U34M9WJ2-2h3E,3
26
- sr_robot3-2024.0.1.dist-info/RECORD,,