api/hubs: add axis initializers for IMU

This commit is contained in:
Laurens Valk
2021-01-05 16:31:35 +01:00
parent 2a97b62603
commit 3a9e5728c6
2 changed files with 36 additions and 0 deletions
+33
View File
@@ -7,6 +7,7 @@ from ._common import (Speaker as _Speaker, Battery as _Battery,
LightMatrix as _LightMatrix, IMU as _IMU)
from .media.ev3dev import Image as _Image
from .parameters import Button as _Button
from .geometry import Axis as _Axis
class EV3Brick:
@@ -54,6 +55,22 @@ class TechnicHub:
light = _ColorLight()
imu = _IMU()
def __init__(self, top_side=_Axis.Z, front_side=_Axis.X):
"""__init__(top_side=Axis.Z, front_side=Axis.X)
Initializes the hub. Optionally, specify how the hub is
:ref:`placed in your design <robotframe>` by saying in which
direction the top side (with the button) and front side
(with the light) are pointing.
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.
"""
pass
class PrimeHub:
"""LEGO® SPIKE Prime Hub."""
@@ -72,6 +89,22 @@ class PrimeHub:
speaker = _Speaker()
imu = _IMU()
def __init__(self, top_side=_Axis.Z, front_side=_Axis.X):
"""__init__(top_side=Axis.Z, front_side=Axis.X)
Initializes the hub. Optionally, specify how the hub is
:ref:`placed in your design <robotframe>` by saying in which
direction the top side (with the buttons) and front side (with the USB
port) are pointing.
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.
"""
pass
class InventorHub(PrimeHub):
"""LEGO® MINDSTORMS Inventor Hub."""
+3
View File
@@ -3,6 +3,7 @@
from ._common import Speaker, Battery, ColorLight, LightMatrix, Keypad
from .media.ev3dev import Image
from .geometry import Axis
class EV3Brick:
screen: Image
@@ -22,11 +23,13 @@ class CityHub:
class TechnicHub:
def __init__(self, top_size: Axis, front_side: Axis): ...
battery: Battery
light: ColorLight
class PrimeHub:
def __init__(self, top_size: Axis, front_side: Axis): ...
battery: Battery
light: ColorLight
display: LightMatrix