scirodev 0.5.3__tar.gz → 0.5.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scirodev
3
- Version: 0.5.3
3
+ Version: 0.5.5
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>=3.6
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.3"
7
+ version = "0.5.5"
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>=3.6",
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
- battery = _common.Battery()
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,76 @@ class DriveBase(_DriveBase):
73
73
  upstream meaning: continue at the drive speed.
74
74
  """
75
75
 
76
+ def turn( # type: ignore[override]
77
+ self,
78
+ angle: Number,
79
+ then: Stop = Stop.HOLD,
80
+ wait: bool = True,
81
+ absolute: bool = False,
82
+ turn_rate: Optional[Number] = None,
83
+ ) -> MaybeAwaitable:
84
+ """turn(angle, then=Stop.HOLD, wait=True, absolute=False, turn_rate=None)
85
+
86
+ Turns in place, as in Pybricks, with one PeakHub extension:
87
+
88
+ ``turn_rate``: turn rate in deg/s for this move only; ``None`` uses the
89
+ ``turn_rate`` setting, which is left untouched either way.
90
+
91
+ ``absolute=True`` turns *to* the given heading rather than *by* it,
92
+ taking the nearest whole-turn equivalent, so the correction is always
93
+ within +/-180 degrees (the same rule as ``straight(heading=)``).
94
+ """
95
+
96
+ def curve(
97
+ self,
98
+ radius: Number,
99
+ angle: Number,
100
+ then: Stop = Stop.HOLD,
101
+ wait: bool = True,
102
+ speed: Optional[Number] = None,
103
+ exit_speed: Number = 0,
104
+ ) -> MaybeAwaitable:
105
+ """curve(radius, angle, then=Stop.HOLD, wait=True, speed=None, exit_speed=0)
106
+
107
+ Drives an arc of ``angle`` degrees along a circle of ``radius`` mm.
108
+ Upstream dropped this method in favour of :meth:`arc`, but the firmware
109
+ still has it, so it is declared here to keep it usable without a type
110
+ error. ``arc()`` takes the same extensions and is preferred in new code.
111
+
112
+ ``speed``: drive speed in mm/s along the arc for this move only. The
113
+ matching turn rate is derived from it, so the linear speed is what
114
+ governs the duration; ``None`` uses the ``straight_speed`` and
115
+ ``turn_rate`` settings.
116
+
117
+ ``exit_speed``: speed in mm/s the robot has when it reaches the end of
118
+ the arc. The *turn rate is brought to zero* at that point, so the robot
119
+ leaves on the tangent and keeps driving straight at ``exit_speed``
120
+ until the next command. This makes a curve-to-straight handover smooth;
121
+ without it a continuing move keeps rotating at the arc's turn rate and
122
+ the next command has to cancel that rotation. The price is that the
123
+ last fraction of the path is slightly flatter than a true arc. Implies
124
+ ``then=Stop.NONE``; any other explicit ``then`` raises ``ValueError``.
125
+ """
126
+
127
+ def arc( # type: ignore[override]
128
+ self,
129
+ radius: Number,
130
+ angle: Optional[Number] = None,
131
+ distance: Optional[Number] = None,
132
+ then: Stop = Stop.HOLD,
133
+ wait: bool = True,
134
+ speed: Optional[Number] = None,
135
+ exit_speed: Number = 0,
136
+ ) -> MaybeAwaitable:
137
+ """arc(radius, angle=None, distance=None, then=Stop.HOLD, wait=True, speed=None, exit_speed=0)
138
+
139
+ Drives an arc, as in Pybricks, with the same two PeakHub extensions as
140
+ :meth:`curve`: ``speed`` in mm/s for this move only (the turn rate is
141
+ derived from it), and ``exit_speed``, which ends the arc at that speed
142
+ with the turn rate at zero so the robot exits on the tangent and keeps
143
+ driving straight. ``exit_speed`` implies ``then=Stop.NONE``.
144
+ """
145
+
76
146
  def heading_target(self, angle: Optional[Number] = None) -> Optional[float]:
77
147
  """heading_target(angle) / heading_target() -> float
78
148
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scirodev
3
- Version: 0.5.3
3
+ Version: 0.5.5
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>=3.6
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"
@@ -1,5 +1,5 @@
1
1
  pybricksdev>=2.3
2
- pybricks>=3.6
2
+ pybricks>=4
3
3
 
4
4
  [docs]
5
5
  sphinx>=8
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