api/pupdevices: add TiltSensor

This class and its methods are subject to change when the complete
API for IMUs is introduced.
This commit is contained in:
Laurens Valk
2020-07-01 13:33:36 +02:00
parent 55fe666dac
commit d66e18b113
2 changed files with 23 additions and 11 deletions
+12 -8
View File
@@ -205,19 +205,23 @@ Infrared Sensor
.. automethod:: pybricks.pupdevices.InfraredSensor.count
.. Tilt Sensor
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
Tilt Sensor
^^^^^^^^^^^^^^^^^^^^^^^^^
.. .. autoclass:: pybricks.pupdevices.TiltSensor
.. figure:: ../api/images/sensor_tilt.png
:width: 35 %
.. autoclass:: pybricks.pupdevices.TiltSensor
:no-members:
.. automethod:: neutral
.. automethod:: acceleration
.. automethod:: tilt
.. automethod:: up
.. .. automethod:: neutral
.. .. automethod:: acceleration
.. .. automethod:: up
.. Remote Control
+11 -3
View File
@@ -3,7 +3,7 @@
"""LEGO® Powered Up motor, sensors, and lights."""
from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer,
from ._common import (KeyPad as _KeyPad,
ColorLight as _ColorLight, Motor as _Motor,
LightArray as _LightArray, Light as _Light)
@@ -43,17 +43,25 @@ class RemoteControl:
pass
class TiltSensor(_Accelerometer):
class TiltSensor:
"""LEGO® Powered Up Tilt Sensor."""
def __init__(self, port):
"""TiltSensor(port)
"""
Arguments:
port (Port): Port to which the sensor is connected.
"""
pass
def tilt(self):
"""Measures the tilt relative to the horizontal plane.
Returns:
(:ref:`angle`, :ref:`angle`): Tuple of pitch and roll angles.
"""
pass
class ColorDistanceSensor:
"""LEGO® Powered Up Color and Distance Sensor."""