mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ea780cc9e | ||
|
|
78a8fea78f | ||
|
|
99a7c69ac5 | ||
|
|
1a64ba718f | ||
|
|
6d332deb3f | ||
|
|
a7df6988ab | ||
|
|
a2e17f6889 | ||
|
|
866b50fef6 | ||
|
|
9c7378ce64 | ||
|
|
3b20a811cb | ||
|
|
73cc441edb | ||
|
|
7770a88aa0 | ||
|
|
f06caa32bc | ||
|
|
fb8198fe8f | ||
|
|
3dad15ac11 | ||
|
|
790fcfa66a | ||
|
|
d108d7c163 | ||
|
|
7ce3721b48 | ||
|
|
d0bfbcb4d1 | ||
|
|
2aadc75f2c | ||
|
|
8bf42c7d2d | ||
|
|
de13c01673 | ||
|
|
ca96ee2fce | ||
|
|
68f626f1ef | ||
|
|
570fac30c5 | ||
|
|
1f0be98649 | ||
|
|
e91590feec | ||
|
|
597b6d682f | ||
|
|
9c8d41efb8 | ||
|
|
a06e01c6de | ||
|
|
186c46f52c | ||
|
|
7679b8b47d | ||
|
|
c14f1cf473 | ||
|
|
6ce8336c26 |
@@ -1,7 +1,7 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Python package
|
||||
name: Build Python package and docs
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Release to PyPI
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build_and_publish:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: abatilo/actions-poetry@v2.0.0
|
||||
with:
|
||||
poetry-version: 1.1.6
|
||||
- run: poetry install
|
||||
- run: poetry build
|
||||
- run: poetry publish
|
||||
env:
|
||||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
|
||||
@@ -1,49 +0,0 @@
|
||||
:mod:`geometry <pybricks.geometry>` -- Geometry and algebra
|
||||
============================================================
|
||||
|
||||
.. module:: pybricks.geometry
|
||||
|
||||
.. autoclass:: pybricks.geometry.Matrix
|
||||
:no-members:
|
||||
|
||||
.. autoattribute:: pybricks.geometry::Matrix.T
|
||||
|
||||
.. autoattribute:: pybricks.geometry::Matrix.shape
|
||||
|
||||
.. autofunction:: pybricks.geometry.vector
|
||||
|
||||
.. autoclass:: pybricks.geometry.Axis
|
||||
:no-members:
|
||||
|
||||
.. _robotframe:
|
||||
|
||||
Reference frames
|
||||
-----------------------
|
||||
|
||||
The Pybricks module and this documentation use the following conventions:
|
||||
|
||||
- X: Positive means forward. Negative means backward.
|
||||
- Y: Positive means to the left. Negative means to the right.
|
||||
- Z: Positive means upward. Negative means downward.
|
||||
|
||||
To make sure that all hub measurements (such as acceleration) have the correct
|
||||
value and sign, you can specify how the hub is mounted in your creation. This
|
||||
adjust the measurements so that it is easy to see how your *robot* is moving,
|
||||
rather than how the *hub* is moving.
|
||||
|
||||
For example, the hub may be mounted upside down in your design. If you
|
||||
configure the settings as shown in :numref:`fig_imuexamples`, the hub
|
||||
measurements will be adjusted accordingly. This way, a positive acceleration
|
||||
value in the X direction means that your *robot* accelerates forward, even
|
||||
though the *hub* accelerates backward.
|
||||
|
||||
.. _fig_imuexamples:
|
||||
|
||||
.. figure:: ../api/images/imuexamples_label.png
|
||||
:width: 100 %
|
||||
|
||||
How to configure the ``top_side`` and ``front_side`` settings for three
|
||||
different robot designs. The same technique can be applied to other hubs
|
||||
and other creations, by noting which way the top and
|
||||
front :class:`Side <Side>` of the hub are pointing. The example
|
||||
on the left is the default configuration.
|
||||
@@ -10,7 +10,6 @@
|
||||
movehub
|
||||
cityhub
|
||||
technichub
|
||||
primehub
|
||||
ev3brick
|
||||
|
||||
.. pybricks-classlink:: MoveHub
|
||||
@@ -31,18 +30,6 @@
|
||||
:height: 10 em
|
||||
:target: technichub.html
|
||||
|
||||
.. pybricks-classlink:: PrimeHub
|
||||
|
||||
.. figure:: ../../api/images/primehub.png
|
||||
:height: 10 em
|
||||
:target: primehub.html
|
||||
|
||||
.. pybricks-classlink:: InventorHub
|
||||
|
||||
.. figure:: ../../api/images/inventorhub.png
|
||||
:height: 10 em
|
||||
:target: primehub.html
|
||||
|
||||
.. pybricks-classlink:: EV3Brick
|
||||
|
||||
.. figure:: ../../api/images/ev3brick.png
|
||||
|
||||
@@ -39,3 +39,4 @@ Making the light blink
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_blink.py
|
||||
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
Prime Hub / Inventor Hub
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. figure:: ../../api/images/primeinventorhub.png
|
||||
:height: 15 em
|
||||
|
||||
.. class:: InventorHub
|
||||
|
||||
This class is the same as the ``PrimeHub`` class, shown below. Both classes
|
||||
work on both hubs.
|
||||
|
||||
These hubs are completely identical. They use the same Pybricks firmware.
|
||||
|
||||
.. autoclass:: pybricks.hubs.PrimeHub
|
||||
:no-members:
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. figure:: ../../api/images/primehub_light_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.off
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.blink
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.animate
|
||||
|
||||
.. rubric:: Using the light matrix display
|
||||
|
||||
.. figure:: ../../api/images/primehub_display_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.orientation
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.off
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.pixel
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.image
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.animate
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.number
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.char
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.text
|
||||
|
||||
.. rubric:: Using the buttons
|
||||
|
||||
.. figure:: ../../api/images/primehub_buttons_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.buttons.pressed
|
||||
|
||||
.. rubric:: Using the IMU
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.up
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.tilt
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.acceleration
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.angular_velocity
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.heading
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.imu.reset_heading
|
||||
|
||||
.. rubric:: Using the speaker
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.speaker.beep
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.speaker.play_notes
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.current
|
||||
|
||||
.. note:: The examples below use the ``PrimeHub`` class. The examples work fine
|
||||
on both hubs because they are the identical. If you prefer, you can
|
||||
change this to ``InventorHub``.
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
*******************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
*************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_animate.py
|
||||
|
||||
Matrix display examples
|
||||
-----------------------
|
||||
|
||||
Displaying images
|
||||
*****************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_image.py
|
||||
|
||||
Displaying numbers
|
||||
******************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_number.py
|
||||
|
||||
Displaying text
|
||||
***************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_text.py
|
||||
|
||||
Displaying individual pixels
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_pixel.py
|
||||
|
||||
Changing the display orientation
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation.py
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation_imu.py
|
||||
|
||||
Making your own images
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_matrix.py
|
||||
|
||||
Combining images to make expressions
|
||||
************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_expression.py
|
||||
|
||||
Displaying animations
|
||||
*********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_animate.py
|
||||
|
||||
Button examples
|
||||
---------------
|
||||
|
||||
Detecting button presses
|
||||
************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/button_main.py
|
||||
|
||||
IMU examples
|
||||
---------------
|
||||
|
||||
Testing which way is up
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/imu_up.py
|
||||
|
||||
|
||||
Reading the tilt value
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/imu_tilt.py
|
||||
|
||||
Using a custom hub orientation
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/imu_tilt_blast.py
|
||||
|
||||
Reading acceleration and angular velocity vectors
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/imu_read_vector.py
|
||||
|
||||
Reading acceleration and angular velocity on one axis
|
||||
*****************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/imu_read_scalar.py
|
||||
@@ -4,8 +4,7 @@ Technic Hub
|
||||
.. figure:: ../../api/images/technichub.png
|
||||
:height: 15 em
|
||||
|
||||
.. autoclass:: pybricks.hubs.TechnicHub
|
||||
:no-members:
|
||||
.. class:: TechnicHub
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
@@ -17,20 +16,6 @@ Technic Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.light.animate
|
||||
|
||||
.. rubric:: Using the IMU
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.up
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.acceleration
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.angular_velocity
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.heading
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.imu.reset_heading
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.battery.voltage
|
||||
@@ -63,37 +48,3 @@ Creating light animations
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_animate.py
|
||||
|
||||
IMU examples
|
||||
---------------
|
||||
|
||||
Testing which way is up
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/imu_up.py
|
||||
|
||||
|
||||
Reading the tilt value
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/imu_tilt.py
|
||||
|
||||
Using a custom hub orientation
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/imu_tilt_blast.py
|
||||
|
||||
Reading acceleration and angular velocity vectors
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/imu_read_vector.py
|
||||
|
||||
Reading acceleration and angular velocity on one axis
|
||||
*****************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/imu_read_scalar.py
|
||||
|
||||
+5
-18
@@ -1,4 +1,4 @@
|
||||
Welcome to Pybricks!
|
||||
Pybricks API Documentation
|
||||
==================================================================
|
||||
|
||||
This documentation has everything you need to install Pybricks and
|
||||
@@ -18,13 +18,13 @@ the platforms below.
|
||||
- **SPIKE / MINDSTORMS Inventor**
|
||||
|
||||
* - .. image:: ../api/images/ev3brick.png
|
||||
:target: start_ev3/index.html
|
||||
:target: https://pybricks.com/install/mindstorms-ev3/installation
|
||||
|
||||
- .. figure:: ../api/images/powereduphubs.png
|
||||
:target: start_pup.html
|
||||
:target: https://pybricks.com/install/technic-boost-city/
|
||||
|
||||
- .. figure:: ../api/images/primeinventorhub.png
|
||||
:target: start_inventor.html
|
||||
:target: https://pybricks.com/install/spike-mindstorms/
|
||||
|
||||
|
||||
**Step 2: Start coding!**
|
||||
@@ -53,19 +53,7 @@ findings on our `support page`_ so we can make Pybricks even better.
|
||||
:hidden:
|
||||
|
||||
Home Page <https://pybricks.com>
|
||||
Downloads <https://pybricks.com/downloads/>
|
||||
Example Projects <https://github.com/pybricks/pybricks-projects>
|
||||
Support <https://github.com/pybricks/support/issues/>
|
||||
About Pybricks <https://pybricks.com/about/>
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Getting started
|
||||
:hidden:
|
||||
|
||||
start_ev3/index
|
||||
start_pup
|
||||
start_inventor
|
||||
Installation <https://pybricks.com/install/>
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -82,7 +70,6 @@ findings on our `support page`_ so we can make Pybricks even better.
|
||||
robotics
|
||||
media
|
||||
messaging
|
||||
geometry
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
@@ -12,3 +12,12 @@ Powered Up Device
|
||||
.. automethod:: pybricks.iodevices.PUPDevice.read
|
||||
|
||||
.. automethod:: pybricks.iodevices.PUPDevice.write
|
||||
|
||||
Examples
|
||||
-------------------
|
||||
|
||||
Detecting devices
|
||||
******************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/iodevices_pupdevice/port_info.py
|
||||
|
||||
@@ -41,7 +41,7 @@ The connection will be made when you run your programs, as described below.
|
||||
Pairing one EV3 Brick to another EV3 Brick.
|
||||
|
||||
When you scan for Bluetooth devices, you'll see a list of device names. By
|
||||
default, all EV3 Bricks are named *ev3dev*. Click :ref:`here <hostname>` to
|
||||
default, all EV3 Bricks are named *ev3dev*. Click `here`_ to
|
||||
learn how to change that name. This makes it easy to tell them apart.
|
||||
|
||||
Repeat the steps in :numref:`fig_bluetooth_pair` if you want to pair more than
|
||||
@@ -134,3 +134,5 @@ is shown in :numref:`fig_messaging_network`.
|
||||
:align: center
|
||||
|
||||
An example network with one server and two clients.
|
||||
|
||||
.. _here: https://pybricks.com/install/mindstorms-ev3/beyond-micropython
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
color
|
||||
direction
|
||||
port
|
||||
side
|
||||
stop
|
||||
|
||||
.. pybricks-classlink:: Button
|
||||
@@ -23,7 +22,5 @@
|
||||
|
||||
.. pybricks-classlink:: Port
|
||||
|
||||
.. pybricks-classlink:: Side
|
||||
|
||||
.. pybricks-classlink:: Stop
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
Side
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. class:: Side
|
||||
|
||||
Side of a hub or a sensor. These devices are
|
||||
mostly rectangular boxes with six sides:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.TOP
|
||||
:annotation:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.BOTTOM
|
||||
:annotation:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.FRONT
|
||||
:annotation:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.BACK
|
||||
:annotation:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.LEFT
|
||||
:annotation:
|
||||
|
||||
.. autoattribute:: pybricks.parameters.Side.RIGHT
|
||||
:annotation:
|
||||
|
||||
|
||||
Screens or light matrices have only four sides. For those,
|
||||
``TOP`` is treated the same as ``FRONT``, and ``BOTTOM`` is treated the
|
||||
same as ``BACK``. The diagrams below define the sides for relevant devices.
|
||||
|
||||
**Prime Hub**
|
||||
|
||||
.. figure:: ../../api/images/orientation_primehub_label.png
|
||||
:height: 17 em
|
||||
|
||||
**Inventor Hub**
|
||||
|
||||
.. figure:: ../../api/images/orientation_inventorhub_label.png
|
||||
:height: 17 em
|
||||
|
||||
**Move Hub**
|
||||
|
||||
.. figure:: ../../api/images/orientation_movehub_label.png
|
||||
:height: 17 em
|
||||
|
||||
**Technic Hub**
|
||||
|
||||
.. figure:: ../../api/images/orientation_technichub_label.png
|
||||
:height: 17 em
|
||||
|
||||
**Tilt Sensor**
|
||||
|
||||
.. figure:: ../../api/images/orientation_tiltsensor_label.png
|
||||
:height: 17 em
|
||||
@@ -67,7 +67,7 @@ Changing the detectable colors
|
||||
******************************
|
||||
|
||||
By default, the sensor is configured to detect red, yellow, green,
|
||||
blue, white, or ``None``, which suits many applications.
|
||||
blue, white, or no color, which suits many applications.
|
||||
|
||||
For better results in your application, you can measure your desired
|
||||
colors in advance, and tell the sensor to look only for those colors.
|
||||
|
||||
@@ -58,7 +58,7 @@ Changing the detectable colors
|
||||
******************************
|
||||
|
||||
By default, the sensor is configured to detect red, yellow, green,
|
||||
blue, white, or ``None``, which suits many applications.
|
||||
blue, white, or no color, which suits many applications.
|
||||
|
||||
For better results in your application, you can measure your desired
|
||||
colors in advance, and tell the sensor to look only for those colors.
|
||||
|
||||
@@ -26,6 +26,12 @@ Motors without Rotation Sensors
|
||||
Examples
|
||||
-------------------
|
||||
|
||||
Making a train drive forever
|
||||
************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/motor_dc/motor_dc_battery_box.py
|
||||
|
||||
Making the motor move back and forth
|
||||
************************************
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
ultrasonicsensor
|
||||
forcesensor
|
||||
light
|
||||
remote
|
||||
|
||||
.. pybricks-classlink:: DCMotor
|
||||
|
||||
@@ -79,9 +78,3 @@
|
||||
.. figure:: ../../api/images/light.png
|
||||
:width: 90 %
|
||||
:target: light.html
|
||||
|
||||
.. pybricks-classlink:: Remote
|
||||
|
||||
.. figure:: ../../api/images/pupremote.png
|
||||
:width: 50 %
|
||||
:target: remote.html
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
Remote Control
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. warning::
|
||||
|
||||
This remote is not yet supported.
|
||||
Upvote `this issue <https://github.com/pybricks/support/issues/186>`_ if
|
||||
you want to see this happen.
|
||||
|
||||
.. figure:: ../../api/images/pupremote.png
|
||||
:width: 60 %
|
||||
|
||||
.. autoclass:: pybricks.pupdevices.Remote
|
||||
:no-members:
|
||||
|
||||
.. autoattribute:: pybricks.pupdevices::Remote.address
|
||||
:annotation:
|
||||
|
||||
.. automethod:: pybricks.pupdevices::Remote.light.on
|
||||
|
||||
.. automethod:: pybricks.pupdevices::Remote.light.off
|
||||
|
||||
.. automethod:: pybricks.pupdevices::Remote.buttons.pressed
|
||||
@@ -1,23 +0,0 @@
|
||||
MINDSTORMS EV3
|
||||
########################
|
||||
|
||||
.. note::
|
||||
|
||||
This documentation is for EV3 MicroPython with Pybricks **3.0**.
|
||||
|
||||
Click `here`_ to view the documentation EV3 MicroPython **2.0**. This is
|
||||
is the stable version officially supported by `LEGO Education`_.
|
||||
|
||||
.. rubric:: Table of contents
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
start_ev3_install
|
||||
start_ev3_brick
|
||||
start_ev3_run
|
||||
start_ev3_linux
|
||||
start_ev3_upgrade
|
||||
|
||||
.. _here: https://pybricks.github.io/ev3-micropython/index.html
|
||||
.. _LEGO Education: https://education.lego.com/en-us/support/mindstorms-ev3/python-for-ev3
|
||||
@@ -1,81 +0,0 @@
|
||||
Using the EV3 Brick
|
||||
===================
|
||||
|
||||
Make sure the EV3 Brick is turned off. Insert the microSD card you prepared
|
||||
into the microSD card slot on the EV3 Brick, as shown in :numref:`fig_sd`.
|
||||
|
||||
.. _fig_sd:
|
||||
|
||||
.. figure:: ../../api/images/sd_label.png
|
||||
:width: 75 %
|
||||
:alt: sd
|
||||
:align: center
|
||||
|
||||
Inserting the flashed microSD card into the EV3 Brick
|
||||
|
||||
|
||||
Turning the EV3 Brick on and off
|
||||
-----------------------------------------------------------
|
||||
|
||||
Turn on the EV3 Brick by pressing the dark gray center button.
|
||||
|
||||
The boot process may take several minutes. While booting, the EV3 Brick status
|
||||
light turns orange and blinks intermittently, and you'll see a lot of text on
|
||||
the EV3 screen. The EV3 Brick is ready for use when the status light turns
|
||||
green.
|
||||
|
||||
To turn the EV3 Brick off, open the shutdown menu with the back button, and
|
||||
then select *Power Off* using the center button, as shown
|
||||
in :numref:`fig_onoff`.
|
||||
|
||||
.. _fig_onoff:
|
||||
|
||||
.. figure:: ../../api/images/onoff_label.png
|
||||
:width: 65 %
|
||||
:alt: onoff
|
||||
:align: center
|
||||
|
||||
Turning the EV3 Brick off
|
||||
|
||||
Viewing motor and sensor values
|
||||
-----------------------------------------------------------
|
||||
|
||||
When you're not running a program, you can view motor and sensor values using
|
||||
the device browser, as shown in :numref:`fig_devicebrowser`.
|
||||
|
||||
.. _fig_devicebrowser:
|
||||
|
||||
.. figure:: ../../api/images/devicebrowser_label.png
|
||||
:width: 100 %
|
||||
:alt: devicebrowser
|
||||
:align: center
|
||||
|
||||
Viewing motor and sensor values
|
||||
|
||||
Running a program without a computer
|
||||
-----------------------------------------------------------
|
||||
|
||||
You can run previously downloaded programs directly from the EV3 Brick.
|
||||
|
||||
To do so, find the program using the *file browser* on the EV3 screen and press
|
||||
the center button key to start the program as shown in :numref:`fig_manualrun`.
|
||||
|
||||
.. _fig_manualrun:
|
||||
|
||||
.. figure:: ../../api/images/manualrun_label.png
|
||||
:width: 100 %
|
||||
:alt: manualrun
|
||||
:align: center
|
||||
|
||||
Starting a program using the buttons on the EV3 Brick
|
||||
|
||||
Going back to the original firmware
|
||||
-----------------------------------------------------------
|
||||
|
||||
You can go back to the LEGO® firmware and your LEGO programs at any time. To
|
||||
do so:
|
||||
|
||||
1. Turn the EV3 Brick off as shown above.
|
||||
2. Wait for the screen and brick status light to turn off.
|
||||
3. Remove the microSD card.
|
||||
4. Turn the EV3 on.
|
||||
@@ -1,118 +0,0 @@
|
||||
Installation
|
||||
===================
|
||||
|
||||
This page guides you through the steps to collect and install everything you
|
||||
need to start programming.
|
||||
|
||||
What do you need?
|
||||
-----------------------------------------------------------
|
||||
|
||||
To get started, you'll need:
|
||||
|
||||
- A Windows 10 or Mac OS computer
|
||||
- Internet access and administrator access
|
||||
|
||||
This is required during the installation only. You will not need special
|
||||
access to write and run programs later on.
|
||||
|
||||
- A microSD card
|
||||
|
||||
You'll need a card with a minimum capacity of 4GB and a maximum capacity
|
||||
of 32GB. This type of microSD card is also known as microSDHC. We recommend
|
||||
cards with Application Performance Class A1.
|
||||
|
||||
- A microSD card slot or card reader in your computer
|
||||
|
||||
If your computer does not have a (micro)SD card slot, you can use an
|
||||
external USB (micro)SD card reader.
|
||||
|
||||
- A mini-USB cable, like the one included with your EV3 set
|
||||
|
||||
The typical configuration of this equipment is summarized
|
||||
in :numref:`fig_overview`.
|
||||
|
||||
.. _fig_overview:
|
||||
|
||||
.. figure:: ../../api/images/overview_label.png
|
||||
:width: 90 %
|
||||
:alt: overview
|
||||
:align: center
|
||||
|
||||
Setup overview
|
||||
|
||||
Preparing your computer
|
||||
-----------------------------------------------------------
|
||||
|
||||
You'll write your MicroPython programs using Visual Studio Code. Follow the
|
||||
steps below to download, install, and configure this application:
|
||||
|
||||
1. Download `Visual Studio Code <https://code.visualstudio.com/Download>`_.
|
||||
2. Follow the on-screen instructions to install the application.
|
||||
3. Launch Visual Studio Code.
|
||||
4. Open the extensions tab.
|
||||
5. Install the EV3 MicroPython extension as shown in :numref:`fig_store`.
|
||||
|
||||
.. _fig_store:
|
||||
|
||||
.. figure:: ../../api/images/store_label.png
|
||||
:alt: store
|
||||
:align: center
|
||||
|
||||
Installing the extension from the Visual Studio Code marketplace
|
||||
|
||||
.. _prepsdcard:
|
||||
|
||||
Preparing the microSD card
|
||||
-----------------------------------------------------------
|
||||
|
||||
To make it possible to run MicroPython programs on your EV3 Brick, you'll now
|
||||
learn how to install the required tools on your microSD card.
|
||||
|
||||
If the microSD card contains files you want to keep, make sure to create a
|
||||
backup of its contents first.
|
||||
See :ref:`managing files on the EV3 <managefiles>` to learn how to backup your
|
||||
previous MicroPython programs if necessary.
|
||||
|
||||
*This process erases everything on your microSD card, including any previous
|
||||
MicroPython programs on it.*
|
||||
|
||||
|
||||
To install the MicroPython tools on your microSD card:
|
||||
|
||||
1. Download the `EV3 MicroPython microSD card image`_ and save it in a
|
||||
convenient location. This file is approximately 360 MB. You do **not** need
|
||||
to unzip the file.
|
||||
2. Download and install a microSD card flashing tool
|
||||
such as `Etcher <https://www.balena.io/etcher/>`_.
|
||||
3. Insert the microSD card into your computer or card reader.
|
||||
4. Launch the flashing tool and follow the steps on your screen to install
|
||||
the file you have just downloaded. If you use Etcher, you can follow the
|
||||
instructions below, as shown in :numref:`fig_etcher`.
|
||||
|
||||
a. Select the EV3 MicroPython microSD card image file you have just
|
||||
downloaded.
|
||||
b. Select your microSD card. Make sure that the device and size correspond
|
||||
to your microSD card.
|
||||
c. Start the flashing process. This may take several minutes. Do not remove
|
||||
the card until the flashing process is complete.
|
||||
|
||||
.. _fig_etcher:
|
||||
|
||||
.. figure:: ../../api/images/etcher_label.png
|
||||
:width: 85 %
|
||||
:alt: etcher
|
||||
:align: center
|
||||
|
||||
Using Etcher to flash the EV3 MicroPython microSD card image
|
||||
|
||||
Updating the microSD card
|
||||
-----------------------------------------------------------
|
||||
|
||||
To update the microSD card, download a new image file using the link above and
|
||||
flash it to the microSD card as described above. Be sure
|
||||
to :ref:`back up any MicroPython programs you want to save <managefiles>`.
|
||||
|
||||
You do not need to erase the contents of the microSD card first. This is done
|
||||
automatically when you flash the new image file.
|
||||
|
||||
.. _EV3 MicroPython microSD card image: https://education.lego.com/en-us/product-resources/mindstorms-ev3/teacher-resources/python-for-ev3
|
||||
@@ -1,101 +0,0 @@
|
||||
Accessing advanced EV3 features
|
||||
===============================
|
||||
|
||||
MicroPython runs on top of `ev3dev`_, which is a specific version of Linux.
|
||||
Linux is an *operating system*. (Other popular operating
|
||||
systems are Microsoft Windows and Apple macOS.) This means that your EV3 is
|
||||
almost like a real computer, just much smaller.
|
||||
|
||||
The Linux command line
|
||||
-----------------------------------------
|
||||
|
||||
Although your EV3 Brick is quite like a real computer, you do not interact with
|
||||
it using a big screen and a mouse. Instead, you can access files and programs
|
||||
on it using the *command line*. It is also called the *terminal*.
|
||||
|
||||
Follow the steps in :numref:`fig_terminal` to access the command line. Now
|
||||
you can enter commands by typing them in and pressing enter.
|
||||
|
||||
.. _fig_terminal:
|
||||
|
||||
.. figure:: ../../api/images/terminal_label.png
|
||||
:width: 100 %
|
||||
:alt: files
|
||||
:align: center
|
||||
|
||||
Opening the Linux command line and running the ``ls`` command.
|
||||
|
||||
**Running basic commands**
|
||||
|
||||
For example, if you type the following command and press enter::
|
||||
|
||||
ls
|
||||
|
||||
then you will see the contents of the current folder. :numref:`fig_terminal`
|
||||
shows the result: it listed the project folder of the ``getting_started``
|
||||
project that we just ran.
|
||||
|
||||
If you type the following command and press enter::
|
||||
|
||||
exit
|
||||
|
||||
then the command line will be closed. Alternatively, click the garbage icon
|
||||
shown in :numref:`fig_terminal`.
|
||||
|
||||
You can copy text from the command line by selecting it and
|
||||
then pressing ``ctrl`` ``shift`` ``c``.
|
||||
You can paste text into the command line
|
||||
using ``ctrl`` ``shift`` ``v``.
|
||||
|
||||
**Running commands as an administrator**
|
||||
|
||||
Some commands require a password to run. This is similar to administrative
|
||||
tasks on your computer or tablet, such as installing a new app. These commands
|
||||
work like any other command, but you add ``sudo`` in front of
|
||||
them.
|
||||
|
||||
As an exercise, you can run the following command to turn the EV3 Brick off::
|
||||
|
||||
sudo poweroff
|
||||
|
||||
You will be prompted for a password. Type ``maker`` and then press ``Enter``.
|
||||
|
||||
.. warning::
|
||||
|
||||
Only run commands with ``sudo`` if you know what you are doing.
|
||||
|
||||
**Learning more about the command line**
|
||||
|
||||
To learn more about the command line and many of the available commands, we
|
||||
recommend reading the beginner-friendly free ebook
|
||||
called `The Linux Command Line`_.
|
||||
|
||||
To learn more about ev3dev-specific tips and tricks, visit the `ev3dev`_
|
||||
website.
|
||||
|
||||
.. _hostname:
|
||||
|
||||
Changing the EV3 Brick name
|
||||
-----------------------------------------------------------
|
||||
|
||||
When you search for your EV3 using Visual Studio Code, you see all EV3 Bricks
|
||||
listed by their name. By default, all EV3 Bricks are named *ev3dev*. Follow
|
||||
these steps to change that name:
|
||||
|
||||
1. Open Visual Studio Code and connect to your EV3 as usual.
|
||||
2. Read the steps above about running commands as an administrator.
|
||||
3. Think of a good name. In this example, we'll
|
||||
call it ``autonomous-vehicle2``
|
||||
4. Enter the following command and press enter::
|
||||
|
||||
sudo hostnamectl set-hostname autonomous-vehicle2
|
||||
|
||||
5. Reboot the EV3 Brick for the change to take effect.
|
||||
6. You may need to reboot your computer as well.
|
||||
|
||||
EV3 Brick names should only contain lowercase letters ``a`` through ``z``,
|
||||
the digits ``0`` through ``9``, and the hyphen ``-``. It must start with a
|
||||
letter or digit. It cannot include spaces or other symbols.
|
||||
|
||||
.. _ev3dev: https://www.ev3dev.org/
|
||||
.. _The Linux Command Line: http://linuxcommand.org/tlcl.php
|
||||
@@ -1,166 +0,0 @@
|
||||
Creating and running programs
|
||||
=============================
|
||||
|
||||
Now that you've set up your computer and EV3 Brick, you're ready to start
|
||||
writing programs.
|
||||
|
||||
To make it easier to create and manage your programs, let's first have a quick
|
||||
look at how MicroPython projects and programs for your EV3 robots are
|
||||
organized.
|
||||
|
||||
Programs are organized into *project folders*, as shown in
|
||||
:numref:`fig_projectstructure`. A project folder is a directory on your
|
||||
computer that contains the main program (**main.py**) and other optional
|
||||
scripts or files. This project folder and all of its contents will be copied
|
||||
to the EV3 Brick, where the main program will be run.
|
||||
|
||||
This page shows you how to create such a project and how to transfer it to the
|
||||
EV3 Brick.
|
||||
|
||||
.. _fig_projectstructure:
|
||||
|
||||
.. figure:: ../../api/images/projectstructure_label.png
|
||||
:width: 100 %
|
||||
:alt: projectstructure
|
||||
:align: center
|
||||
|
||||
A project contains a program called **main.py** and optional resources like
|
||||
sounds or MicroPython modules.
|
||||
|
||||
|
||||
Creating a new project
|
||||
-----------------------------------------------------------
|
||||
|
||||
To create a new project, open the EV3 MicroPython tab and
|
||||
click *create a new project*, as shown in :numref:`fig_newproject`. Enter a
|
||||
project name in the text field that appears and press *Enter*. When prompted,
|
||||
choose a location for this program and confirm by clicking *choose folder*.
|
||||
|
||||
.. _fig_newproject:
|
||||
|
||||
.. figure:: ../../api/images/newproject_label.png
|
||||
:width: 100 %
|
||||
:alt: newproject
|
||||
:align: center
|
||||
|
||||
Creating a new project. This example is called *getting_started*, but you
|
||||
can choose any name.
|
||||
|
||||
When you create a new project, it already includes a file called *main.py*. To
|
||||
see its contents and to modify it, open it from the file browser as shown in
|
||||
:numref:`fig_projectoverview`. This is where you'll write your programs.
|
||||
|
||||
If you are new to MicroPython programming, we recommend that you keep the
|
||||
existing code in place and add your code to it.
|
||||
|
||||
.. _fig_projectoverview:
|
||||
|
||||
.. figure:: ../../api/images/projectoverview_label.png
|
||||
:width: 100 %
|
||||
:alt: projectoverview
|
||||
:align: center
|
||||
|
||||
Opening the default *main.py* program.
|
||||
|
||||
Opening an existing project
|
||||
-----------------------------------------------------------
|
||||
|
||||
To open a project you created previously, click *File* and click
|
||||
*Open Folder*, as shown in :numref:`fig_existingproject`. Next, navigate to
|
||||
your previously created project folder and click *OK*. You can also open your
|
||||
recently used projects using the *Open Recent* menu option.
|
||||
|
||||
.. _fig_existingproject:
|
||||
|
||||
.. figure:: ../../api/images/existingproject_label.png
|
||||
:width: 75 %
|
||||
:alt: existingproject
|
||||
:align: center
|
||||
|
||||
Opening a previously created project.
|
||||
|
||||
|
||||
Connecting to the EV3 Brick with Visual Studio Code
|
||||
-----------------------------------------------------------
|
||||
|
||||
To be able to transfer your code to the EV3 Brick, you'll first need to
|
||||
connect the EV3 Brick to your computer with the mini-USB cable and configure
|
||||
the connection with Visual Studio Code. To do so:
|
||||
|
||||
- Turn the EV3 Brick on
|
||||
- Connect the EV3 Brick to your computer with the mini-USB cable
|
||||
- Configure the USB connection as shown in :numref:`fig_connecting`.
|
||||
|
||||
.. _fig_connecting:
|
||||
|
||||
.. figure:: ../../api/images/connecting_label.png
|
||||
:width: 100 %
|
||||
:alt: connecting
|
||||
:align: center
|
||||
|
||||
Configuring the USB connection between the computer and the EV3 Brick
|
||||
|
||||
Downloading and running a program
|
||||
-----------------------------------------------------------
|
||||
|
||||
You can press the F5 key to run the program. Alternatively, you can start it
|
||||
manually by going to the *debug* tab and clicking the green start arrow, as
|
||||
shown in :numref:`fig_running`.
|
||||
|
||||
When the program starts, a pop-up toolbar allows you to stop the program if
|
||||
necessary. You can also stop the program at any time using the back button on
|
||||
the EV3 Brick.
|
||||
|
||||
If your program produces any output with the ``print`` command, this is shown
|
||||
in the output window.
|
||||
|
||||
.. _fig_running:
|
||||
|
||||
.. figure:: ../../api/images/running_label.png
|
||||
:width: 100 %
|
||||
:alt: running
|
||||
:align: center
|
||||
|
||||
Running a program
|
||||
|
||||
Expanding the example program
|
||||
-----------------------------------------------------------
|
||||
|
||||
Now that you've run the basic code template, you can expand the program to
|
||||
make a motor move. First, attach a Large Motor to Port B on the EV3 Brick,
|
||||
as shown in :numref:`fig_firstprogram`.
|
||||
|
||||
.. _fig_firstprogram:
|
||||
|
||||
.. figure:: ../../api/images/firstprogram_label.png
|
||||
:width: 100 %
|
||||
:alt: firstprogram
|
||||
:align: center
|
||||
|
||||
The EV3 Brick with a Large Motor attached to port B.
|
||||
|
||||
Next, edit *main.py* to make it look like this:
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/getting_started/main.py
|
||||
|
||||
This program makes your robot beep, rotate the motor, and beep again with a
|
||||
higher pitched tone. Run the program to make sure that it works as expected.
|
||||
|
||||
.. _managefiles:
|
||||
|
||||
Managing files on the EV3 Brick
|
||||
-----------------------------------------------------------
|
||||
|
||||
After you've downloaded a project to the EV3 Brick, you can run, delete, or
|
||||
back up programs stored on it using the device browser as shown in
|
||||
:numref:`fig_files`.
|
||||
|
||||
.. _fig_files:
|
||||
|
||||
.. figure:: ../../api/images/files_label.png
|
||||
:width: 100 %
|
||||
:alt: files
|
||||
:align: center
|
||||
|
||||
Using the EV3 device browser to manage files on your EV3 Brick
|
||||
@@ -1,248 +0,0 @@
|
||||
Upgrading from v1.0 to v2.0
|
||||
===============================
|
||||
|
||||
*EV3 MicroPython version 2.0 was released on May 18, 2020.*
|
||||
|
||||
This section is for users who have previously used LEGO MINDSTORMS EV3
|
||||
MicroPython v1.0. We'll explain what's changed and how you can upgrade to
|
||||
benefit from the latest improvements.
|
||||
|
||||
If you are a new user and you just got started using version 2.0, you can skip
|
||||
this page.
|
||||
|
||||
Upgrading the microSD Card
|
||||
-----------------------------------------
|
||||
|
||||
To upgrade, download the latest microSD card file and install it using the
|
||||
standard :ref:`instructions <prepsdcard>`.
|
||||
|
||||
Note that this will erase all your existing files on the SD Card. Before you
|
||||
upgrade, make sure that you still have all your projects on your computer.
|
||||
If not, you can upload files back to your computer using
|
||||
:ref:`these instructions <managefiles>`.
|
||||
|
||||
As with any software update, *be careful about when you update*. For example,
|
||||
if you developed your code using version v1.0 and you are halfway into your
|
||||
robotics competition season, you may want to stick with v1.0 for now.
|
||||
|
||||
|
||||
Upgrading your existing programs
|
||||
-----------------------------------------
|
||||
|
||||
Most changes in v2.0 are *new* features, like support for additional sensors.
|
||||
Naturally, this will not affect your existing code.
|
||||
However, some changes were made to existing features to improve performance.
|
||||
|
||||
All originally documented features in v1.0 will still work after you upgrade.
|
||||
This means that most programs originally made for v1.0 will work with the v2.0
|
||||
microSD card image without any changes.
|
||||
|
||||
To try this, simply download and run your original code as you did before.
|
||||
|
||||
However, it is recommended that you upgrade both the microSD card and your
|
||||
programs at the same time to ensure everything works as expected.
|
||||
|
||||
The new EV3Brick() class replaces the ev3brick module
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Version 2.0 introduces the :class:`EV3Brick() <pybricks.hubs.EV3Brick>` class.
|
||||
You can use it instead of the old ``ev3brick`` module. The old ``ev3brick``
|
||||
module can still be used, but it is no longer recommended or documented.
|
||||
|
||||
The :class:`EV3Brick() <pybricks.hubs.EV3Brick>` class improves the speed and
|
||||
reliability of the EV3 screen and the EV3 speaker. It also adds functionality
|
||||
like speech and drawing shapes. The default
|
||||
font size is also bigger to make it easier to read text on the screen.
|
||||
|
||||
You can use
|
||||
the following table as a starting point to upgrade your scripts. See the
|
||||
:class:`EV3Brick() <pybricks.hubs.EV3Brick>` class documentation for
|
||||
complete details of all methods and arguments.
|
||||
|
||||
.. list-table::
|
||||
|
||||
* - **Action**
|
||||
- **v1.0**
|
||||
- **v2.0**
|
||||
|
||||
* - | Initialize
|
||||
| your EV3
|
||||
- ::
|
||||
|
||||
from pybricks import ev3brick as brick
|
||||
- ::
|
||||
|
||||
from pybricks.hubs import EV3Brick
|
||||
|
||||
ev3 = EV3Brick()
|
||||
|
||||
* - | Light on
|
||||
- ::
|
||||
|
||||
brick.light(Color.RED)
|
||||
- ::
|
||||
|
||||
ev3.light.on(Color.RED)
|
||||
|
||||
* - | Light off
|
||||
- ::
|
||||
|
||||
brick.light(None)
|
||||
- ::
|
||||
|
||||
ev3.light.off()
|
||||
|
||||
* - | Read
|
||||
| Buttons
|
||||
- ::
|
||||
|
||||
if Button.LEFT in brick.buttons():
|
||||
print("Left is pressed.")
|
||||
- ::
|
||||
|
||||
if Button.LEFT in ev3.buttons.pressed():
|
||||
print("Left is pressed.")
|
||||
|
||||
* - | Play a
|
||||
| beep
|
||||
- ::
|
||||
|
||||
brick.sound.beep()
|
||||
- ::
|
||||
|
||||
ev3.speaker.beep()
|
||||
|
||||
* - | Play a
|
||||
| sound file
|
||||
- ::
|
||||
|
||||
brick.sound.file(SoundFile.HELLO)
|
||||
- ::
|
||||
|
||||
ev3.speaker.play_file(SoundFile.HELLO)
|
||||
|
||||
* - | Text to
|
||||
| speech
|
||||
-
|
||||
- ::
|
||||
|
||||
ev3.speaker.say("I can say anything!")
|
||||
|
||||
* - | Play
|
||||
| notes
|
||||
-
|
||||
- ::
|
||||
|
||||
ev3.speaker.play_notes(['C4/4', 'G4/4'])
|
||||
|
||||
* - | Write text
|
||||
| at a given
|
||||
| position
|
||||
- ::
|
||||
|
||||
brick.display.text("Hello!", (50, 60))
|
||||
- ::
|
||||
|
||||
ev3.screen.draw_text(50, 60, "Hello!")
|
||||
|
||||
* - | Write text
|
||||
| and scroll
|
||||
| automatically
|
||||
- ::
|
||||
|
||||
brick.display.text("Hello")
|
||||
brick.display.text("world!")
|
||||
- ::
|
||||
|
||||
ev3.screen.print("Hello")
|
||||
ev3.screen.print("world!")
|
||||
|
||||
* - | Change font
|
||||
| size
|
||||
-
|
||||
- ::
|
||||
|
||||
from pybricks.media.ev3dev import Font
|
||||
|
||||
big_font = Font(size=24)
|
||||
ev3.screen.set_font(big_font)
|
||||
|
||||
* - | Display an
|
||||
| image on
|
||||
| the screen
|
||||
- ::
|
||||
|
||||
from pybricks.parameters import ImageFile
|
||||
|
||||
brick.display.image(ImageFile.QUESTION_MARK)
|
||||
- ::
|
||||
|
||||
from pybricks.media.ev3dev import ImageFile
|
||||
|
||||
ev3.screen.load_image(ImageFile.Question_MARK)
|
||||
|
||||
* - | Draw shapes
|
||||
| on the screen
|
||||
-
|
||||
- ::
|
||||
|
||||
ev3.screen.draw_line(30, 30, 30, 100)
|
||||
ev3.screen.draw_box(50, 30, 90, 60)
|
||||
ev3.screen.draw_circle(70, 90, 20, fill=True)
|
||||
|
||||
* - | Read
|
||||
| battery
|
||||
| voltage
|
||||
- ::
|
||||
|
||||
brick.battery.voltage()
|
||||
- ::
|
||||
|
||||
ev3.battery.voltage()
|
||||
|
||||
|
||||
Other internal changes to existing features
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Most methods of the ``Motor`` class now
|
||||
have ``Stop.HOLD`` as the default instead of ``Stop.COAST``. This improves
|
||||
accuracy in most applications. You can still select ``Stop.COAST`` if you
|
||||
like.
|
||||
- The internal PID controllers for the motors are more accurate than before.
|
||||
If you give a motor command when it is already running, it smoothly adjusts
|
||||
the speed to the newly given command. This works even if you keep
|
||||
adjusting the speed in a fast loop.
|
||||
- Methods to configure motor settings have changed. You can change settings
|
||||
using the ``control`` attribute now. The old settings setters
|
||||
continue to exist in the implementation, but they are no longer documented.
|
||||
- So-called Python *keyword arguments* are now supported. Previously, you
|
||||
could only enter the argument *values*. For example:
|
||||
|
||||
::
|
||||
|
||||
my_motor.run_angle(500, 90, Stop.HOLD, False)
|
||||
|
||||
This is still possible. But you can now choose to omit optional arguments
|
||||
and specify others with *keywords*. This can make your code easier to read.
|
||||
For example:
|
||||
|
||||
::
|
||||
|
||||
my_motor.run_angle(500, 90, wait=False)
|
||||
- It is no longer necessary to import ``pybricks.tools.print``. The ``print``
|
||||
function is now built-in. It works just like Python or MicroPython.
|
||||
- Most parameters in the :mod:`parameters <pybricks.parameters>` now have a
|
||||
specific type and representation. For example, suppose you measure a color
|
||||
and print the result. If you do ``print(Color.RED)``, you will see the
|
||||
parameter instead of a technical number.
|
||||
- Sound and image files have moved to a dedicated ``media`` module.
|
||||
Importing them from the old location will continue to work in this release,
|
||||
to make sure existing scripts will still work.
|
||||
|
||||
**Installing an older version of the Visual Studio Code extension**
|
||||
|
||||
The Visual Studio Code extension and this documentation are updated
|
||||
automatically. You can still use your existing scripts with the updated
|
||||
extension. If you absolutely wish to keep the old version, look for the EV3
|
||||
extension on the extension tab, click the gear icon, and
|
||||
click *install another version*.
|
||||
@@ -1,4 +0,0 @@
|
||||
SPIKE Prime / Robot Inventor
|
||||
########################################################
|
||||
|
||||
Coming soon!
|
||||
@@ -1,176 +0,0 @@
|
||||
.. _pupguide:
|
||||
|
||||
Powered Up
|
||||
########################
|
||||
|
||||
.. figure:: ../api/images/powereduphubs.png
|
||||
:height: 15 em
|
||||
:align: center
|
||||
|
||||
This page shows how you can install Pybricks on the BOOST Move Hub, the City
|
||||
Hub, and the Technic Hub using the `Pybricks Code`_ interface.
|
||||
|
||||
You can reinstall the :ref:`original firmware <restoring>` at any time
|
||||
using the official Powered Up app.
|
||||
|
||||
1. Requirements
|
||||
--------------------------------------
|
||||
|
||||
* A BOOST Move Hub, City Hub, or Technic Hub.
|
||||
* A Windows, Mac, Linux, or Android device.
|
||||
* Bluetooth Low Energy (BLE). Make sure that Bluetooth is switched on.
|
||||
|
||||
If you don't have BLE, the coding interface will inform you during the
|
||||
installation step. In that case, you can try using a low-cost USB Bluetooth
|
||||
Dongle thats support Bluetooth Low Energy.
|
||||
|
||||
2. Installing a compatible browser
|
||||
---------------------------------------------------
|
||||
|
||||
Writing Pybricks programs requires a web browser with web Bluetooth
|
||||
functionality, such as:
|
||||
|
||||
* `Google Chrome`_
|
||||
* `Microsoft Edge`_
|
||||
* Chromium
|
||||
|
||||
If you use Linux, enable *Experimental Web Platform features* on
|
||||
the ``chrome://flags/`` page. On Windows and Mac, this is already enabled.
|
||||
|
||||
3. Installing the Pybricks firmware
|
||||
-----------------------------------
|
||||
|
||||
Before you begin, turn the hub off. The update works best with fresh batteries.
|
||||
If you use the City Hub, you must unplug all motors and sensors. Follow these
|
||||
steps:
|
||||
|
||||
1. Go to `Pybricks Code`_.
|
||||
2. Press and hold the green button, and wait for the light to start blinking.
|
||||
3. While you hold it, click the firmware update button.
|
||||
4. Select the ``LEGO Bootloader`` and click *Pair*.
|
||||
5. Wait until the light goes off and until it blinks red/green/blue again.
|
||||
6. You may now release the button and wait for the installation to finish.
|
||||
|
||||
These steps are summarized in this video:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<video controls src="https://pybricks.com/wp-content/uploads/2020/06/install.mp4" width="100%"></video>
|
||||
<br /><br />
|
||||
|
||||
|
||||
4. Running programs
|
||||
--------------------------------
|
||||
|
||||
Once the firmware is installed, you can start coding! Use the *Bluetooth*
|
||||
button to connect to your *Pybricks Hub*. Then press run to
|
||||
start your program.
|
||||
|
||||
.. figure:: ../api/images/pybrickscode.png
|
||||
|
||||
To get started, just copy and paste this snippet::
|
||||
|
||||
from pybricks.pupdevices import Motor
|
||||
from pybricks.parameters import Port, Stop
|
||||
from pybricks.tools import wait
|
||||
|
||||
# We'll use two motors. One is a dial
|
||||
# to set the speed of the other motor.
|
||||
motor = Motor(Port.B)
|
||||
dial = Motor(Port.A)
|
||||
|
||||
# Say hello :)
|
||||
print("Hello, Pybricks!")
|
||||
|
||||
# First, we'll move the dial to zero.
|
||||
dial.run_target(500, 0, Stop.COAST)
|
||||
|
||||
while True:
|
||||
# Set the speed based on dial angle
|
||||
speed = dial.angle()*3
|
||||
if abs(speed) < 100:
|
||||
speed = 0
|
||||
|
||||
# Run motor at desired speed
|
||||
motor.run(speed)
|
||||
|
||||
# Wait briefly, then repeat
|
||||
wait(10)
|
||||
|
||||
5. Next steps
|
||||
-----------------------------------------
|
||||
|
||||
Now that you've learned how to install Pybricks and run programs, check out
|
||||
the steps below to make Pybricks coding even easier. We'll also show you how
|
||||
you can restore the original firmware.
|
||||
|
||||
Saving a program on the hub
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The Move Hub, City Hub, and Technic Hub do not have separate storage space
|
||||
for user programs. This means your program is erased after it is done running.
|
||||
Fortunately, you can still save one program on the hub, by including it in the
|
||||
firmware. To do so:
|
||||
|
||||
1. Open the settings tab with the ⚙ icon.
|
||||
2. Activate the *Include current program* switch.
|
||||
3. Update the firmware as you did before. Now, your current program will be
|
||||
included.
|
||||
4. Now can start and stop your program with the green button.
|
||||
No connection required!
|
||||
5. You can still download and run new programs with the run button as usual.
|
||||
|
||||
This is a bit of a slow process to do each time. We recommend to
|
||||
use the run button to run your code most of the time. When you are
|
||||
happy with your final program, follow the steps above to save it on the hub.
|
||||
|
||||
Using Pybricks offline
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Instead of working in your browser, you can install Pybricks locally:
|
||||
|
||||
1. Open the settings tab with the ⚙ icon.
|
||||
2. Click on *Install as App* and follow the on-screen instructions.
|
||||
|
||||
To uninstall, click the ⋮ menu in the top and
|
||||
click *Uninstall*. Note that this only removes the app from your computer.
|
||||
To restore the original firmware on the hub, see the next section.
|
||||
|
||||
.. _restoring:
|
||||
|
||||
Restoring the original firmware
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Pybricks uses the same update procedure as the LEGO apps. The only difference
|
||||
is which firmware file we upload. This means you can go back to the original
|
||||
firmware any time. As shown in the video below, just put the hub in update mode
|
||||
and connect using a LEGO app.
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<video controls src="https://pybricks.com/wp-content/uploads/2020/06/restore.mp4" width="100%"></video>
|
||||
|
||||
This video shows the Powered Up app in *create* mode. It has firmware for all
|
||||
hubs. As usual, you may need to restart the app to detect the hub. If it fails,
|
||||
try again with fresh batteries.
|
||||
|
||||
Installing the latest build
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. warning::
|
||||
|
||||
This section is only intended for developers who want to try the
|
||||
latest features. Some features may not work when you do this. To revert
|
||||
to a stable version, just install the firmware as you normally would.
|
||||
|
||||
Pybricks Code automatically provides the latest stable and tested firmware.
|
||||
To get a more recent version, log in to GitHub and go to our `latest builds`_.
|
||||
Click on the desired build and go to `Artifacts`.
|
||||
Download the firmware ZIP archive for your hub. To install it, drag this file
|
||||
*onto* the firmware update button in Pybricks Code. The update now proceeds as
|
||||
usual.
|
||||
|
||||
.. _latest builds: https://github.com/pybricks/pybricks-micropython/actions?query=is%3Asuccess+branch%3Amaster+workflow%3ABuild
|
||||
.. _support page: https://github.com/pybricks/support/issues/
|
||||
.. _Pybricks Code: http://code.pybricks.com/
|
||||
.. _Google Chrome: https://www.google.com/chrome/
|
||||
.. _Microsoft Edge: https://www.microsoft.com/en-us/edge
|
||||
@@ -13,7 +13,7 @@ At the moment, this class is only available on EV3.
|
||||
use this class on 13 February 2020 on 10:07 and 44.431260
|
||||
seconds, the file is called ``log_2020_02_13_10_07_44_431260.csv``.
|
||||
|
||||
See :ref:`managing files on the EV3 <managefiles>` to learn how to upload
|
||||
See `managing files on the EV3`_ to learn how to upload
|
||||
the log file back to your computer.
|
||||
|
||||
|
||||
@@ -71,3 +71,5 @@ name will always be the same. However, this means that the contents of
|
||||
``my_file.txt`` will be overwritten every time you run this script.
|
||||
|
||||
.. literalinclude:: ../../../examples/ev3/datalog_extra/main.py
|
||||
|
||||
.. _managing files on the EV3: https://pybricks.com/install/mindstorms-ev3/running-programs#managing-files-on-the-ev3-brick
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Since Pybricks Code is an "app", all external links get opened in new tab/window
|
||||
// https://stackoverflow.com/a/62742435/1976323
|
||||
$(document).ready(function () {
|
||||
$('a[href^="http://"], a[href^="https://"]').not('a[class*=internal]').attr('target', '_blank');
|
||||
+1
-6
@@ -91,7 +91,7 @@ version = re.match(r'(v\d+\.\d+)', release)[0]
|
||||
language = None
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'xcode'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
@@ -147,11 +147,6 @@ else:
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# a little extra javascript
|
||||
html_js_files = [
|
||||
'js/custom.js'
|
||||
]
|
||||
|
||||
html_context = {
|
||||
'disclaimer': _DISCLAIMER,
|
||||
}
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
# 1.3.3 - 2021-05-21
|
||||
|
||||
## Changed:
|
||||
- Match example snippet styling to IDE.
|
||||
- Add more examples.
|
||||
|
||||
# 1.3.2 - 2021-04-26
|
||||
|
||||
## Changed:
|
||||
- Theme style fixes.
|
||||
- Example code fixes
|
||||
- Match doc version to firmware version.
|
||||
|
||||
# 1.3.1 - 2021-04-12
|
||||
|
||||
## Changed:
|
||||
- Upgrade sphinx and rtd-theme to fix style issues.
|
||||
|
||||
# 1.3.0 - 2021-04-12
|
||||
|
||||
## Removed:
|
||||
- Removed features which not be in the official 3.0 release. These features
|
||||
are still in beta. They'll come back in future releases once tested.
|
||||
|
||||
# 1.2.0 - 2021-04-09
|
||||
|
||||
## Changed:
|
||||
- Moved installation guide to external site.
|
||||
|
||||
# 1.1.1 - 2021-02-14
|
||||
|
||||
## Added:
|
||||
|
||||
@@ -18,6 +18,7 @@ html_logo = '../common/images/pybricks-logo-rtd.png'
|
||||
html_show_copyright = False
|
||||
html_show_sphinx = False
|
||||
html_css_files = ['css/ide.css']
|
||||
html_js_files = ['js/ide.js']
|
||||
|
||||
imgmath_image_format = 'svg'
|
||||
imgmath_use_preview = True # requires Sphinx v3
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../api/geometry.rst
|
||||
@@ -10,7 +10,6 @@
|
||||
movehub
|
||||
cityhub
|
||||
technichub
|
||||
primehub
|
||||
|
||||
.. pybricks-classlink:: MoveHub
|
||||
|
||||
@@ -30,14 +29,3 @@
|
||||
:height: 10 em
|
||||
:target: technichub.html
|
||||
|
||||
.. pybricks-classlink:: PrimeHub
|
||||
|
||||
.. figure:: ../../api/images/primehub.png
|
||||
:height: 10 em
|
||||
:target: primehub.html
|
||||
|
||||
.. pybricks-classlink:: InventorHub
|
||||
|
||||
.. figure:: ../../api/images/inventorhub.png
|
||||
:height: 10 em
|
||||
:target: primehub.html
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../../api/hubs/primehub.rst
|
||||
+6
-13
@@ -1,13 +1,6 @@
|
||||
Pybricks Documentation
|
||||
==================================================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Getting started
|
||||
:hidden:
|
||||
|
||||
start_pup
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Pybricks Modules
|
||||
@@ -19,7 +12,6 @@ Pybricks Documentation
|
||||
parameters/index
|
||||
tools/index
|
||||
robotics
|
||||
geometry
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -29,16 +21,15 @@ Pybricks Documentation
|
||||
signaltypes
|
||||
motors
|
||||
|
||||
To begin, install the Pybricks firmware on your hub. Check
|
||||
`pybricks.com/install`_ to learn how.
|
||||
|
||||
Use the ☰ menu to navigate all available classes, methods, and tools. A few
|
||||
commonly used devices and classes are listed below for quick reference.
|
||||
|
||||
.. rubric:: Installation
|
||||
|
||||
Click :ref:`to jump to the installation guide <pupguide>`.
|
||||
|
||||
.. rubric:: Programmable Hubs
|
||||
|
||||
.. figure:: ../api/images/hubsoverview.png
|
||||
.. figure:: ../api/images/powereduphubs.png
|
||||
:width: 100 %
|
||||
:target: hubs/index.html
|
||||
|
||||
@@ -47,3 +38,5 @@ Click :ref:`to jump to the installation guide <pupguide>`.
|
||||
.. figure:: ../api/images/pupdevicesoverview.png
|
||||
:width: 100 %
|
||||
:target: pupdevices/index.html
|
||||
|
||||
.. _pybricks.com/install: https://pybricks.com/install/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/ide-docs",
|
||||
"version": "1.1.1",
|
||||
"version": "1.3.3",
|
||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../../api/parameters/button.rst
|
||||
@@ -1 +1,23 @@
|
||||
.. include:: ../../api/parameters/index.rst
|
||||
:mod:`parameters <pybricks.parameters>` -- Parameters and Constants
|
||||
===================================================================
|
||||
|
||||
.. automodule:: pybricks.parameters
|
||||
:no-members:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:hidden:
|
||||
|
||||
color
|
||||
direction
|
||||
port
|
||||
stop
|
||||
|
||||
.. pybricks-classlink:: Color
|
||||
|
||||
.. pybricks-classlink:: Direction
|
||||
|
||||
.. pybricks-classlink:: Port
|
||||
|
||||
.. pybricks-classlink:: Stop
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../../api/parameters/side.rst
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../../api/pupdevices/remote.rst
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../api/start_pup.rst
|
||||
@@ -13,7 +13,7 @@ device = I2CDevice(Port.S2, 0xD2 >> 1)
|
||||
# For this device, we can read the Who Am I
|
||||
# register (0x0F) for the expected value: 211.
|
||||
if 211 not in device.read(0x0F):
|
||||
raise OSError("Device is not attached")
|
||||
raise ValueError("Unexpected I2C device ID")
|
||||
|
||||
# To write data, create a bytes object of one
|
||||
# or more bytes. For example:
|
||||
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = CityHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from pybricks.hubs import MoveHub
|
||||
from pybricks.tools import wait
|
||||
|
||||
# Initialize the hub.
|
||||
hub = MoveHub()
|
||||
|
||||
# Get the acceleration tuple.
|
||||
print(hub.imu.acceleration())
|
||||
|
||||
while True:
|
||||
# Get individual acceleration values.
|
||||
x, y, z = hub.imu.acceleration()
|
||||
print(x, y, z)
|
||||
|
||||
# Wait so we can see what we printed.
|
||||
wait(100)
|
||||
@@ -0,0 +1,29 @@
|
||||
from pybricks.hubs import MoveHub
|
||||
from pybricks.parameters import Color, Side
|
||||
from pybricks.tools import wait
|
||||
|
||||
# Initialize the hub.
|
||||
hub = MoveHub()
|
||||
|
||||
# Define colors for each side in a dictionary.
|
||||
SIDE_COLORS = {
|
||||
Side.TOP: Color.RED,
|
||||
Side.BOTTOM: Color.BLUE,
|
||||
Side.LEFT: Color.GREEN,
|
||||
Side.RIGHT: Color.YELLOW,
|
||||
Side.FRONT: Color.MAGENTA,
|
||||
Side.BACK: Color.BLACK,
|
||||
}
|
||||
|
||||
# Keep updating the color based on detected up side.
|
||||
while True:
|
||||
|
||||
# Check which side of the hub is up.
|
||||
up_side = hub.imu.up()
|
||||
|
||||
# Change the color based on the side.
|
||||
hub.light.on(SIDE_COLORS[up_side])
|
||||
|
||||
# Also print the result.
|
||||
print(up_side)
|
||||
wait(50)
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = PrimeHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# ExampleHub = TechnicHub PrimeHub
|
||||
# ExampleHub = TechnicHub PrimeHub MoveHub
|
||||
from pybricks.hubs import ExampleHub
|
||||
from pybricks.parameters import Color, Side
|
||||
from pybricks.tools import wait
|
||||
|
||||
@@ -8,7 +8,7 @@ from math import sin, pi
|
||||
hub = ExampleHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from math import sin, pi
|
||||
hub = TechnicHub()
|
||||
|
||||
# Make an animation with multiple colors.
|
||||
hub.light.animate([Color.RED, Color.GREEN, None], interval=500)
|
||||
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=500)
|
||||
|
||||
wait(10000)
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
from pybricks.iodevices import PUPDevice
|
||||
from pybricks.parameters import Port
|
||||
from uerrno import ENODEV
|
||||
|
||||
# Dictionary of device identifiers along with their name.
|
||||
device_names = {
|
||||
34: "Wedo 2.0 Tilt Sensor",
|
||||
35: "Wedo 2.0 Infrared Sensor",
|
||||
37: "BOOST Color Distance Sensor",
|
||||
38: "BOOST Interactive Motor",
|
||||
46: "Technic Large Motor",
|
||||
47: "Technic Extra Large Motor",
|
||||
48: "SPIKE Medium Angular Motor",
|
||||
49: "SPIKE Large Angular Motor",
|
||||
61: "SPIKE Color Sensor",
|
||||
62: "SPIKE Ultrasonic Sensor",
|
||||
63: "SPIKE Force Sensor",
|
||||
75: "Technic Medium Angular Motor",
|
||||
76: "Technic Large Angular Motor",
|
||||
}
|
||||
|
||||
# Make a list of known ports.
|
||||
ports = [Port.A, Port.B]
|
||||
|
||||
# On hubs that support it, add more ports.
|
||||
try:
|
||||
ports.append(Port.C)
|
||||
ports.append(Port.D)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# On hubs that support it, add more ports.
|
||||
try:
|
||||
ports.append(Port.E)
|
||||
ports.append(Port.F)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# Go through all available ports.
|
||||
for port in ports:
|
||||
|
||||
# Try to get the device, if it is attached.
|
||||
try:
|
||||
device = PUPDevice(port)
|
||||
except OSError as ex:
|
||||
if ex.args[0] == ENODEV:
|
||||
# No device found on this port.
|
||||
print(port, ": ---")
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
|
||||
# Get the device id
|
||||
id = device.info()['id']
|
||||
|
||||
# Look up the name.
|
||||
try:
|
||||
print(port, ":", device_names[id])
|
||||
except KeyError:
|
||||
print(port, ":", "Unknown device with ID", id)
|
||||
@@ -0,0 +1,13 @@
|
||||
from pybricks.pupdevices import DCMotor
|
||||
from pybricks.parameters import Port
|
||||
from pybricks.tools import wait
|
||||
|
||||
# Initialize the motor.
|
||||
train_motor = DCMotor(Port.A)
|
||||
|
||||
# Choose the "power" level for your train. Negative means reverse.
|
||||
train_motor.dc(50)
|
||||
|
||||
# Keep doing nothing. The train just keeps going.
|
||||
while True:
|
||||
wait(1000)
|
||||
@@ -5,26 +5,22 @@ from pybricks.tools import wait
|
||||
# Initialize the sensor.
|
||||
sensor = ColorSensor(Port.A)
|
||||
|
||||
# First, decide which objects you want to detect.
|
||||
# Then measure their color with the hsv() method,
|
||||
# as shown in the previous example. Write them down
|
||||
# as shown below. The name is optional, but it is
|
||||
# useful when you print the color value.
|
||||
green = Color(h=132, s=94, v=26, name='GREEN_BRICK')
|
||||
magenta = Color(h=348, s=96, v=40, name='MAGENTA_BRICK')
|
||||
brown = Color(h=17, s=78, v=15, name='BROWN_BRICK')
|
||||
red = Color(h=359, s=97, v=39, name='RED_BRICK')
|
||||
# First, decide which objects you want to detect, and measure their HSV values.
|
||||
# You can do that with the hsv() method as shown in the previous example.
|
||||
#
|
||||
# Use your measurements to override the default colors, or add new colors:
|
||||
Color.GREEN = Color(h=132, s=94, v=26)
|
||||
Color.MAGENTA = Color(h=348, s=96, v=40)
|
||||
Color.BROWN = Color(h=17, s=78, v=15)
|
||||
Color.RED = Color(h=359, s=97, v=39)
|
||||
|
||||
# Put your colors in a list or tuple.
|
||||
# Including None is optional. Just omit it if
|
||||
# you always want to get one of your colors.
|
||||
my_colors = (green, magenta, brown, red, None)
|
||||
my_colors = (Color.GREEN, Color.MAGENTA, Color.BROWN, Color.RED, Color.NONE)
|
||||
|
||||
# Save your colors.
|
||||
sensor.detectable_colors(my_colors)
|
||||
|
||||
# color() works as usual, but it only
|
||||
# returns one of your specified colors.
|
||||
# color() works as usual, but now it returns one of your specified colors.
|
||||
while True:
|
||||
color = sensor.color()
|
||||
|
||||
@@ -32,7 +28,7 @@ while True:
|
||||
print(color)
|
||||
|
||||
# Check which one it is.
|
||||
if color == magenta:
|
||||
if color == Color.MAGENTA:
|
||||
print("It works!")
|
||||
|
||||
# Wait so we can read it.
|
||||
|
||||
@@ -11,11 +11,11 @@ while True:
|
||||
# Turn on one light at a time, at half the brightness.
|
||||
# Do this for all 3 lights and repeat that 5 times.
|
||||
for i in range(5):
|
||||
sensor.lights.on(50, 0, 0)
|
||||
sensor.lights.on([50, 0, 0])
|
||||
wait(100)
|
||||
sensor.lights.on(0, 50, 0)
|
||||
sensor.lights.on([0, 50, 0])
|
||||
wait(100)
|
||||
sensor.lights.on(0, 0, 50)
|
||||
sensor.lights.on([0, 0, 50])
|
||||
wait(100)
|
||||
|
||||
# Turn all lights on at maximum brightness.
|
||||
|
||||
@@ -5,26 +5,22 @@ from pybricks.tools import wait
|
||||
# Initialize the sensor.
|
||||
sensor = ColorDistanceSensor(Port.A)
|
||||
|
||||
# First, decide which objects you want to detect.
|
||||
# Then measure their color with the hsv() method,
|
||||
# as shown in the previous example. Write them down
|
||||
# as shown below. The name is optional, but it is
|
||||
# useful when you print the color value.
|
||||
green = Color(h=132, s=94, v=26, name='GREEN_BRICK')
|
||||
magenta = Color(h=348, s=96, v=40, name='MAGENTA_BRICK')
|
||||
brown = Color(h=17, s=78, v=15, name='BROWN_BRICK')
|
||||
red = Color(h=359, s=97, v=39, name='RED_BRICK')
|
||||
# First, decide which objects you want to detect, and measure their HSV values.
|
||||
# You can do that with the hsv() method as shown in the previous example.
|
||||
#
|
||||
# Use your measurements to override the default colors, or add new colors:
|
||||
Color.GREEN = Color(h=132, s=94, v=26)
|
||||
Color.MAGENTA = Color(h=348, s=96, v=40)
|
||||
Color.BROWN = Color(h=17, s=78, v=15)
|
||||
Color.RED = Color(h=359, s=97, v=39)
|
||||
|
||||
# Put your colors in a list or tuple.
|
||||
# Including None is optional. Just omit it if
|
||||
# you always want to get one of your colors.
|
||||
my_colors = (green, magenta, brown, red, None)
|
||||
my_colors = (Color.GREEN, Color.MAGENTA, Color.BROWN, Color.RED, Color.NONE)
|
||||
|
||||
# Save your colors.
|
||||
sensor.detectable_colors(my_colors)
|
||||
|
||||
# color() works as usual, but it only
|
||||
# returns one of your specified colors.
|
||||
# color() works as usual, but now it returns one of your specified colors.
|
||||
while True:
|
||||
color = sensor.color()
|
||||
|
||||
@@ -32,7 +28,7 @@ while True:
|
||||
print(color)
|
||||
|
||||
# Check which one it is.
|
||||
if color == magenta:
|
||||
if color == Color.MAGENTA:
|
||||
print("It works!")
|
||||
|
||||
# Wait so we can read it.
|
||||
|
||||
@@ -24,9 +24,8 @@ while True:
|
||||
# lights do something different.
|
||||
brightness = [sin(phase + offset*pi/2) * 50 + 50 for offset in range(4)]
|
||||
|
||||
# Set the brightness values for all lights. The * symbol unpacks the list
|
||||
# of brightness values into separate arguments.
|
||||
eyes.lights.on(*brightness)
|
||||
# Set the brightness values for all lights.
|
||||
eyes.lights.on(brightness)
|
||||
|
||||
# Wait some time.
|
||||
wait(50)
|
||||
|
||||
Generated
+100
-81
@@ -105,16 +105,16 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "flake8"
|
||||
version = "3.8.4"
|
||||
version = "3.9.0"
|
||||
description = "the modular source code checker: pep8 pyflakes and co"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||
|
||||
[package.dependencies]
|
||||
mccabe = ">=0.6.0,<0.7.0"
|
||||
pycodestyle = ">=2.6.0a1,<2.7.0"
|
||||
pyflakes = ">=2.2.0,<2.3.0"
|
||||
pycodestyle = ">=2.7.0,<2.8.0"
|
||||
pyflakes = ">=2.3.0,<2.4.0"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
@@ -134,7 +134,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "jinja2"
|
||||
version = "2.11.2"
|
||||
version = "2.11.3"
|
||||
description = "A very fast and expressive template engine."
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -172,7 +172,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "20.8"
|
||||
version = "20.9"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -199,7 +199,7 @@ python-versions = ">=2.6"
|
||||
|
||||
[[package]]
|
||||
name = "pycodestyle"
|
||||
version = "2.6.0"
|
||||
version = "2.7.0"
|
||||
description = "Python style guide checker"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -207,7 +207,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "2.2.0"
|
||||
version = "2.3.1"
|
||||
description = "passive checker of Python programs"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -215,7 +215,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.7.4"
|
||||
version = "2.8.1"
|
||||
description = "Pygments is a syntax highlighting package written in Python."
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -231,7 +231,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "pytz"
|
||||
version = "2020.5"
|
||||
version = "2021.1"
|
||||
description = "World timezone definitions, modern and historical"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -239,7 +239,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "2020.11.13"
|
||||
version = "2021.4.4"
|
||||
description = "Alternative regular expression module, to replace re."
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -261,7 +261,7 @@ urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
|
||||
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
|
||||
[[package]]
|
||||
name = "restructuredtext-lint"
|
||||
@@ -292,7 +292,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "sphinx"
|
||||
version = "3.4.3"
|
||||
version = "3.5.3"
|
||||
description = "Python documentation generator"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -318,18 +318,19 @@ sphinxcontrib-serializinghtml = "*"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinxcontrib-websupport"]
|
||||
lint = ["flake8 (>=3.5.0)", "isort", "mypy (>=0.790)", "docutils-stubs"]
|
||||
lint = ["flake8 (>=3.5.0)", "isort", "mypy (>=0.800)", "docutils-stubs"]
|
||||
test = ["pytest", "pytest-cov", "html5lib", "cython", "typed-ast"]
|
||||
|
||||
[[package]]
|
||||
name = "sphinx-rtd-theme"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
description = "Read the Docs theme for Sphinx"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[package.dependencies]
|
||||
docutils = "<0.17"
|
||||
sphinx = "*"
|
||||
|
||||
[package.extras]
|
||||
@@ -443,21 +444,21 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "1.26.2"
|
||||
version = "1.26.4"
|
||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotlipy (>=0.6.0)"]
|
||||
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
brotli = ["brotlipy (>=0.6.0)"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "4d6ac2394f202eb7b9e91a510d807c6e2f56ae61ef23c28edeb5d9feaf741fc1"
|
||||
content-hash = "72f3e4266f045ac29346409478c8545ef3199193c921ca8eb4e6143dc225e0ce"
|
||||
|
||||
[metadata.files]
|
||||
alabaster = [
|
||||
@@ -473,7 +474,6 @@ babel = [
|
||||
{file = "Babel-2.9.0.tar.gz", hash = "sha256:da031ab54472314f210b0adcff1588ee5d1d1d0ba4dbd07b94dba82bde791e05"},
|
||||
]
|
||||
black = [
|
||||
{file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"},
|
||||
{file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"},
|
||||
]
|
||||
certifi = [
|
||||
@@ -501,8 +501,8 @@ docutils = [
|
||||
{file = "docutils-0.16.tar.gz", hash = "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"},
|
||||
]
|
||||
flake8 = [
|
||||
{file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"},
|
||||
{file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"},
|
||||
{file = "flake8-3.9.0-py2.py3-none-any.whl", hash = "sha256:12d05ab02614b6aee8df7c36b97d1a3b2372761222b19b58621355e82acddcff"},
|
||||
{file = "flake8-3.9.0.tar.gz", hash = "sha256:78873e372b12b093da7b5e5ed302e8ad9e988b38b063b61ad937f26ca58fc5f0"},
|
||||
]
|
||||
idna = [
|
||||
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
|
||||
@@ -513,8 +513,8 @@ imagesize = [
|
||||
{file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"},
|
||||
]
|
||||
jinja2 = [
|
||||
{file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"},
|
||||
{file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"},
|
||||
{file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"},
|
||||
{file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"},
|
||||
]
|
||||
markupsafe = [
|
||||
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
|
||||
@@ -535,20 +535,39 @@ markupsafe = [
|
||||
{file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"},
|
||||
{file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"},
|
||||
{file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"},
|
||||
{file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"},
|
||||
{file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-win32.whl", hash = "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39"},
|
||||
{file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"},
|
||||
{file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"},
|
||||
]
|
||||
mccabe = [
|
||||
@@ -560,8 +579,8 @@ mypy-extensions = [
|
||||
{file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
|
||||
]
|
||||
packaging = [
|
||||
{file = "packaging-20.8-py2.py3-none-any.whl", hash = "sha256:24e0da08660a87484d1602c30bb4902d74816b6985b93de36926f5bc95741858"},
|
||||
{file = "packaging-20.8.tar.gz", hash = "sha256:78598185a7008a470d64526a8059de9aaa449238f280fc9eb6b13ba6c4109093"},
|
||||
{file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"},
|
||||
{file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"},
|
||||
]
|
||||
pathspec = [
|
||||
{file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"},
|
||||
@@ -572,67 +591,67 @@ pbr = [
|
||||
{file = "pbr-5.5.1.tar.gz", hash = "sha256:5fad80b613c402d5b7df7bd84812548b2a61e9977387a80a5fc5c396492b13c9"},
|
||||
]
|
||||
pycodestyle = [
|
||||
{file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"},
|
||||
{file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"},
|
||||
{file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"},
|
||||
{file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"},
|
||||
]
|
||||
pyflakes = [
|
||||
{file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"},
|
||||
{file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"},
|
||||
{file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"},
|
||||
{file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"},
|
||||
]
|
||||
pygments = [
|
||||
{file = "Pygments-2.7.4-py3-none-any.whl", hash = "sha256:bc9591213a8f0e0ca1a5e68a479b4887fdc3e75d0774e5c71c31920c427de435"},
|
||||
{file = "Pygments-2.7.4.tar.gz", hash = "sha256:df49d09b498e83c1a73128295860250b0b7edd4c723a32e9bc0d295c7c2ec337"},
|
||||
{file = "Pygments-2.8.1-py3-none-any.whl", hash = "sha256:534ef71d539ae97d4c3a4cf7d6f110f214b0e687e92f9cb9d2a3b0d3101289c8"},
|
||||
{file = "Pygments-2.8.1.tar.gz", hash = "sha256:2656e1a6edcdabf4275f9a3640db59fd5de107d88e8663c5d4e9a0fa62f77f94"},
|
||||
]
|
||||
pyparsing = [
|
||||
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
|
||||
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
|
||||
]
|
||||
pytz = [
|
||||
{file = "pytz-2020.5-py2.py3-none-any.whl", hash = "sha256:16962c5fb8db4a8f63a26646d8886e9d769b6c511543557bc84e9569fb9a9cb4"},
|
||||
{file = "pytz-2020.5.tar.gz", hash = "sha256:180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5"},
|
||||
{file = "pytz-2021.1-py2.py3-none-any.whl", hash = "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"},
|
||||
{file = "pytz-2021.1.tar.gz", hash = "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da"},
|
||||
]
|
||||
regex = [
|
||||
{file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"},
|
||||
{file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"},
|
||||
{file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"},
|
||||
{file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"},
|
||||
{file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"},
|
||||
{file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:619d71c59a78b84d7f18891fe914446d07edd48dc8328c8e149cbe0929b4e000"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:47bf5bf60cf04d72bf6055ae5927a0bd9016096bf3d742fa50d9bf9f45aa0711"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:281d2fd05555079448537fe108d79eb031b403dac622621c78944c235f3fcf11"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bd28bc2e3a772acbb07787c6308e00d9626ff89e3bfcdebe87fa5afbfdedf968"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:7c2a1af393fcc09e898beba5dd59196edaa3116191cc7257f9224beaed3e1aa0"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:c38c71df845e2aabb7fb0b920d11a1b5ac8526005e533a8920aea97efb8ec6a4"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:96fcd1888ab4d03adfc9303a7b3c0bd78c5412b2bfbe76db5b56d9eae004907a"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:ade17eb5d643b7fead300a1641e9f45401c98eee23763e9ed66a43f92f20b4a7"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-win32.whl", hash = "sha256:e8e5b509d5c2ff12f8418006d5a90e9436766133b564db0abaec92fd27fcee29"},
|
||||
{file = "regex-2021.4.4-cp36-cp36m-win_amd64.whl", hash = "sha256:11d773d75fa650cd36f68d7ca936e3c7afaae41b863b8c387a22aaa78d3c5c79"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d3029c340cfbb3ac0a71798100ccc13b97dddf373a4ae56b6a72cf70dfd53bc8"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:18c071c3eb09c30a264879f0d310d37fe5d3a3111662438889ae2eb6fc570c31"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:4c557a7b470908b1712fe27fb1ef20772b78079808c87d20a90d051660b1d69a"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:01afaf2ec48e196ba91b37451aa353cb7eda77efe518e481707e0515025f0cd5"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:3a9cd17e6e5c7eb328517969e0cb0c3d31fd329298dd0c04af99ebf42e904f82"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:90f11ff637fe8798933fb29f5ae1148c978cccb0452005bf4c69e13db951e765"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:919859aa909429fb5aa9cf8807f6045592c85ef56fdd30a9a3747e513db2536e"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:339456e7d8c06dd36a22e451d58ef72cef293112b559010db3d054d5560ef439"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-win32.whl", hash = "sha256:67bdb9702427ceddc6ef3dc382455e90f785af4c13d495f9626861763ee13f9d"},
|
||||
{file = "regex-2021.4.4-cp37-cp37m-win_amd64.whl", hash = "sha256:32e65442138b7b76dd8173ffa2cf67356b7bc1768851dded39a7a13bf9223da3"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1e1c20e29358165242928c2de1482fb2cf4ea54a6a6dea2bd7a0e0d8ee321500"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:314d66636c494ed9c148a42731b3834496cc9a2c4251b1661e40936814542b14"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6d1b01031dedf2503631d0903cb563743f397ccaf6607a5e3b19a3d76fc10480"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:741a9647fcf2e45f3a1cf0e24f5e17febf3efe8d4ba1281dcc3aa0459ef424dc"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:4c46e22a0933dd783467cf32b3516299fb98cfebd895817d685130cc50cd1093"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:e512d8ef5ad7b898cdb2d8ee1cb09a8339e4f8be706d27eaa180c2f177248a10"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:980d7be47c84979d9136328d882f67ec5e50008681d94ecc8afa8a65ed1f4a6f"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:ce15b6d103daff8e9fee13cf7f0add05245a05d866e73926c358e871221eae87"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-win32.whl", hash = "sha256:a91aa8619b23b79bcbeb37abe286f2f408d2f2d6f29a17237afda55bb54e7aac"},
|
||||
{file = "regex-2021.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:c0502c0fadef0d23b128605d69b58edb2c681c25d44574fc673b0e52dce71ee2"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:598585c9f0af8374c28edd609eb291b5726d7cbce16be6a8b95aa074d252ee17"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux1_i686.whl", hash = "sha256:ee54ff27bf0afaf4c3b3a62bcd016c12c3fdb4ec4f413391a90bd38bc3624605"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7d9884d86dd4dd489e981d94a65cd30d6f07203d90e98f6f657f05170f6324c9"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:bf5824bfac591ddb2c1f0a5f4ab72da28994548c708d2191e3b87dd207eb3ad7"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:563085e55b0d4fb8f746f6a335893bda5c2cef43b2f0258fe1020ab1dd874df8"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b9c3db21af35e3b3c05764461b262d6f05bbca08a71a7849fd79d47ba7bc33ed"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3916d08be28a1149fb97f7728fca1f7c15d309a9f9682d89d79db75d5e52091c"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:fd45ff9293d9274c5008a2054ecef86a9bfe819a67c7be1afb65e69b405b3042"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-win32.whl", hash = "sha256:fa4537fb4a98fe8fde99626e4681cc644bdcf2a795038533f9f711513a862ae6"},
|
||||
{file = "regex-2021.4.4-cp39-cp39-win_amd64.whl", hash = "sha256:97f29f57d5b84e73fbaf99ab3e26134e6687348e95ef6b48cfd2c06807005a07"},
|
||||
{file = "regex-2021.4.4.tar.gz", hash = "sha256:52ba3d3f9b942c49d7e4bc105bb28551c44065f139a65062ab7912bef10c9afb"},
|
||||
]
|
||||
requests = [
|
||||
{file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"},
|
||||
@@ -650,12 +669,12 @@ snowballstemmer = [
|
||||
{file = "snowballstemmer-2.1.0.tar.gz", hash = "sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914"},
|
||||
]
|
||||
sphinx = [
|
||||
{file = "Sphinx-3.4.3-py3-none-any.whl", hash = "sha256:c314c857e7cd47c856d2c5adff514ac2e6495f8b8e0f886a8a37e9305dfea0d8"},
|
||||
{file = "Sphinx-3.4.3.tar.gz", hash = "sha256:41cad293f954f7d37f803d97eb184158cfd90f51195131e94875bc07cd08b93c"},
|
||||
{file = "Sphinx-3.5.3-py3-none-any.whl", hash = "sha256:3f01732296465648da43dec8fb40dc451ba79eb3e2cc5c6d79005fd98197107d"},
|
||||
{file = "Sphinx-3.5.3.tar.gz", hash = "sha256:ce9c228456131bab09a3d7d10ae58474de562a6f79abb3dc811ae401cf8c1abc"},
|
||||
]
|
||||
sphinx-rtd-theme = [
|
||||
{file = "sphinx_rtd_theme-0.5.1-py2.py3-none-any.whl", hash = "sha256:fa6bebd5ab9a73da8e102509a86f3fcc36dec04a0b52ea80e5a033b2aba00113"},
|
||||
{file = "sphinx_rtd_theme-0.5.1.tar.gz", hash = "sha256:eda689eda0c7301a80cf122dad28b1861e5605cbf455558f3775e1e8200e83a5"},
|
||||
{file = "sphinx_rtd_theme-0.5.2-py2.py3-none-any.whl", hash = "sha256:4a05bdbe8b1446d77a01e20a23ebc6777c74f43237035e76be89699308987d6f"},
|
||||
{file = "sphinx_rtd_theme-0.5.2.tar.gz", hash = "sha256:32bd3b5d13dc8186d7a42fc816a23d32e83a4827d7d9882948e7b837c232da5a"},
|
||||
]
|
||||
sphinxcontrib-applehelp = [
|
||||
{file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"},
|
||||
@@ -727,6 +746,6 @@ typing-extensions = [
|
||||
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
|
||||
]
|
||||
urllib3 = [
|
||||
{file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"},
|
||||
{file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"},
|
||||
{file = "urllib3-1.26.4-py2.py3-none-any.whl", hash = "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df"},
|
||||
{file = "urllib3-1.26.4.tar.gz", hash = "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"},
|
||||
]
|
||||
|
||||
+26
-13
@@ -267,7 +267,7 @@ class Motor(DCMotor):
|
||||
given target angle.
|
||||
|
||||
The direction of rotation is automatically selected based on the target
|
||||
angle. It does matter if ``speed`` is positive or negative.
|
||||
angle. It does not matter if ``speed`` is positive or negative.
|
||||
|
||||
Arguments:
|
||||
speed (:ref:`speed`): Speed of the motor.
|
||||
@@ -715,7 +715,31 @@ class Battery:
|
||||
pass
|
||||
|
||||
|
||||
class Accelerometer:
|
||||
class SimpleAccelerometer:
|
||||
"""Get measurements from an accelerometer."""
|
||||
|
||||
def acceleration(self):
|
||||
"""Gets the acceleration of the device.
|
||||
|
||||
Returns:
|
||||
tuple of :ref:`linacceleration_m`: Acceleration along all three
|
||||
axes.
|
||||
"""
|
||||
pass
|
||||
|
||||
def up(self):
|
||||
"""Checks which side of the hub currently faces upward.
|
||||
|
||||
:returns:
|
||||
``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``,
|
||||
``Side.FRONT`` or ``Side.BACK``.
|
||||
:rtype: :class:`Side`
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Accelerometer(SimpleAccelerometer):
|
||||
"""Get measurements from an accelerometer."""
|
||||
|
||||
def neutral(self, top, front):
|
||||
@@ -786,17 +810,6 @@ class Accelerometer:
|
||||
"""
|
||||
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`
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class IMU(Accelerometer):
|
||||
|
||||
|
||||
+3
-1
@@ -4,7 +4,8 @@
|
||||
"""LEGO® Programmable Hubs."""
|
||||
from ._common import (Speaker as _Speaker, Battery as _Battery,
|
||||
ColorLight as _ColorLight, Keypad as _Keypad,
|
||||
LightMatrix as _LightMatrix, IMU as _IMU)
|
||||
LightMatrix as _LightMatrix, IMU as _IMU,
|
||||
SimpleAccelerometer as _SimpleAccelerometer)
|
||||
from .media.ev3dev import Image as _Image
|
||||
from .parameters import Button as _Button
|
||||
from .geometry import Axis as _Axis
|
||||
@@ -35,6 +36,7 @@ class MoveHub:
|
||||
# In reality, they are instance attributes created by __init__.
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
imu = _SimpleAccelerometer()
|
||||
|
||||
|
||||
class CityHub:
|
||||
|
||||
@@ -180,5 +180,5 @@ class BluetoothMailboxClient:
|
||||
There was a problem establishing the connection.
|
||||
"""
|
||||
|
||||
def close(self):
|
||||
def server_close(self):
|
||||
"""Closes all connections."""
|
||||
|
||||
@@ -40,7 +40,7 @@ class BluetoothMailboxServer(Connection):
|
||||
def __enter__(self) -> BluetoothMailboxServer: ...
|
||||
def __exit__(self, type, value, traceback) -> None: ...
|
||||
def wait_for_connection(self, count: int = 1) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def server_close(self) -> None: ...
|
||||
|
||||
class BluetoothMailboxClient(Connection):
|
||||
def __enter__(self) -> BluetoothMailboxClient: ...
|
||||
|
||||
@@ -81,9 +81,8 @@ class ColorSensor:
|
||||
|
||||
: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.
|
||||
``Color.RED``, ``Color.WHITE`` or ``Color.NONE``.
|
||||
:rtype: :class:`Color <.parameters.Color>`
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -57,11 +57,12 @@ class Color:
|
||||
|
||||
|
||||
Color.NONE = Color(0, 0, 0)
|
||||
Color.BLACK = Color(0, 0, 15)
|
||||
Color.BLACK = Color(0, 0, 10)
|
||||
Color.GRAY = Color(0, 0, 50)
|
||||
Color.WHITE = Color(0, 0, 100)
|
||||
Color.RED = Color(0, 100, 100)
|
||||
Color.ORANGE = Color(30, 100, 100)
|
||||
Color.BROWN = Color(30, 100, 50)
|
||||
Color.YELLOW = Color(60, 100, 100)
|
||||
Color.GREEN = Color(120, 100, 100)
|
||||
Color.CYAN = Color(180, 100, 100)
|
||||
|
||||
@@ -4,13 +4,17 @@
|
||||
class Color:
|
||||
BLACK: Color
|
||||
BLUE: Color
|
||||
GREEN: Color
|
||||
YELLOW: Color
|
||||
RED: Color
|
||||
WHITE: Color
|
||||
BROWN: Color
|
||||
CYAN: Color
|
||||
GRAY: Color
|
||||
GREEN: Color
|
||||
MAGENTA: Color
|
||||
NONE: Color
|
||||
ORANGE: Color
|
||||
PURPLE: Color
|
||||
RED: Color
|
||||
VIOLET: Color
|
||||
WHITE: Color
|
||||
YELLOW: Color
|
||||
def __mul__(self, scale: float) -> Color: ...
|
||||
def __rmul__(self, scale: float) -> Color: ...
|
||||
def __truediv__(self, scale: float) -> Color: ...
|
||||
|
||||
@@ -91,7 +91,7 @@ class ColorDistanceSensor:
|
||||
You choose which colors are detected using the
|
||||
:meth:`.detectable_colors` method. By default, it detects
|
||||
``Color.RED``, ``Color.YELLOW``, ``Color.GREEN``, ``Color.BLUE``,
|
||||
``Color.WHITE``, or ``None``.
|
||||
``Color.WHITE``, or ``Color.NONE``.
|
||||
|
||||
:returns:
|
||||
Detected color.
|
||||
@@ -128,11 +128,10 @@ class ColorDistanceSensor:
|
||||
as a tuple.
|
||||
|
||||
Arguments:
|
||||
colors (list): List of :class:`Color <.parameters.Color>` objects:
|
||||
colors (list): Tuple of :class:`Color <.parameters.Color>` objects:
|
||||
the colors that you want to detect. You can pick
|
||||
standard colors such as ``Color.MAGENTA``, or provide your own
|
||||
colors like
|
||||
``Color(h=348, s=96, v=40, name='MY_MAGENTA_BRICK')`` for even
|
||||
colors like ``Color(h=348, s=96, v=40)`` for even
|
||||
better results. You measure your own colors with the
|
||||
:meth:`.hsv` method.
|
||||
"""
|
||||
@@ -210,7 +209,7 @@ class ColorSensor:
|
||||
You choose which colors are detected using the
|
||||
:meth:`.detectable_colors` method. By default, it detects
|
||||
``Color.RED``, ``Color.YELLOW``, ``Color.GREEN``, ``Color.BLUE``,
|
||||
``Color.WHITE``, or ``None``.
|
||||
``Color.WHITE``, or ``Color.NONE``.
|
||||
|
||||
Arguments:
|
||||
surface (bool): Choose ``true`` to scan the color of objects
|
||||
@@ -233,11 +232,10 @@ class ColorSensor:
|
||||
as a tuple.
|
||||
|
||||
Arguments:
|
||||
colors (list): List of :class:`Color <.parameters.Color>` objects:
|
||||
colors (list): Tuple of :class:`Color <.parameters.Color>` objects:
|
||||
the colors that you want to detect. You can pick
|
||||
standard colors such as ``Color.MAGENTA``, or provide your own
|
||||
colors like
|
||||
``Color(h=348, s=96, v=40, name='MY_MAGENTA_BRICK')`` for even
|
||||
colors like ``Color(h=348, s=96, v=40)`` for even
|
||||
better results. You measure your own colors with the
|
||||
:meth:`.hsv` method.
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
from typing import Optional, Tuple, overload
|
||||
from typing import Optional, Tuple, overload, Union
|
||||
from ._common import Control, Motor
|
||||
|
||||
class DriveBase:
|
||||
@@ -11,8 +11,8 @@ class DriveBase:
|
||||
self,
|
||||
left_motor: Motor,
|
||||
right_motor: Motor,
|
||||
wheel_diameter: int,
|
||||
axle_track: int,
|
||||
wheel_diameter: Union[int, float],
|
||||
axle_track: Union[int, float],
|
||||
): ...
|
||||
def drive(self, drive_speed: int, turn_rate: int) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks"
|
||||
version = "3.0.0a3"
|
||||
version = "3.0.0-rc.1"
|
||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||
authors = ["The Pybricks Authors <dev@pybricks.com>"]
|
||||
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
||||
@@ -22,8 +22,8 @@ python = "^3.8"
|
||||
black = {version = "^20.8b1", allow-prereleases = true}
|
||||
doc8 = "^0.8.1"
|
||||
flake8 = "^3.8.4"
|
||||
Sphinx = "^3.4.3"
|
||||
sphinx-rtd-theme = "^0.5.1"
|
||||
Sphinx = "==3.5.3"
|
||||
sphinx-rtd-theme = "==0.5.2"
|
||||
toml = "^0.10.0"
|
||||
|
||||
[build-system]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# This file is strictly for building docs on readthedocs.org
|
||||
# See pyproject.toml for local development
|
||||
Sphinx==3.4.3
|
||||
sphinx-rtd-theme==0.5.1
|
||||
Sphinx==3.5.3
|
||||
sphinx-rtd-theme==0.5.2
|
||||
toml
|
||||
|
||||
Reference in New Issue
Block a user