Skip to content

Commit

Permalink
pybricks.hubs.MoveHub: Enable imu orientation.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Nov 13, 2023
1 parent f470f1c commit 91bc9a5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/main/hubs/movehub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/main/parameters/axis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions jedi/tests/test_complete_move_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
9 changes: 7 additions & 2 deletions jedi/tests/test_get_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,14 @@ def _get_method_signature(module: str, type: str, method: str) -> SignatureHelp:
[(["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",
Expand Down
6 changes: 5 additions & 1 deletion src/pybricks/hubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 91bc9a5

Please sign in to comment.