scirodev 0.5.2__tar.gz → 0.5.4__tar.gz
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.
- {scirodev-0.5.2/scirodev.egg-info → scirodev-0.5.4}/PKG-INFO +2 -2
- {scirodev-0.5.2 → scirodev-0.5.4}/pyproject.toml +2 -2
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/hubs.py +51 -3
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/robotics.py +15 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/tools.py +50 -1
- {scirodev-0.5.2 → scirodev-0.5.4/scirodev.egg-info}/PKG-INFO +2 -2
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev.egg-info/requires.txt +1 -1
- {scirodev-0.5.2 → scirodev-0.5.4}/LICENSE +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/README.md +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/__init__.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/_common.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/floorpro.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/iodevices.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/parameters.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/pump.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/sciro/py.typed +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev/__init__.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev/cli.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev.egg-info/SOURCES.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev.egg-info/dependency_links.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev.egg-info/entry_points.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/scirodev.egg-info/top_level.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scirodev
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev
|
|
5
5
|
Author: Thomas Schank
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.10
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: pybricksdev>=2.3
|
|
18
|
-
Requires-Dist: pybricks>=
|
|
18
|
+
Requires-Dist: pybricks>=4
|
|
19
19
|
Provides-Extra: docs
|
|
20
20
|
Requires-Dist: sphinx>=8; extra == "docs"
|
|
21
21
|
Requires-Dist: furo; extra == "docs"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scirodev"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.4"
|
|
8
8
|
description = "PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -21,7 +21,7 @@ dependencies = [
|
|
|
21
21
|
# Tooling: connecting to hubs (incl. PeakHub over BLE), running/downloading programs.
|
|
22
22
|
"pybricksdev>=2.3",
|
|
23
23
|
# The upstream API stubs we build on (pybricks.parameters, pybricks._common, ...).
|
|
24
|
-
"pybricks>=
|
|
24
|
+
"pybricks>=4",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
@@ -45,6 +45,15 @@ class LightMatrix(_common.LightMatrix):
|
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def on(self, brightness: int = 100) -> None:
|
|
49
|
+
"""on(brightness=100)
|
|
50
|
+
|
|
51
|
+
Turns all pixels on at ``brightness`` percent (0 .. 100), stopping a
|
|
52
|
+
running :meth:`device` mirror or animation. Declared here because the
|
|
53
|
+
firmware has it while the published ``pybricks`` stubs do not.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
|
|
48
57
|
class System(_common.System):
|
|
49
58
|
"""The PeakHub's system object: everything ``pybricks`` offers, plus the
|
|
50
59
|
board identity.
|
|
@@ -72,20 +81,59 @@ class System(_common.System):
|
|
|
72
81
|
"program_start_type"}`` in one call.
|
|
73
82
|
"""
|
|
74
83
|
|
|
84
|
+
def name(self) -> str:
|
|
85
|
+
"""name() -> str
|
|
86
|
+
|
|
87
|
+
The hub name, as advertised over Bluetooth.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
def reset_reason(self) -> int:
|
|
91
|
+
"""reset_reason() -> int
|
|
92
|
+
|
|
93
|
+
Why the hub last reset: ``0`` power-on or unknown, ``1`` software
|
|
94
|
+
reset, ``2`` watchdog.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
def low_power(self) -> None:
|
|
98
|
+
"""low_power()
|
|
99
|
+
|
|
100
|
+
Ends the program and drops the hub into its wakeable low-power mode
|
|
101
|
+
(device supply off, motors coasting, panel dimmed) instead of powering
|
|
102
|
+
off; a short button press wakes it back to the idle menu. PeakHub only.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class Battery(_common.Battery):
|
|
107
|
+
"""The PeakHub's battery, with the two readings the published ``pybricks``
|
|
108
|
+
stubs lack."""
|
|
109
|
+
|
|
110
|
+
def type(self) -> str:
|
|
111
|
+
"""type() -> str
|
|
112
|
+
|
|
113
|
+
The battery chemistry the hub was built for: ``"Li-ion"``,
|
|
114
|
+
``"Alkaline"`` or ``"Unknown"``.
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
def temperature(self) -> int:
|
|
118
|
+
"""temperature() -> int
|
|
119
|
+
|
|
120
|
+
The battery pack temperature, in milli-degrees Celsius.
|
|
121
|
+
"""
|
|
122
|
+
|
|
75
123
|
|
|
76
124
|
class PeakHub:
|
|
77
125
|
"""LEGO-compatible hub by Sciurus Robotics: 8 ports, 5x5 RGB matrix, IMU."""
|
|
78
126
|
|
|
79
127
|
# Class attributes for documentation/typing only; the firmware creates
|
|
80
128
|
# them as instance attributes in __init__.
|
|
81
|
-
|
|
129
|
+
# No charger and no ble: the firmware's hub type exposes neither (the
|
|
130
|
+
# PeakHub's Bluetooth is a console/protocol transport, not a user API).
|
|
131
|
+
battery = Battery()
|
|
82
132
|
buttons = _common.Keypad([_Button.LEFT, _Button.RIGHT, _Button.CENTER, _Button.BLUETOOTH])
|
|
83
|
-
charger = _common.Charger()
|
|
84
133
|
display = LightMatrix(5, 5)
|
|
85
134
|
imu = _common.IMU()
|
|
86
135
|
speaker = _common.Speaker()
|
|
87
136
|
system = System()
|
|
88
|
-
ble = _common.BLE()
|
|
89
137
|
|
|
90
138
|
def __init__(
|
|
91
139
|
self,
|
|
@@ -73,6 +73,21 @@ class DriveBase(_DriveBase):
|
|
|
73
73
|
upstream meaning: continue at the drive speed.
|
|
74
74
|
"""
|
|
75
75
|
|
|
76
|
+
def curve(
|
|
77
|
+
self,
|
|
78
|
+
radius: Number,
|
|
79
|
+
angle: Number,
|
|
80
|
+
then: Stop = Stop.HOLD,
|
|
81
|
+
wait: bool = True,
|
|
82
|
+
) -> MaybeAwaitable:
|
|
83
|
+
"""curve(radius, angle, then=Stop.HOLD, wait=True)
|
|
84
|
+
|
|
85
|
+
Drives an arc of ``angle`` degrees along a circle of ``radius`` mm.
|
|
86
|
+
The firmware still has this method, but the ``pybricks`` stubs dropped
|
|
87
|
+
it in favor of :meth:`arc`, so it is declared here to keep it usable
|
|
88
|
+
without a type error. Prefer ``arc()`` in new code.
|
|
89
|
+
"""
|
|
90
|
+
|
|
76
91
|
def heading_target(self, angle: Optional[Number] = None) -> Optional[float]:
|
|
77
92
|
"""heading_target(angle) / heading_target() -> float
|
|
78
93
|
|
|
@@ -4,7 +4,56 @@ helpers. EXPERIMENTAL: the API may still change between releases.
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
from typing import
|
|
7
|
+
from typing import (
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Awaitable,
|
|
11
|
+
Callable,
|
|
12
|
+
Iterable,
|
|
13
|
+
Iterator,
|
|
14
|
+
Optional,
|
|
15
|
+
Sequence,
|
|
16
|
+
Tuple,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from pybricks._common import MaybeAwaitableTuple
|
|
21
|
+
else:
|
|
22
|
+
# Upstream defines this only for type checkers; runtime importers of the
|
|
23
|
+
# stubs (the docs build) need a value. Annotations are strings here
|
|
24
|
+
# (from __future__ import annotations), so a placeholder suffices.
|
|
25
|
+
MaybeAwaitableTuple = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def multitask(*coroutines: Awaitable[Any], race: bool = False) -> MaybeAwaitableTuple:
|
|
29
|
+
"""multitask(coroutine1, coroutine2, ..., race=False) -> Tuple
|
|
30
|
+
|
|
31
|
+
``pybricks.tools.multitask`` (the same function on the hub), typed to
|
|
32
|
+
accept any awaitable.
|
|
33
|
+
|
|
34
|
+
The upstream stub asks for ``Coroutine``, which every *maybe-awaitable*
|
|
35
|
+
hub method fails to satisfy for a type checker: ``motor.run_angle(...)``,
|
|
36
|
+
``db.straight(...)`` or ``sensor.read()`` are declared as awaitables, not
|
|
37
|
+
as coroutines, because they return a plain value when called outside
|
|
38
|
+
``run_task``. Importing ``multitask`` (and :func:`run_task`) from
|
|
39
|
+
``sciro.tools`` instead of ``pybricks.tools`` removes those warnings::
|
|
40
|
+
|
|
41
|
+
from sciro.tools import multitask, run_task
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
await multitask(db.straight(500), log.record(db.state), race=True)
|
|
45
|
+
|
|
46
|
+
run_task(main())
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def run_task(coroutine: Optional[Awaitable[Any]] = None) -> Optional[bool]:
|
|
51
|
+
"""run_task(coroutine) -> bool | None
|
|
52
|
+
|
|
53
|
+
``pybricks.tools.run_task`` (the same function on the hub), typed to
|
|
54
|
+
accept any awaitable; see :func:`multitask`. Without an argument it
|
|
55
|
+
returns whether the run loop is active.
|
|
56
|
+
"""
|
|
8
57
|
|
|
9
58
|
|
|
10
59
|
class RingBuffer:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scirodev
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev
|
|
5
5
|
Author: Thomas Schank
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.10
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: pybricksdev>=2.3
|
|
18
|
-
Requires-Dist: pybricks>=
|
|
18
|
+
Requires-Dist: pybricks>=4
|
|
19
19
|
Provides-Extra: docs
|
|
20
20
|
Requires-Dist: sphinx>=8; extra == "docs"
|
|
21
21
|
Requires-Dist: furo; extra == "docs"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|