mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27919bbcb1 | ||
|
|
7c0aac6ba9 | ||
|
|
2f19fe210a | ||
|
|
463b608817 | ||
|
|
49ce1d7829 | ||
|
|
15600c8a2b | ||
|
|
f509178dab | ||
|
|
fd61866f2b | ||
|
|
91bc9a5d60 | ||
|
|
f470f1c510 | ||
|
|
d7f9723f6f |
@@ -4,6 +4,20 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 3.3.0 - 2023-11-24
|
||||
|
||||
### Changed
|
||||
- Bump beta version to release version with no further changes.
|
||||
|
||||
## 3.3.0c1 - 2023-11-20
|
||||
|
||||
## Added
|
||||
- Enabled tilt and orientation config for `MoveHub()`.
|
||||
- Documented `Motor.close()`
|
||||
|
||||
## Fixed
|
||||
- Fixed missing awaitable for `Remote.light` and LWP3 writes.
|
||||
|
||||
## 3.3.0b9 - 2023-10-26
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -25,6 +25,8 @@ Move Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.imu.up
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.imu.acceleration
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
|
||||
@@ -5,3 +5,6 @@ Axis
|
||||
|
||||
.. autoclass:: pybricks.parameters.Axis
|
||||
:no-members:
|
||||
|
||||
On Move Hub, doing math with these vectors is not supported. The axes can still
|
||||
be used to set up the hub orientation.
|
||||
|
||||
@@ -62,6 +62,8 @@ Motors with rotation sensors
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.settings
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.close
|
||||
|
||||
.. rubric:: Control settings
|
||||
|
||||
.. pybricks-requirements:: pybricks-common-control
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.11.0 - 2023-11-20
|
||||
|
||||
### Changed
|
||||
- Updated `pybricks` package to v3.3.0c1.
|
||||
|
||||
## 1.10.0 - 2023-10-26
|
||||
|
||||
### Changed
|
||||
|
||||
Generated
+5
-5
@@ -203,14 +203,14 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "3.11.0"
|
||||
version = "4.0.0"
|
||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"},
|
||||
{file = "platformdirs-3.11.0.tar.gz", hash = "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3"},
|
||||
{file = "platformdirs-4.0.0-py3-none-any.whl", hash = "sha256:118c954d7e949b35437270383a3f2531e99dd93cf7ce4dc8340d3356d30f173b"},
|
||||
{file = "platformdirs-4.0.0.tar.gz", hash = "sha256:cb633b2bcf10c51af60beb0ab06d2f1d69064b43abf4c185ca6b28865f3f9731"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
@@ -235,7 +235,7 @@ testing = ["pytest", "pytest-benchmark"]
|
||||
|
||||
[[package]]
|
||||
name = "pybricks"
|
||||
version = "3.3.0b9"
|
||||
version = "3.3.0c1"
|
||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||
category = "main"
|
||||
optional = false
|
||||
@@ -321,4 +321,4 @@ files = [
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">= 3.10, < 3.12"
|
||||
content-hash = "54c3f61c40e3890ef4395e3a2b1a603938b07aa7f4ea1e41ce22d5e180d634e8"
|
||||
content-hash = "f5918513eac0de09516e7509b8fe6f27d407f805c2013907447d71c3699e63bd"
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks_jedi"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
description = "Code completion for Pybricks."
|
||||
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
||||
license = "MIT"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">= 3.10, < 3.12"
|
||||
pybricks = "3.3.0b9"
|
||||
pybricks = "3.3.0c1"
|
||||
jedi = "0.18.1"
|
||||
typing-extensions = "4.2.0"
|
||||
docstring-parser = "0.14.1"
|
||||
|
||||
@@ -66,6 +66,7 @@ def test_hub_dot_imu_dot():
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"acceleration",
|
||||
"tilt",
|
||||
"up",
|
||||
]
|
||||
|
||||
|
||||
@@ -910,9 +910,14 @@ METHOD_PARAMS = [
|
||||
[(["name: str"], "None"), ([], "str")],
|
||||
),
|
||||
pytest.param(
|
||||
"pybricks.pupdevices", "Remote", "light.on", [(["color: Color"], "None")]
|
||||
"pybricks.pupdevices",
|
||||
"Remote",
|
||||
"light.on",
|
||||
[(["color: Color"], "MaybeAwaitable")],
|
||||
),
|
||||
pytest.param(
|
||||
"pybricks.pupdevices", "Remote", "light.off", [([], "MaybeAwaitable")]
|
||||
),
|
||||
pytest.param("pybricks.pupdevices", "Remote", "light.off", [([], "None")]),
|
||||
pytest.param(
|
||||
"pybricks.pupdevices",
|
||||
"Remote",
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## 2.12.0 - 2023-11-24
|
||||
|
||||
### Changed
|
||||
- Updated docs to v3.3.0.
|
||||
|
||||
## 2.11.0 - 2023-11-20
|
||||
|
||||
### Changed
|
||||
- Updated docs to v3.3.0c1.
|
||||
|
||||
## 2.10.0 - 2023-10-26
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/ide-docs",
|
||||
"version": "2.10.0",
|
||||
"version": "2.12.0",
|
||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.11.0 - 2023-11-20
|
||||
|
||||
### Changed
|
||||
- Updated `pybricks_jedi` Python package to v1.11.0.
|
||||
|
||||
## 1.10.0 - 2023-10-26
|
||||
|
||||
### Changed
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
||||
|
||||
package_json = {
|
||||
"name": "@pybricks/jedi",
|
||||
"version": "1.10.0",
|
||||
"version": "1.11.0",
|
||||
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -38,7 +38,7 @@ subprocess.check_call(
|
||||
"pip",
|
||||
"download",
|
||||
"--only-binary=any",
|
||||
"pybricks-jedi==1.10.0",
|
||||
"pybricks-jedi==1.11.0",
|
||||
],
|
||||
cwd=BUILD_DIR,
|
||||
)
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks"
|
||||
version = "3.3.0b9"
|
||||
version = "3.3.0"
|
||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||
authors = ["The Pybricks Authors <dev@pybricks.com>"]
|
||||
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
||||
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
||||
license = "MIT"
|
||||
readme = "README.rst"
|
||||
|
||||
+24
-14
@@ -605,6 +605,16 @@ class Motor(DCMotor):
|
||||
rotate to.
|
||||
"""
|
||||
|
||||
def close(self) -> None:
|
||||
"""close()
|
||||
|
||||
Closes the motor object so you can call ``Motor`` again to initialize
|
||||
a new object.
|
||||
|
||||
This allows advanced users to change properties such as gearing in the
|
||||
middle of the program, which can be useful for removeable attachments.
|
||||
"""
|
||||
|
||||
|
||||
class Speaker:
|
||||
"""Plays beeps and sounds using a speaker."""
|
||||
@@ -998,6 +1008,20 @@ class SimpleAccelerometer:
|
||||
``Side.FRONT`` or ``Side.BACK``.
|
||||
"""
|
||||
|
||||
def tilt(self) -> Tuple[int, int]:
|
||||
"""tilt() -> Tuple[int, int]
|
||||
|
||||
Gets the pitch and roll angles. This is relative to the
|
||||
:ref:`user-specified neutral orientation <robotframe>`.
|
||||
|
||||
The order of rotation is pitch-then-roll. This is equivalent to a
|
||||
positive rotation along the robot y-axis and then a positive rotation
|
||||
along the x-axis.
|
||||
|
||||
Returns:
|
||||
Tuple of pitch and roll angles in degrees.
|
||||
"""
|
||||
|
||||
|
||||
class Accelerometer(SimpleAccelerometer):
|
||||
"""Get measurements from an accelerometer."""
|
||||
@@ -1027,20 +1051,6 @@ class Accelerometer(SimpleAccelerometer):
|
||||
this returns a vector of accelerations along all axes.
|
||||
"""
|
||||
|
||||
def tilt(self) -> Tuple[int, int]:
|
||||
"""tilt() -> Tuple[int, int]
|
||||
|
||||
Gets the pitch and roll angles. This is relative to the
|
||||
:ref:`user-specified neutral orientation <robotframe>`.
|
||||
|
||||
The order of rotation is pitch-then-roll. This is equivalent to a
|
||||
positive rotation along the robot y-axis and then a positive rotation
|
||||
along the x-axis.
|
||||
|
||||
Returns:
|
||||
Tuple of pitch and roll angles in degrees.
|
||||
"""
|
||||
|
||||
|
||||
class IMU(Accelerometer):
|
||||
def ready(self) -> bool:
|
||||
|
||||
@@ -46,9 +46,13 @@ class MoveHub:
|
||||
def __init__(
|
||||
self, broadcast_channel: int = 0, observe_channels: Sequence[int] = []
|
||||
):
|
||||
"""MoveHub(broadcast_channel=0, observe_channels=[])
|
||||
"""MoveHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[])
|
||||
|
||||
Arguments:
|
||||
top_side (Axis): The axis that passes through the *top side* of
|
||||
the hub.
|
||||
front_side (Axis): The axis that passes through the *front side* of
|
||||
the hub.
|
||||
broadcast_channel:
|
||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
||||
will use. Default is channel 0.
|
||||
|
||||
@@ -316,7 +316,7 @@ class LWP3Device:
|
||||
this method returns the current name.
|
||||
"""
|
||||
|
||||
def write(self, buf: bytes) -> None:
|
||||
def write(self, buf: bytes) -> MaybeAwaitable:
|
||||
"""write(buf)
|
||||
|
||||
Sends a message to the remote hub.
|
||||
|
||||
@@ -94,7 +94,7 @@ class Motor(_common.Motor):
|
||||
class Remote:
|
||||
"""LEGO® Powered Up Bluetooth Remote Control."""
|
||||
|
||||
light = _common.ColorLight()
|
||||
light = _common.ExternalColorLight()
|
||||
buttons = _common.Keypad(
|
||||
(
|
||||
Button.LEFT_MINUS,
|
||||
|
||||
Reference in New Issue
Block a user