mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
pybricks: remove non-EV3 APIs
This is the v2 branch which only supports EV3. Removing the extra APIs will prevent them from showing up when this library is used for code completion.
This commit is contained in:
@@ -16,25 +16,3 @@ Select your programmable hub using the buttons below.
|
||||
:height: 15 em
|
||||
|
||||
.. include:: hubs_ev3brick.inc
|
||||
|
||||
.. tab-container:: movehub
|
||||
:title: Move Hub
|
||||
|
||||
.. figure:: ../api/images/movehub_label.png
|
||||
:height: 15 em
|
||||
|
||||
.. include:: hubs_movehub.inc
|
||||
|
||||
.. tab-container:: cityhub
|
||||
:title: City Hub
|
||||
|
||||
.. figure:: ../api/images/cityhub.png
|
||||
:height: 15 em
|
||||
|
||||
.. include:: hubs_cityhub.inc
|
||||
|
||||
.. tab-container:: cplushub
|
||||
:title: Control+ Hub
|
||||
|
||||
.. figure:: ../api/images/cplushub.png
|
||||
:height: 15 em
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
.. autoclass:: pybricks.hubs.CityHub
|
||||
:no-members:
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.light.off
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.battery.current
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
.. autoclass:: pybricks.hubs.MoveHub
|
||||
:no-members:
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.off
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.battery.current
|
||||
+1
-24
@@ -7,28 +7,7 @@ run your first scripts.
|
||||
|
||||
**Step 1: Install Pybricks**
|
||||
|
||||
To get started, go to the :doc:`EV3 Quick Start <start_ev3>`
|
||||
or the :doc:`Powered Up Quick Start <start_ev3>` or pick your hub
|
||||
below.
|
||||
|
||||
.. list-table::
|
||||
|
||||
* - **EV3 Brick**
|
||||
- **Move Hub**
|
||||
- **City Hub**
|
||||
- **Control+ Hub**
|
||||
|
||||
* - .. image:: images/ev3brick.png
|
||||
:target: start_ev3.html
|
||||
|
||||
- .. figure:: images/movehub.png
|
||||
:target: start_pup.html
|
||||
|
||||
- .. figure:: images/cityhub.png
|
||||
:target: start_pup.html
|
||||
|
||||
- .. figure:: images/cplushub.png
|
||||
:target: start_pup.html
|
||||
To get started, go to the :doc:`EV3 Quick Start <start_ev3>`.
|
||||
|
||||
|
||||
**Step 2: Start coding!**
|
||||
@@ -68,7 +47,6 @@ findings on our `support page`_ so we can make Pybricks even better.
|
||||
:hidden:
|
||||
|
||||
start_ev3
|
||||
start_pup
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -76,7 +54,6 @@ findings on our `support page`_ so we can make Pybricks even better.
|
||||
:hidden:
|
||||
|
||||
hubs
|
||||
pupdevices
|
||||
ev3devices
|
||||
nxtdevices
|
||||
iodevices
|
||||
|
||||
+10
-41
@@ -7,42 +7,19 @@
|
||||
.. autoclass:: pybricks.parameters.Port
|
||||
:no-members:
|
||||
|
||||
.. content-tabs::
|
||||
Motor ports:
|
||||
|
||||
.. tab-container:: ev3brick
|
||||
:title: EV3 Brick
|
||||
.. data:: A
|
||||
.. data:: B
|
||||
.. data:: C
|
||||
.. data:: D
|
||||
|
||||
Motor ports:
|
||||
Sensor ports:
|
||||
|
||||
.. data:: A
|
||||
.. data:: B
|
||||
.. data:: C
|
||||
.. data:: D
|
||||
|
||||
Sensor ports:
|
||||
|
||||
.. data:: S1
|
||||
.. data:: S2
|
||||
.. data:: S3
|
||||
.. data:: S4
|
||||
|
||||
.. tab-container:: movehub
|
||||
:title: Move Hub
|
||||
|
||||
Input/Output ports:
|
||||
|
||||
.. data:: A
|
||||
.. data:: B
|
||||
.. data:: C
|
||||
.. data:: D
|
||||
|
||||
.. tab-container:: cityhub
|
||||
:title: City Hub
|
||||
|
||||
Input/Output ports:
|
||||
|
||||
.. data:: A
|
||||
.. data:: B
|
||||
.. data:: S1
|
||||
.. data:: S2
|
||||
.. data:: S3
|
||||
.. data:: S4
|
||||
|
||||
.. autoclass:: pybricks.parameters.Direction
|
||||
:no-members:
|
||||
@@ -53,8 +30,6 @@
|
||||
Some motors have two shafts. If in doubt, refer to the following diagrams:
|
||||
|
||||
- Clockwise direction for :ref:`EV3/NXT motors <fig_ev3motors>`
|
||||
- Clockwise direction for :ref:`Powered Up Motors <fig_pupmotors>`
|
||||
- Clockwise direction for :ref:`Move Hub Motors <fig_hubs>`
|
||||
|
||||
.. autoclass:: pybricks.parameters.Stop
|
||||
:no-members:
|
||||
@@ -89,9 +64,3 @@
|
||||
|
||||
.. autoclass:: pybricks.parameters.Button
|
||||
:no-members:
|
||||
|
||||
.. .. autoclass:: pybricks.parameters.Axis
|
||||
.. :no-members:
|
||||
|
||||
.. .. autoclass:: pybricks.parameters.Side
|
||||
.. :no-members:
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
:mod:`pupdevices <pybricks.pupdevices>` -- Powered Up Devices
|
||||
=============================================================
|
||||
|
||||
.. automodule:: pybricks.pupdevices
|
||||
:no-members:
|
||||
|
||||
Motors without Rotation Sensors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. _fig_pupdcmotors:
|
||||
|
||||
.. figure:: ../api/images/pupdcmotors_label.png
|
||||
:width: 70 %
|
||||
:alt: pupmotors
|
||||
:align: center
|
||||
|
||||
Powered Up motors without rotation sensors. The arrows indicate the default
|
||||
positive direction.
|
||||
|
||||
.. autoclass:: pybricks._common.DCMotor
|
||||
:noindex:
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks._common.DCMotor.dc
|
||||
:noindex:
|
||||
|
||||
.. automethod:: pybricks._common.DCMotor.stop
|
||||
:noindex:
|
||||
|
||||
.. automethod:: pybricks._common.DCMotor.brake
|
||||
:noindex:
|
||||
|
||||
Motors with Rotation Sensors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. _fig_pupmotors:
|
||||
|
||||
.. figure:: ../api/images/pupmotors_label.png
|
||||
:width: 100 %
|
||||
:alt: pupmotors
|
||||
:align: left
|
||||
|
||||
Powered Up motors with rotation sensors. The arrows indicate the default
|
||||
positive direction. See the :mod:`hubs <pybricks.hubs>` module for default
|
||||
directions of built-in motors.
|
||||
|
||||
.. autoclass:: pybricks.pupdevices.Motor
|
||||
:noindex:
|
||||
:no-members:
|
||||
|
||||
.. rubric:: Measuring
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.speed
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.angle
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.reset_angle
|
||||
|
||||
.. rubric:: Stopping
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.stop
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.brake
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.hold
|
||||
|
||||
.. rubric:: Action
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.run
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.run_time
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.run_angle
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.run_target
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.run_until_stalled
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.dc
|
||||
|
||||
.. rubric:: Advanced motion control
|
||||
|
||||
.. automethod:: pybricks.pupdevices.Motor.track_target
|
||||
|
||||
.. autoattribute:: pybricks.pupdevices.Motor.control
|
||||
:annotation:
|
||||
|
||||
|
||||
Color and Distance Sensor
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. figure:: ../api/images/sensor_colordistance.png
|
||||
:width: 35 %
|
||||
|
||||
.. autoclass:: pybricks.pupdevices.ColorDistanceSensor
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.color
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.ambient
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.reflection
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.distance
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.remote
|
||||
|
||||
.. rubric:: Built-in light
|
||||
|
||||
This sensor has a built-in light. You can make it red, green, blue, or turn
|
||||
it off. If you use the sensor to measure something afterwards, the light
|
||||
automatically turns back on at the default color for that sensing method.
|
||||
|
||||
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.on
|
||||
|
||||
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.off
|
||||
|
||||
|
||||
.. Tilt Sensor
|
||||
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. .. autoclass:: pybricks.pupdevices.TiltSensor
|
||||
:no-members:
|
||||
|
||||
.. automethod:: neutral
|
||||
|
||||
.. automethod:: acceleration
|
||||
|
||||
.. automethod:: tilt
|
||||
|
||||
.. automethod:: up
|
||||
|
||||
|
||||
.. Remote Control
|
||||
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. .. autoclass:: pybricks.pupdevices.RemoteControl
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks.pupdevices::RemoteControl.light.on
|
||||
|
||||
.. automethod:: pybricks.pupdevices::RemoteControl.light.off
|
||||
|
||||
.. automethod:: pybricks.pupdevices::RemoteControl.buttons.pressed
|
||||
@@ -1,4 +0,0 @@
|
||||
Powered Up Quick Start
|
||||
########################
|
||||
|
||||
Coming soon!
|
||||
+1
-262
@@ -4,7 +4,7 @@
|
||||
"""Generic cross-platform module for typical devices like lights, displays,
|
||||
speakers, and batteries."""
|
||||
|
||||
from .parameters import Direction, Stop, Axis
|
||||
from .parameters import Direction, Stop
|
||||
|
||||
|
||||
class DCMotor:
|
||||
@@ -389,22 +389,6 @@ class Speaker:
|
||||
pass
|
||||
|
||||
|
||||
class Light:
|
||||
"""Control a single-color light."""
|
||||
|
||||
def on(self, brightness=100):
|
||||
"""Turn on the light at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
brightness (:ref:`brightness`):
|
||||
Brightness of the light.
|
||||
"""
|
||||
|
||||
def off(self):
|
||||
"""Turns off the light."""
|
||||
pass
|
||||
|
||||
|
||||
class ColorLight:
|
||||
"""Control a multi-color light."""
|
||||
|
||||
@@ -432,119 +416,6 @@ class ColorLight:
|
||||
pass
|
||||
|
||||
|
||||
class LightArray:
|
||||
"""Control an array of single-color lights."""
|
||||
|
||||
def __init__(self, lights):
|
||||
"""Initializes the light array.
|
||||
|
||||
Arguments:
|
||||
lights (int): Number of lights
|
||||
"""
|
||||
pass
|
||||
|
||||
def on(self, brightness=100):
|
||||
"""Turns on all the lights at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
brightness (:ref:`brightness`):
|
||||
Brightness of the lights.
|
||||
"""
|
||||
pass
|
||||
|
||||
def off(self):
|
||||
"""Turns off all the lights."""
|
||||
pass
|
||||
|
||||
def array(self, *brightnesses):
|
||||
"""array(first_light, ..., last_light)
|
||||
|
||||
Sets the brightness of each light individually.
|
||||
|
||||
Arguments:
|
||||
brightness (:ref:`brightness`, ..., :ref:`brightness`):
|
||||
Brightness of each light.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class LightGrid:
|
||||
"""Control a rectangular grid of single-color lights."""
|
||||
|
||||
def __init__(self, rows, columns):
|
||||
"""Initializes the light grid.
|
||||
|
||||
Arguments:
|
||||
rows (int): Number of rows in the grid
|
||||
columns (int): Number of columns in the grid
|
||||
"""
|
||||
pass
|
||||
|
||||
def image(self, matrix, clear=True):
|
||||
"""Shows an image made up of pixels of a given brightness.
|
||||
|
||||
Arguments:
|
||||
matrix (2D Array): Matrix of intensities (:ref:`brightness`).
|
||||
clear (bool): Whether to turn off all the lights before showing
|
||||
the new image. If you choose ``False``,
|
||||
the given matrix is added to one already shown.
|
||||
"""
|
||||
pass
|
||||
|
||||
def pixel(self, row, column, brightness):
|
||||
"""Turns on a pixel at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
row (int): Vertical grid index, starting at 0 from the top.
|
||||
column (int): Horizontal grid index, starting at 0 from the left.
|
||||
brightness (:ref:`brightness`): Brightness of the pixel.
|
||||
"""
|
||||
pass
|
||||
|
||||
def on(self, brightness=100):
|
||||
"""Turns on all the pixels at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
brightness (:ref:`brightness`):
|
||||
Brightness of the lights.
|
||||
"""
|
||||
pass
|
||||
|
||||
def off(self):
|
||||
"""Turns off all the pixels."""
|
||||
pass
|
||||
|
||||
def number(self, number):
|
||||
"""Displays a number on the light grid.
|
||||
|
||||
Arguments:
|
||||
number (int): The number to be displayed.
|
||||
"""
|
||||
pass
|
||||
|
||||
def char(self, character):
|
||||
"""Displays a character or symbol on the light grid. This may
|
||||
be any letter (``a``--``z``), capital letter (``A``--``Z``) or one of
|
||||
the following symbols: ``!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}``.
|
||||
|
||||
Arguments:
|
||||
character (str): The character or symbol to be displayed.
|
||||
"""
|
||||
pass
|
||||
|
||||
def text(self, text, pause=500):
|
||||
"""Displays a text string, one character at a time, with a pause
|
||||
between each character. After the last character is shown, the light
|
||||
grid turns off.
|
||||
|
||||
Arguments:
|
||||
character (str): The character or symbol to be displayed.
|
||||
time (:ref:`time`): How long to show a character before showing
|
||||
the next one.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class KeyPad:
|
||||
"""Get status of buttons on a keypad layout."""
|
||||
|
||||
@@ -577,135 +448,3 @@ class Battery:
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Accelerometer:
|
||||
"""Get measurements from an accelerometer."""
|
||||
|
||||
def neutral(self, top, front):
|
||||
"""Configures the neutral orientation of the device or hub. You do this
|
||||
by specifying how it is mounted on your design, in terms of the
|
||||
:ref:`robot reference frame <robotframe>`.
|
||||
|
||||
In this given neutral orientation, the tilt and heading will then be
|
||||
zero.
|
||||
|
||||
Arguments:
|
||||
top (Axis): Which direction the top of the device faces in the
|
||||
neutral orientation. For example, you can
|
||||
choose ``top=-Axis.Z`` if you mounted it such that the
|
||||
neutral orientation is upside down.
|
||||
front (Axis): Which direction the front of the device faces in the
|
||||
neutral orientation.
|
||||
"""
|
||||
pass
|
||||
|
||||
def acceleration(self, axis=Axis.ALL):
|
||||
"""acceleration(axis=Axis.ALL)
|
||||
|
||||
Gets the acceleration of the device along a given axis in the
|
||||
:ref:`robot reference frame <robotframe>`.
|
||||
|
||||
Arguments:
|
||||
axis (Axis): Axis along which the acceleration is
|
||||
measured.
|
||||
Returns:
|
||||
:ref:`linacceleration`. Returns a :ref:`scalar` of the acceleration
|
||||
along the specified axis.
|
||||
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
|
||||
accelerations along all three axes (x, y, z).
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def tilt(self):
|
||||
"""Gets the pitch and roll angles relative to the neutral, horizontal
|
||||
orientation.
|
||||
|
||||
The order of rotation is pitch-then-roll. This is equivalent to a
|
||||
positive rotation along the x-axis and then a positive rotation
|
||||
along the y-axis.
|
||||
|
||||
Returns:
|
||||
(:ref:`angle`, :ref:`angle`): Pitch and roll angles.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def tapped(self):
|
||||
"""Checks if the device or hub was tapped.
|
||||
|
||||
Returns:
|
||||
bool:
|
||||
``True`` if tapped since this method was last called. ``False``
|
||||
otherwise.
|
||||
|
||||
"""
|
||||
# def tapped(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
|
||||
pass
|
||||
|
||||
def shaken(self):
|
||||
"""Checks if the device or hub was shaken.
|
||||
|
||||
Returns:
|
||||
bool:
|
||||
``True`` if shaken since this method was last called. ``False``
|
||||
otherwise.
|
||||
|
||||
"""
|
||||
# def shaken(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
|
||||
pass
|
||||
|
||||
def up(self):
|
||||
"""Checks which side of the device or hub currently faces upward.
|
||||
|
||||
:returns:
|
||||
``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``,
|
||||
``Side.FRONT`` or ``Side.BACK``.
|
||||
:rtype: :class:`Side <.parameters.Side>`
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class IMU(Accelerometer):
|
||||
|
||||
def heading(self):
|
||||
"""Gets the heading angle relative to the starting orientation. It is a
|
||||
a positive rotation around the :ref:`z-axis in the robot
|
||||
frame <robotframe>`, prior to applying any tilt rotation.
|
||||
|
||||
For a vehicle viewed from the top, this means that
|
||||
a positive heading value corresponds to a counterclockwise rotation.
|
||||
|
||||
Returns:
|
||||
:ref:`angle`: Heading angle relative to starting orientation.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def reset_heading(self, angle):
|
||||
"""Resets the accumulated heading angle of the robot.
|
||||
|
||||
Arguments:
|
||||
angle (:ref:`angle`): Value to which the heading should be reset.
|
||||
"""
|
||||
pass
|
||||
|
||||
def gyro(self, axis=Axis.ALL):
|
||||
"""gyro(axis=Axis.ALL)
|
||||
|
||||
Measures the angular velocity of the device along a given axis in the
|
||||
:ref:`robot reference frame <robotframe>`.
|
||||
|
||||
Arguments:
|
||||
axis (Axis): Axis along which the angular velocity is
|
||||
measured.
|
||||
Returns:
|
||||
:ref:`speed`. Returns a :ref:`scalar` of the angular velocity
|
||||
along the specified axis.
|
||||
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
|
||||
angular velocities along all three axes (x, y, z).
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -14,15 +14,3 @@ class EV3Brick:
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
buttons = _KeyPad()
|
||||
|
||||
|
||||
class MoveHub:
|
||||
"""LEGO® Powered Up Move Hub."""
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
|
||||
|
||||
class CityHub:
|
||||
"""LEGO® Powered Up City Hub."""
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
|
||||
@@ -155,40 +155,3 @@ class Button(_PybricksEnum):
|
||||
UP = 8
|
||||
BEACON = 8
|
||||
RIGHT_UP = 9
|
||||
|
||||
|
||||
class Axis(_PybricksEnum):
|
||||
"""Unit axes of a coordinate system.
|
||||
|
||||
.. data:: X
|
||||
.. data:: Y
|
||||
.. data:: Z
|
||||
|
||||
Some methods let you measure along all axes at once:
|
||||
|
||||
.. data:: ALL
|
||||
"""
|
||||
X = (1, 0, 0)
|
||||
Y = (0, 1, 0)
|
||||
Z = (0, 0, 1)
|
||||
ALL = None
|
||||
|
||||
|
||||
class Side(_PybricksEnum):
|
||||
"""Sides or face of a device such as a hub or a sensor. Such devices are
|
||||
usually shaped like a rectangular box with six of the following sides:
|
||||
|
||||
.. data:: TOP
|
||||
.. data:: BOTTOM
|
||||
.. data:: FRONT
|
||||
.. data:: BACK
|
||||
.. data:: LEFT
|
||||
.. data:: RIGHT
|
||||
"""
|
||||
|
||||
RIGHT = 6
|
||||
FRONT = 0
|
||||
TOP = 8
|
||||
LEFT = 4
|
||||
BACK = 5
|
||||
BOTTOM = 2
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2018-2020 The Pybricks Authors
|
||||
|
||||
"""LEGO® Powered Up motor, sensors, and lights."""
|
||||
|
||||
from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer,
|
||||
ColorLight as _ColorLight, Motor as _Motor)
|
||||
|
||||
|
||||
class Motor(_Motor):
|
||||
"""Generic class to control motors with built-in rotation sensors."""
|
||||
|
||||
def reset_angle(self, angle=None):
|
||||
"""Sets the accumulated rotation angle of the motor to a desired value.
|
||||
|
||||
If you don't specify an angle, the absolute angle
|
||||
will be used if your motor supports it.
|
||||
|
||||
Arguments:
|
||||
angle (:ref:`angle`): Value to which the angle should be reset.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class RemoteControl:
|
||||
"""LEGO® Powered Up Bluetooth Remote Control/Handset."""
|
||||
|
||||
light = _ColorLight()
|
||||
buttons = _KeyPad()
|
||||
|
||||
def __init__(self, device=None, timeout=10000):
|
||||
"""Connect the handset to the hub.
|
||||
|
||||
Arguments:
|
||||
device (str): Bluetooth address of the handset (? TODO ?).
|
||||
If you do not specify a device identifier, the hub will
|
||||
attempt to pair with any handset that is currently in
|
||||
advertising mode.
|
||||
timeout (:ref:`time`): The amount of time before giving up
|
||||
searching.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class TiltSensor(_Accelerometer):
|
||||
"""LEGO® Powered Up Tilt Sensor."""
|
||||
|
||||
def __init__(self, port):
|
||||
"""TiltSensor(port)
|
||||
|
||||
Arguments:
|
||||
port (Port): Port to which the sensor is connected.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class ColorDistanceSensor:
|
||||
"""LEGO® Powered Up Color and Distance Sensor."""
|
||||
|
||||
light = _ColorLight()
|
||||
|
||||
def __init__(self, port):
|
||||
"""ColorDistanceSensor(port)
|
||||
|
||||
Arguments:
|
||||
port (Port): Port to which the sensor is connected.
|
||||
"""
|
||||
pass
|
||||
|
||||
def color(self):
|
||||
"""Measures the color of a surface.
|
||||
|
||||
:returns:
|
||||
``Color.BLACK``, ``Color.BLUE``, ``Color.GREEN``, ``Color.YELLOW``,
|
||||
``Color.RED``, ``Color.WHITE``, or ``None``.
|
||||
:rtype: :class:`Color <.parameters.Color>`, or ``None`` if no color is
|
||||
detected.
|
||||
"""
|
||||
pass
|
||||
|
||||
def ambient(self):
|
||||
"""Measures the ambient light intensity.
|
||||
|
||||
Returns:
|
||||
:ref:`percentage`: Ambient light intensity, ranging from 0 (dark)
|
||||
to 100 (bright).
|
||||
"""
|
||||
pass
|
||||
|
||||
def reflection(self):
|
||||
"""Measures the reflection of a surface using a red light.
|
||||
|
||||
Returns:
|
||||
:ref:`percentage`: Reflection, ranging from 0.0 (no reflection) to
|
||||
100.0 (high reflection).
|
||||
"""
|
||||
pass
|
||||
|
||||
def rgb(self):
|
||||
"""Measures the reflection of a surface using a red, green, and then a
|
||||
blue light.
|
||||
|
||||
:returns: Tuple of reflections for red, green, and blue light, each
|
||||
ranging from 0.0 (no reflection) to 100.0 (high reflection).
|
||||
:rtype: (:ref:`percentage`, :ref:`percentage`, :ref:`percentage`)
|
||||
"""
|
||||
pass
|
||||
|
||||
def distance(self):
|
||||
"""Measures the relative distance between the sensor and an object
|
||||
using infrared light.
|
||||
|
||||
Returns:
|
||||
:ref:`relativedistance`: Relative distance ranging from 0 (closest)
|
||||
to 100 (farthest).
|
||||
"""
|
||||
pass
|
||||
|
||||
def remote(self, channel, button_1=None, button_2=None):
|
||||
"""Makes the sensor act like a Power Functions 1.0 IR remote.
|
||||
|
||||
Choose a channel and up to two buttons to "press". The infrared
|
||||
receiver behaves just as if responding to the real remote.
|
||||
|
||||
The sensor keeps sending the signal (as if you keep pressing the
|
||||
buttons). It keeps going until you call this method again with
|
||||
different buttons or no buttons at all.
|
||||
|
||||
Arguments:
|
||||
channel (int): Channel number of the remote.
|
||||
button_1 (Button): Button of the Power Functions 1.0 IR remote.
|
||||
Choose ``None`` if you don't want to press
|
||||
any button.
|
||||
button_2 (Button): Button of the Power Functions 1.0 IR remote.
|
||||
Choose ``None`` if you don't want to press
|
||||
any button.
|
||||
"""
|
||||
Reference in New Issue
Block a user