mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ea780cc9e | ||
|
|
78a8fea78f | ||
|
|
99a7c69ac5 | ||
|
|
1a64ba718f | ||
|
|
6d332deb3f | ||
|
|
a7df6988ab | ||
|
|
a2e17f6889 | ||
|
|
866b50fef6 | ||
|
|
9c7378ce64 |
@@ -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
|
||||
|
||||
@@ -19,12 +19,6 @@ Move Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.animate
|
||||
|
||||
.. rubric:: Using the IMU
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.imu.up
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.imu.acceleration
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.battery.voltage
|
||||
@@ -46,17 +40,3 @@ Making the light blink
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_blink.py
|
||||
|
||||
IMU examples
|
||||
---------------
|
||||
|
||||
Testing which way is up
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/imu_up.py
|
||||
|
||||
Reading acceleration
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/imu_read_acceleration.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
|
||||
|
||||
@@ -70,7 +70,6 @@ findings on our `support page`_ so we can make Pybricks even better.
|
||||
robotics
|
||||
media
|
||||
messaging
|
||||
geometry
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
@@ -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
|
||||
@@ -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,3 +1,27 @@
|
||||
# 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:
|
||||
|
||||
@@ -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
|
||||
+1
-2
@@ -12,7 +12,6 @@ Pybricks Documentation
|
||||
parameters/index
|
||||
tools/index
|
||||
robotics
|
||||
geometry
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -30,7 +29,7 @@ commonly used devices and classes are listed below for quick reference.
|
||||
|
||||
.. rubric:: Programmable Hubs
|
||||
|
||||
.. figure:: ../api/images/hubsoverview.png
|
||||
.. figure:: ../api/images/powereduphubs.png
|
||||
:width: 100 %
|
||||
:target: hubs/index.html
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/ide-docs",
|
||||
"version": "1.2.0",
|
||||
"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
|
||||
Reference in New Issue
Block a user