Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
356f6ffdba | ||
|
|
4967b96ddd | ||
|
|
116368e4c7 | ||
|
|
5b56249d8c | ||
|
|
04fb7e3e19 | ||
|
|
5814a73bb1 | ||
|
|
ed3059b47b | ||
|
|
2a98264144 | ||
|
|
6083b17d9a | ||
|
|
1c598f35be | ||
|
|
52c522df2d | ||
|
|
2380be2814 | ||
|
|
89a34e9f51 | ||
|
|
9597f227f4 | ||
|
|
1e09cb2232 | ||
|
|
6739b517a5 | ||
|
|
c5cfcd0ac8 | ||
|
|
827eda031b | ||
|
|
c77b440270 | ||
|
|
789e70a42b | ||
|
|
53d6d14de6 | ||
|
|
ce9d7420fb | ||
|
|
044903b193 | ||
|
|
25bfd0e80e | ||
|
|
b28f768bec |
@@ -4,7 +4,25 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
## 3.5.0- 2024-04-11
|
## 3.6.1 - 2025-05-01
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed missing `hub.system.info` method on some hubs.
|
||||||
|
|
||||||
|
## 3.6.0 - 2025-03-11
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update API for firmware 3.6.0. See upstream changelog for details.
|
||||||
|
|
||||||
|
## 3.6.0b5 - 2025-02-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update API for firmware 3.6.0b5. See upstream changelog for details.
|
||||||
|
|
||||||
|
## 3.5.0 - 2024-04-11
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Bump version to 3.5.0 without additional changes.
|
- Bump version to 3.5.0 without additional changes.
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
.block-image {
|
.svg-container {
|
||||||
margin-top: 10px;
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-container svg {
|
||||||
|
position: relative;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ import sphinx_rtd_theme
|
|||||||
html_theme = "sphinx_rtd_theme"
|
html_theme = "sphinx_rtd_theme"
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
|
||||||
|
html_show_sourcelink = False
|
||||||
|
html_copy_source = False
|
||||||
|
|
||||||
html_context = {
|
html_context = {
|
||||||
"disclaimer": _DISCLAIMER,
|
"disclaimer": _DISCLAIMER,
|
||||||
}
|
}
|
||||||
@@ -261,6 +264,7 @@ exclude_patterns = [
|
|||||||
"messaging.rst",
|
"messaging.rst",
|
||||||
"nxtdevices.rst",
|
"nxtdevices.rst",
|
||||||
"tools/datalog.rst",
|
"tools/datalog.rst",
|
||||||
|
"*.rst.txt",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +1,37 @@
|
|||||||
import xml.etree.ElementTree as ET
|
from docutils.parsers.rst import Directive
|
||||||
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import directives
|
|
||||||
from docutils.parsers.rst.directives.images import Image
|
|
||||||
from docutils.nodes import image, paragraph
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SPHINX_IMAGE_PATH = "blockimg"
|
SPHINX_IMAGE_PATH = "blockimg"
|
||||||
|
|
||||||
SVG_SCALE = 0.9
|
|
||||||
|
|
||||||
|
def get_svg_content(file_path):
|
||||||
def get_svg_size(file_path):
|
with open(file_path, "r", encoding="utf-8") as file:
|
||||||
tree = ET.parse(file_path)
|
return file.read()
|
||||||
root = tree.getroot()
|
|
||||||
|
|
||||||
width = root.attrib.get("width")
|
|
||||||
height = root.attrib.get("height")
|
|
||||||
|
|
||||||
return float(width), float(height)
|
|
||||||
|
|
||||||
|
|
||||||
# Global variable to store the app object
|
# Global variable to store the app object
|
||||||
app = None
|
app = None
|
||||||
|
|
||||||
|
|
||||||
class BlockImageDirective(Image):
|
class BlockImageDirective(Directive):
|
||||||
option_spec = Image.option_spec.copy()
|
has_content = False
|
||||||
option_spec["stack"] = directives.flag
|
required_arguments = 1
|
||||||
|
optional_arguments = 0
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Adjust the image path
|
# Adjust the image path
|
||||||
file_name = self.arguments[0] + ".svg"
|
file_name = self.arguments[0] + ".svg"
|
||||||
self.arguments[0] = "/" + SPHINX_IMAGE_PATH + "/" + file_name
|
file_path = Path(app.srcdir) / SPHINX_IMAGE_PATH / file_name
|
||||||
path = Path(app.srcdir) / SPHINX_IMAGE_PATH / file_name
|
|
||||||
|
|
||||||
# Set it to the scaled SVG size unless width explicitly set.
|
# Read the SVG content
|
||||||
if self.options.get("width") is None:
|
svg_content = get_svg_content(file_path)
|
||||||
width, height = get_svg_size(path)
|
|
||||||
self.options["width"] = str(round(width * SVG_SCALE)) + "px"
|
|
||||||
self.options["height"] = str(round(height * SVG_SCALE)) + "px"
|
|
||||||
|
|
||||||
# Call the parent class's run method
|
# Create a raw HTML node with the SVG content
|
||||||
nodes = super().run()
|
raw_html = f'<div class="svg-container">{svg_content}</div>'
|
||||||
|
raw_node = nodes.raw("", raw_html, format="html")
|
||||||
|
|
||||||
# Wrap each image node in a paragraph node
|
return [raw_node]
|
||||||
for i, node in enumerate(nodes):
|
|
||||||
if isinstance(node, image):
|
|
||||||
if "stack" not in self.options:
|
|
||||||
node["classes"].append("block-image")
|
|
||||||
nodes[i] = paragraph("", "", node)
|
|
||||||
|
|
||||||
return nodes
|
|
||||||
|
|
||||||
|
|
||||||
def setup(apparg):
|
def setup(apparg):
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 101 KiB |
@@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
width="525"
|
||||||
|
height="525"
|
||||||
|
viewBox="0 0 525 525"
|
||||||
|
sodipodi:docname="icon_ev3hub.svg"
|
||||||
|
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||||
|
inkscape:export-filename="../diagrams/icon_ev3hub.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<metadata
|
||||||
|
id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs6">
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath860">
|
||||||
|
<rect
|
||||||
|
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect862"
|
||||||
|
width="589.10107"
|
||||||
|
height="96.333336"
|
||||||
|
x="235.33333"
|
||||||
|
y="-236.00002" />
|
||||||
|
</clipPath>
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath1040">
|
||||||
|
<rect
|
||||||
|
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect1042"
|
||||||
|
width="128.5101"
|
||||||
|
height="19.934668"
|
||||||
|
x="827.15656"
|
||||||
|
y="74.666672" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#fcfcfc"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1163"
|
||||||
|
id="namedview4"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="0.9950413"
|
||||||
|
inkscape:cx="301.49502"
|
||||||
|
inkscape:cy="344.70931"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
inkscape:pagecheckerboard="0" />
|
||||||
|
<image
|
||||||
|
width="525"
|
||||||
|
height="468.02328"
|
||||||
|
preserveAspectRatio="none"
|
||||||
|
xlink:href="../cad/output/ev3device-ev3.png"
|
||||||
|
id="image834"
|
||||||
|
x="0"
|
||||||
|
y="26.384924" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
width="525"
|
||||||
|
height="525"
|
||||||
|
viewBox="0 0 525 525"
|
||||||
|
sodipodi:docname="icon_nxthub.svg"
|
||||||
|
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||||
|
inkscape:export-filename="../diagrams/icon_nxthub.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<metadata
|
||||||
|
id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs6">
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath860">
|
||||||
|
<rect
|
||||||
|
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect862"
|
||||||
|
width="589.10107"
|
||||||
|
height="96.333336"
|
||||||
|
x="235.33333"
|
||||||
|
y="-236.00002" />
|
||||||
|
</clipPath>
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath1040">
|
||||||
|
<rect
|
||||||
|
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect1042"
|
||||||
|
width="128.5101"
|
||||||
|
height="19.934668"
|
||||||
|
x="827.15656"
|
||||||
|
y="74.666672" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#fcfcfc"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1163"
|
||||||
|
id="namedview4"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="0.9950413"
|
||||||
|
inkscape:cx="301.49502"
|
||||||
|
inkscape:cy="344.70931"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
inkscape:pagecheckerboard="false" />
|
||||||
|
<image
|
||||||
|
width="525"
|
||||||
|
height="447.39801"
|
||||||
|
preserveAspectRatio="none"
|
||||||
|
xlink:href="../cad/output/nxtdevice-nxt.png"
|
||||||
|
id="image960"
|
||||||
|
x="0"
|
||||||
|
y="34.809708" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -8,7 +8,6 @@ City Hub
|
|||||||
.. blockimg:: pybricks_variables_set_city_hub_option0
|
.. blockimg:: pybricks_variables_set_city_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_city_hub_option3
|
.. blockimg:: pybricks_variables_set_city_hub_option3
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.hubs.CityHub
|
.. autoclass:: pybricks.hubs.CityHub
|
||||||
:no-members:
|
:no-members:
|
||||||
@@ -57,26 +56,26 @@ City Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.buttons.pressed
|
.. automethod:: pybricks.hubs::CityHub.buttons.pressed
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::CityHub.system.info
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_CityHub
|
.. blockimg:: pybricks_blockHubStopButton_CityHub
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_CityHub_none
|
.. blockimg:: pybricks_blockHubStopButton_CityHub_none
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.system.set_stop_button
|
.. automethod:: pybricks.hubs::CityHub.system.set_stop_button
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.system.name
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.system.storage
|
.. automethod:: pybricks.hubs::CityHub.system.storage
|
||||||
|
|
||||||
You can store up to 128 bytes of data on this hub. The data is cleared
|
You can store up to 128 bytes of data on this hub. The data is cleared
|
||||||
when you update the Pybricks firmware or if you restore the original
|
when you update the Pybricks firmware or if you restore the original
|
||||||
firmware.
|
firmware.
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::CityHub.system.reset_storage
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubShutdown_CityHub
|
.. blockimg:: pybricks_blockHubShutdown_CityHub
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.system.shutdown
|
.. automethod:: pybricks.hubs::CityHub.system.shutdown
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::CityHub.system.reset_reason
|
|
||||||
|
|
||||||
Status light examples
|
Status light examples
|
||||||
---------------------
|
---------------------
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Essential Hub
|
|||||||
.. blockimg:: pybricks_variables_set_essential_hub_option0
|
.. blockimg:: pybricks_variables_set_essential_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_essential_hub_option4
|
.. blockimg:: pybricks_variables_set_essential_hub_option4
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.hubs.EssentialHub
|
.. autoclass:: pybricks.hubs.EssentialHub
|
||||||
:no-members:
|
:no-members:
|
||||||
@@ -37,12 +36,18 @@ Essential Hub
|
|||||||
.. blockimg:: pybricks_blockHubStopButton_EssentialHub
|
.. blockimg:: pybricks_blockHubStopButton_EssentialHub
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_EssentialHub_none
|
.. blockimg:: pybricks_blockHubStopButton_EssentialHub_none
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.system.set_stop_button
|
.. automethod:: pybricks.hubs::EssentialHub.system.set_stop_button
|
||||||
|
|
||||||
.. rubric:: Using the IMU
|
.. rubric:: Using the IMU
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
|
The methods below now return calibrated data by default. Depending on
|
||||||
|
the method used, this combines data from the accelerometer, gyroscope,
|
||||||
|
with your calibration values. Use ``calibrated=False`` where applicable
|
||||||
|
to get the raw data you got before.
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockImuStatus_EssentialHub_ready
|
.. blockimg:: pybricks_blockImuStatus_EssentialHub_ready
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.imu.ready
|
.. automethod:: pybricks.hubs::EssentialHub.imu.ready
|
||||||
@@ -58,7 +63,6 @@ Essential Hub
|
|||||||
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.pitch
|
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.pitch
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.roll
|
.. blockimg:: pybricks_blockTilt_EssentialHub_imu.tilt.roll
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.imu.tilt
|
.. automethod:: pybricks.hubs::EssentialHub.imu.tilt
|
||||||
|
|
||||||
@@ -84,6 +88,12 @@ Essential Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.imu.orientation
|
.. automethod:: pybricks.hubs::EssentialHub.imu.orientation
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_heading_correction
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_angular_velocity_threshold
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_EssentialHub_imu.settings_acceleration_threshold
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.imu.settings
|
.. automethod:: pybricks.hubs::EssentialHub.imu.settings
|
||||||
|
|
||||||
.. rubric:: Using connectionless Bluetooth messaging
|
.. rubric:: Using connectionless Bluetooth messaging
|
||||||
@@ -120,18 +130,19 @@ Essential Hub
|
|||||||
|
|
||||||
.. rubric:: System control
|
.. rubric:: System control
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.system.name
|
.. automethod:: pybricks.hubs::EssentialHub.system.info
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.system.storage
|
.. automethod:: pybricks.hubs::EssentialHub.system.storage
|
||||||
|
|
||||||
You can store up to 512 bytes of data on this hub.
|
You can store up to 512 bytes of data on this hub. The data is cleared
|
||||||
|
when you update the Pybricks firmware.
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::EssentialHub.system.reset_storage
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubShutdown_EssentialHub
|
.. blockimg:: pybricks_blockHubShutdown_EssentialHub
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.system.shutdown
|
.. automethod:: pybricks.hubs::EssentialHub.system.shutdown
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::EssentialHub.system.reset_reason
|
|
||||||
|
|
||||||
Status light examples
|
Status light examples
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ Move Hub
|
|||||||
.. blockimg:: pybricks_variables_set_move_hub_option0
|
.. blockimg:: pybricks_variables_set_move_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_move_hub_option4
|
.. blockimg:: pybricks_variables_set_move_hub_option4
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.hubs.MoveHub
|
.. autoclass:: pybricks.hubs.MoveHub
|
||||||
:no-members:
|
:no-members:
|
||||||
@@ -39,7 +38,6 @@ Move Hub
|
|||||||
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.pitch
|
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.pitch
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.roll
|
.. blockimg:: pybricks_blockTilt_MoveHub_imu.tilt.roll
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.imu.tilt
|
.. automethod:: pybricks.hubs::MoveHub.imu.tilt
|
||||||
|
|
||||||
@@ -81,27 +79,26 @@ Move Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.buttons.pressed
|
.. automethod:: pybricks.hubs::MoveHub.buttons.pressed
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::MoveHub.system.info
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_MoveHub
|
.. blockimg:: pybricks_blockHubStopButton_MoveHub
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_MoveHub_none
|
.. blockimg:: pybricks_blockHubStopButton_MoveHub_none
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.system.set_stop_button
|
.. automethod:: pybricks.hubs::MoveHub.system.set_stop_button
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.system.name
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.system.storage
|
.. automethod:: pybricks.hubs::MoveHub.system.storage
|
||||||
|
|
||||||
You can store up to 128 bytes of data on this hub. The data is cleared
|
You can store up to 128 bytes of data on this hub. The data is cleared
|
||||||
when you update the Pybricks firmware or if you restore the original
|
when you update the Pybricks firmware or if you restore the original
|
||||||
firmware.
|
firmware.
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::MoveHub.system.reset_storage
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubShutdown_MoveHub
|
.. blockimg:: pybricks_blockHubShutdown_MoveHub
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.system.shutdown
|
.. automethod:: pybricks.hubs::MoveHub.system.shutdown
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::MoveHub.system.reset_reason
|
|
||||||
|
|
||||||
Status light examples
|
Status light examples
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Prime Hub / Inventor Hub
|
|||||||
.. blockimg:: pybricks_variables_set_inventor_hub_option0
|
.. blockimg:: pybricks_variables_set_inventor_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_inventor_hub_option4
|
.. blockimg:: pybricks_variables_set_inventor_hub_option4
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. class:: InventorHub
|
.. class:: InventorHub
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ Prime Hub / Inventor Hub
|
|||||||
.. blockimg:: pybricks_variables_set_prime_hub_option0
|
.. blockimg:: pybricks_variables_set_prime_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_prime_hub_option4
|
.. blockimg:: pybricks_variables_set_prime_hub_option4
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.hubs.PrimeHub
|
.. autoclass:: pybricks.hubs.PrimeHub
|
||||||
:no-members:
|
:no-members:
|
||||||
@@ -84,12 +82,18 @@ Prime Hub / Inventor Hub
|
|||||||
.. blockimg:: pybricks_blockHubStopButton_PrimeHub
|
.. blockimg:: pybricks_blockHubStopButton_PrimeHub
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_PrimeHub_none
|
.. blockimg:: pybricks_blockHubStopButton_PrimeHub_none
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.system.set_stop_button
|
.. automethod:: pybricks.hubs::PrimeHub.system.set_stop_button
|
||||||
|
|
||||||
.. rubric:: Using the IMU
|
.. rubric:: Using the IMU
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
|
The methods below now return calibrated data by default. Depending on
|
||||||
|
the method used, this combines data from the accelerometer, gyroscope,
|
||||||
|
with your calibration values. Use ``calibrated=False`` where applicable
|
||||||
|
to get the raw data you got before.
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockImuStatus_PrimeHub_ready
|
.. blockimg:: pybricks_blockImuStatus_PrimeHub_ready
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.imu.ready
|
.. automethod:: pybricks.hubs::PrimeHub.imu.ready
|
||||||
@@ -105,7 +109,6 @@ Prime Hub / Inventor Hub
|
|||||||
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.pitch
|
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.pitch
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.roll
|
.. blockimg:: pybricks_blockTilt_PrimeHub_imu.tilt.roll
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.imu.tilt
|
.. automethod:: pybricks.hubs::PrimeHub.imu.tilt
|
||||||
|
|
||||||
@@ -131,6 +134,12 @@ Prime Hub / Inventor Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.imu.orientation
|
.. automethod:: pybricks.hubs::PrimeHub.imu.orientation
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_heading_correction
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_angular_velocity_threshold
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_PrimeHub_imu.settings_acceleration_threshold
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.imu.settings
|
.. automethod:: pybricks.hubs::PrimeHub.imu.settings
|
||||||
|
|
||||||
.. rubric:: Using the speaker
|
.. rubric:: Using the speaker
|
||||||
@@ -175,19 +184,22 @@ Prime Hub / Inventor Hub
|
|||||||
|
|
||||||
.. rubric:: System control
|
.. rubric:: System control
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.system.name
|
.. automethod:: pybricks.hubs::PrimeHub.system.info
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.system.storage
|
.. automethod:: pybricks.hubs::PrimeHub.system.storage
|
||||||
|
|
||||||
You can store up to 512 bytes of data on this hub.
|
You can store up to 512 bytes of data on this hub. The data is cleared
|
||||||
|
when you update the Pybricks firmware.
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::PrimeHub.system.reset_storage
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubShutdown_PrimeHub
|
.. blockimg:: pybricks_blockHubShutdown_PrimeHub
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.system.shutdown
|
.. automethod:: pybricks.hubs::PrimeHub.system.shutdown
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::PrimeHub.system.reset_reason
|
.. note::
|
||||||
|
|
||||||
.. note:: The examples below use the ``PrimeHub`` class. The examples work fine
|
The examples below use the ``PrimeHub`` class. The examples work fine
|
||||||
on both hubs because they are the identical. If you prefer, you can
|
on both hubs because they are the identical. If you prefer, you can
|
||||||
change this to ``InventorHub``.
|
change this to ``InventorHub``.
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Technic Hub
|
|||||||
.. blockimg:: pybricks_variables_set_technic_hub_option0
|
.. blockimg:: pybricks_variables_set_technic_hub_option0
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_technic_hub_option4
|
.. blockimg:: pybricks_variables_set_technic_hub_option4
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.hubs.TechnicHub
|
.. autoclass:: pybricks.hubs.TechnicHub
|
||||||
:no-members:
|
:no-members:
|
||||||
@@ -30,6 +29,13 @@ Technic Hub
|
|||||||
|
|
||||||
.. rubric:: Using the IMU
|
.. rubric:: Using the IMU
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
|
The methods below now return calibrated data by default. Depending on
|
||||||
|
the method used, this combines data from the accelerometer, gyroscope,
|
||||||
|
with your calibration values. Use ``calibrated=False`` where applicable
|
||||||
|
to get the raw data you got before.
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockImuStatus_TechnicHub_ready
|
.. blockimg:: pybricks_blockImuStatus_TechnicHub_ready
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.imu.ready
|
.. automethod:: pybricks.hubs::TechnicHub.imu.ready
|
||||||
@@ -45,7 +51,6 @@ Technic Hub
|
|||||||
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.pitch
|
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.pitch
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.roll
|
.. blockimg:: pybricks_blockTilt_TechnicHub_imu.tilt.roll
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
|
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
|
||||||
|
|
||||||
@@ -71,6 +76,12 @@ Technic Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.imu.orientation
|
.. automethod:: pybricks.hubs::TechnicHub.imu.orientation
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_heading_correction
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_angular_velocity_threshold
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockImuConfigure_TechnicHub_imu.settings_acceleration_threshold
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.imu.settings
|
.. automethod:: pybricks.hubs::TechnicHub.imu.settings
|
||||||
|
|
||||||
.. rubric:: Using connectionless Bluetooth messaging
|
.. rubric:: Using connectionless Bluetooth messaging
|
||||||
@@ -103,27 +114,26 @@ Technic Hub
|
|||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.buttons.pressed
|
.. automethod:: pybricks.hubs::TechnicHub.buttons.pressed
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::TechnicHub.system.info
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_TechnicHub
|
.. blockimg:: pybricks_blockHubStopButton_TechnicHub
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubStopButton_TechnicHub_none
|
.. blockimg:: pybricks_blockHubStopButton_TechnicHub_none
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button
|
.. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.system.name
|
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.system.storage
|
.. automethod:: pybricks.hubs::TechnicHub.system.storage
|
||||||
|
|
||||||
You can store up to 128 bytes of data on this hub. The data is cleared
|
You can store up to 128 bytes of data on this hub. The data is cleared
|
||||||
when you update the Pybricks firmware or if you restore the original
|
when you update the Pybricks firmware or if you restore the original
|
||||||
firmware.
|
firmware.
|
||||||
|
|
||||||
|
.. automethod:: pybricks.hubs::TechnicHub.system.reset_storage
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockHubShutdown_TechnicHub
|
.. blockimg:: pybricks_blockHubShutdown_TechnicHub
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.system.shutdown
|
.. automethod:: pybricks.hubs::TechnicHub.system.shutdown
|
||||||
|
|
||||||
.. automethod:: pybricks.hubs::TechnicHub.system.reset_reason
|
|
||||||
|
|
||||||
Status light examples
|
Status light examples
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
.. pybricks-requirements:: pybricks-iodevices
|
||||||
|
|
||||||
LEGO Wireless Protocol v3 device
|
LEGO Wireless Protocol v3 device
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@@ -30,21 +30,18 @@ Xbox Controller
|
|||||||
.. blockimg:: pybricks_blockJoystickValue_lj_x
|
.. blockimg:: pybricks_blockJoystickValue_lj_x
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockJoystickValue_lj_y
|
.. blockimg:: pybricks_blockJoystickValue_lj_y
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.iodevices::XboxController.joystick_left
|
.. automethod:: pybricks.iodevices::XboxController.joystick_left
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockJoystickValue_rj_x
|
.. blockimg:: pybricks_blockJoystickValue_rj_x
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockJoystickValue_rj_y
|
.. blockimg:: pybricks_blockJoystickValue_rj_y
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.iodevices::XboxController.joystick_right
|
.. automethod:: pybricks.iodevices::XboxController.joystick_right
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockJoystickValue_lt
|
.. blockimg:: pybricks_blockJoystickValue_lt
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockJoystickValue_rt
|
.. blockimg:: pybricks_blockJoystickValue_rt
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.iodevices::XboxController.triggers
|
.. automethod:: pybricks.iodevices::XboxController.triggers
|
||||||
|
|
||||||
@@ -59,10 +56,8 @@ Xbox Controller
|
|||||||
.. blockimg:: pybricks_blockGamepadRumble_default
|
.. blockimg:: pybricks_blockGamepadRumble_default
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockGamepadRumble_default_with_list
|
.. blockimg:: pybricks_blockGamepadRumble_default_with_list
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockGamepadRumble_with_options
|
.. blockimg:: pybricks_blockGamepadRumble_with_options
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.iodevices::XboxController.rumble
|
.. automethod:: pybricks.iodevices::XboxController.rumble
|
||||||
|
|
||||||
|
|||||||
@@ -79,52 +79,36 @@ Sequences
|
|||||||
.. pybricks-requirements::
|
.. pybricks-requirements::
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListCreate_list_empty
|
.. blockimg:: pybricks_blockListCreate_list_empty
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListCreate_list_3
|
.. blockimg:: pybricks_blockListCreate_list_3
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListUnpack
|
.. blockimg:: pybricks_blockListUnpack
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListGet_list_get_first
|
.. blockimg:: pybricks_blockListGet_list_get_first
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListGet_list_get_index
|
.. blockimg:: pybricks_blockListGet_list_get_index
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListGet_list_get_last
|
.. blockimg:: pybricks_blockListGet_list_get_last
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListGet_list_get_random
|
.. blockimg:: pybricks_blockListGet_list_get_random
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_insert_first
|
.. blockimg:: pybricks_blockListSet_list_insert_first
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_insert_index
|
.. blockimg:: pybricks_blockListSet_list_insert_index
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_insert_last
|
.. blockimg:: pybricks_blockListSet_list_insert_last
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_remove_first
|
.. blockimg:: pybricks_blockListSet_list_remove_first
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_remove_index
|
.. blockimg:: pybricks_blockListSet_list_remove_index
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_remove_last
|
.. blockimg:: pybricks_blockListSet_list_remove_last
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_set_first
|
.. blockimg:: pybricks_blockListSet_list_set_first
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_set_index
|
.. blockimg:: pybricks_blockListSet_list_set_index
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockListSet_list_set_last
|
.. blockimg:: pybricks_blockListSet_list_set_last
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: ubuiltins.list
|
.. autoclass:: ubuiltins.list
|
||||||
|
|
||||||
@@ -262,11 +246,11 @@ See also :mod:`umath` for floating point math operations.
|
|||||||
Runtime functions
|
Runtime functions
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
.. pybricks-requirements::
|
.. pybricks-requirements:: stm32-extra
|
||||||
|
|
||||||
.. autofunction:: ubuiltins.eval
|
.. autofunction:: ubuiltins.eval
|
||||||
|
|
||||||
.. pybricks-requirements::
|
.. pybricks-requirements:: stm32-extra
|
||||||
|
|
||||||
.. autofunction:: ubuiltins.exec
|
.. autofunction:: ubuiltins.exec
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ Color Sensor
|
|||||||
.. blockimg:: pybricks_blockLightOn_colorsensor_on
|
.. blockimg:: pybricks_blockLightOn_colorsensor_on
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockLightOn_colorsensor_on_list
|
.. blockimg:: pybricks_blockLightOn_colorsensor_on_list
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.pupdevices::ColorSensor.lights.on
|
.. automethod:: pybricks.pupdevices::ColorSensor.lights.on
|
||||||
|
|
||||||
|
|||||||
@@ -105,10 +105,8 @@ Motors with rotation sensors
|
|||||||
.. blockimg:: pybricks_blockMotorConfigure_motor_max_speed
|
.. blockimg:: pybricks_blockMotorConfigure_motor_max_speed
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockMotorConfigure_motor_acceleration
|
.. blockimg:: pybricks_blockMotorConfigure_motor_acceleration
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockMotorConfigure_motor_max_torque
|
.. blockimg:: pybricks_blockMotorConfigure_motor_max_torque
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.pupdevices.Motor.control.limits
|
.. automethod:: pybricks.pupdevices.Motor.control.limits
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Remote Control
|
|||||||
.. blockimg:: pybricks_variables_set_remote_connect_any
|
.. blockimg:: pybricks_variables_set_remote_connect_any
|
||||||
|
|
||||||
.. blockimg:: pybricks_variables_set_remote_connect_name
|
.. blockimg:: pybricks_variables_set_remote_connect_name
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autoclass:: pybricks.pupdevices.Remote
|
.. autoclass:: pybricks.pupdevices.Remote
|
||||||
:no-members:
|
:no-members:
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ Tilt Sensor
|
|||||||
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.pitch
|
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.pitch
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.roll
|
.. blockimg:: pybricks_blockTilt_TiltSensor_imu.tilt.roll
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: tilt
|
.. automethod:: tilt
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ Ultrasonic Sensor
|
|||||||
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on
|
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on_list
|
.. blockimg:: pybricks_blockLightOn_ultrasonicsensor_on_list
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. automethod:: pybricks.pupdevices::UltrasonicSensor.lights.on
|
.. automethod:: pybricks.pupdevices::UltrasonicSensor.lights.on
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,24 @@
|
|||||||
|
|
||||||
.. automethod:: pybricks.robotics.DriveBase.turn
|
.. automethod:: pybricks.robotics.DriveBase.turn
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockDriveBaseDrive_drivebase_drive_curve
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
.. automethod:: pybricks.robotics.DriveBase.curve
|
The ``curve()`` Python method will be replaced by the :meth:`.arc`
|
||||||
|
method. It can still make curves, but it uses different definitions
|
||||||
|
for drive and turn direction. Existing code with ``curve()`` continues
|
||||||
|
to work the same, but you should use :meth:`.arc` for new code.
|
||||||
|
If you use block code, you can pick a new block from the palette to
|
||||||
|
update your code. The old block will still work, but it displays a
|
||||||
|
warning icon to remind you to upgrade. The updated `curve` option uses
|
||||||
|
the direction definitions given below. The new `veer` option lets
|
||||||
|
you drive along a circle by a given distance, which is useful for
|
||||||
|
veering slightly in one direction.
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockDriveBaseDrive2_drivebase_drive_arc_angle
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockDriveBaseDrive2_drivebase_drive_arc_distance
|
||||||
|
|
||||||
|
.. automethod:: pybricks.robotics.DriveBase.arc
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockDriveBaseConfigure_drivebase_straight_speed
|
.. blockimg:: pybricks_blockDriveBaseConfigure_drivebase_straight_speed
|
||||||
|
|
||||||
@@ -81,6 +96,12 @@
|
|||||||
|
|
||||||
.. automethod:: pybricks.robotics.DriveBase.state
|
.. automethod:: pybricks.robotics.DriveBase.state
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
|
Now stops the drive base. You can now use nonzero values.
|
||||||
|
|
||||||
|
.. blockimg:: pybricks_blockDriveBaseResetWithValues
|
||||||
|
|
||||||
.. automethod:: pybricks.robotics.DriveBase.reset
|
.. automethod:: pybricks.robotics.DriveBase.reset
|
||||||
|
|
||||||
.. automethod:: pybricks.robotics.DriveBase.stalled
|
.. automethod:: pybricks.robotics.DriveBase.stalled
|
||||||
@@ -114,7 +135,7 @@
|
|||||||
``then=Stop.COAST`` in your last
|
``then=Stop.COAST`` in your last
|
||||||
:meth:`straight <pybricks.robotics.DriveBase.straight>`,
|
:meth:`straight <pybricks.robotics.DriveBase.straight>`,
|
||||||
:meth:`turn <pybricks.robotics.DriveBase.turn>`, or
|
:meth:`turn <pybricks.robotics.DriveBase.turn>`, or
|
||||||
:meth:`curve <pybricks.robotics.DriveBase.curve>` command.
|
:meth:`curve <pybricks.robotics.DriveBase.arc>` command.
|
||||||
|
|
||||||
.. _measuring:
|
.. _measuring:
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,10 @@ Input tools
|
|||||||
.. blockimg:: pybricks_blockReadInput_read_input_first_byte
|
.. blockimg:: pybricks_blockReadInput_read_input_first_byte
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockReadInput_read_input_first_char
|
.. blockimg:: pybricks_blockReadInput_read_input_first_char
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockReadInput_read_input_last_byte
|
.. blockimg:: pybricks_blockReadInput_read_input_last_byte
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. blockimg:: pybricks_blockReadInput_read_input_last_char
|
.. blockimg:: pybricks_blockReadInput_read_input_last_char
|
||||||
:stack:
|
|
||||||
|
|
||||||
.. autofunction:: pybricks.tools.read_input_byte
|
.. autofunction:: pybricks.tools.read_input_byte
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ wait(1500)
|
|||||||
example_motor.stop()
|
example_motor.stop()
|
||||||
wait(1500)
|
wait(1500)
|
||||||
|
|
||||||
# Run at 70% duty cycle ("power") and then stop by coasting.
|
# Run at 50% duty cycle ("power") and then stop by coasting.
|
||||||
print("Demo of dc")
|
print("Demo of dc")
|
||||||
example_motor.dc(50)
|
example_motor.dc(50)
|
||||||
wait(1500)
|
wait(1500)
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 1.17.0 - 2025-02-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated `pybricks` package to v3.5.0b5.
|
||||||
|
|
||||||
## 1.16.0 - 2024-04-05
|
## 1.16.0 - 2024-04-05
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
# This file is automatically @generated by Poetry and should not be changed by hand.
|
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "black"
|
name = "black"
|
||||||
version = "22.12.0"
|
version = "22.12.0"
|
||||||
description = "The uncompromising code formatter."
|
description = "The uncompromising code formatter."
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
@@ -37,14 +36,13 @@ uvloop = ["uvloop (>=0.15.2)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "click"
|
name = "click"
|
||||||
version = "8.1.7"
|
version = "8.1.8"
|
||||||
description = "Composable command line interface toolkit"
|
description = "Composable command line interface toolkit"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
|
{file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"},
|
||||||
{file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
|
{file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@@ -54,7 +52,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
|||||||
name = "colorama"
|
name = "colorama"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
description = "Cross-platform colored terminal text."
|
description = "Cross-platform colored terminal text."
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||||
files = [
|
files = [
|
||||||
@@ -66,7 +63,6 @@ files = [
|
|||||||
name = "docstring-parser"
|
name = "docstring-parser"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
description = "Parse Python docstrings in reST, Google and Numpydoc format"
|
description = "Parse Python docstrings in reST, Google and Numpydoc format"
|
||||||
category = "main"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6,<4.0"
|
python-versions = ">=3.6,<4.0"
|
||||||
files = [
|
files = [
|
||||||
@@ -76,14 +72,13 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "exceptiongroup"
|
name = "exceptiongroup"
|
||||||
version = "1.2.0"
|
version = "1.2.2"
|
||||||
description = "Backport of PEP 654 (exception groups)"
|
description = "Backport of PEP 654 (exception groups)"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"},
|
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
|
||||||
{file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"},
|
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@@ -93,7 +88,6 @@ test = ["pytest (>=6)"]
|
|||||||
name = "flake8"
|
name = "flake8"
|
||||||
version = "4.0.1"
|
version = "4.0.1"
|
||||||
description = "the modular source code checker: pep8 pyflakes and co"
|
description = "the modular source code checker: pep8 pyflakes and co"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
files = [
|
files = [
|
||||||
@@ -110,7 +104,6 @@ pyflakes = ">=2.4.0,<2.5.0"
|
|||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
description = "brain-dead simple config-ini parsing"
|
description = "brain-dead simple config-ini parsing"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
@@ -122,7 +115,6 @@ files = [
|
|||||||
name = "jedi"
|
name = "jedi"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
description = "An autocompletion tool for Python that can be used for text editors."
|
description = "An autocompletion tool for Python that can be used for text editors."
|
||||||
category = "main"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
files = [
|
files = [
|
||||||
@@ -141,7 +133,6 @@ testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<7.0.0)"]
|
|||||||
name = "mccabe"
|
name = "mccabe"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
description = "McCabe checker, plugin for flake8"
|
description = "McCabe checker, plugin for flake8"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
files = [
|
files = [
|
||||||
@@ -153,7 +144,6 @@ files = [
|
|||||||
name = "mypy-extensions"
|
name = "mypy-extensions"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
description = "Type system extensions for programs checked with the mypy type checker."
|
description = "Type system extensions for programs checked with the mypy type checker."
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.5"
|
python-versions = ">=3.5"
|
||||||
files = [
|
files = [
|
||||||
@@ -163,21 +153,19 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "packaging"
|
name = "packaging"
|
||||||
version = "24.0"
|
version = "24.2"
|
||||||
description = "Core utilities for Python packages"
|
description = "Core utilities for Python packages"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"},
|
{file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
|
||||||
{file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"},
|
{file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parso"
|
name = "parso"
|
||||||
version = "0.8.4"
|
version = "0.8.4"
|
||||||
description = "A Python Parser"
|
description = "A Python Parser"
|
||||||
category = "main"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
files = [
|
files = [
|
||||||
@@ -193,7 +181,6 @@ testing = ["docopt", "pytest"]
|
|||||||
name = "pathspec"
|
name = "pathspec"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
description = "Utility library for gitignore style pattern matching of file paths."
|
description = "Utility library for gitignore style pattern matching of file paths."
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
@@ -203,30 +190,29 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "platformdirs"
|
name = "platformdirs"
|
||||||
version = "4.2.0"
|
version = "4.3.6"
|
||||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"},
|
{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},
|
||||||
{file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"},
|
{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
|
docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
|
||||||
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
|
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
|
||||||
|
type = ["mypy (>=1.11.2)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pluggy"
|
name = "pluggy"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
description = "plugin and hook calling mechanisms for python"
|
description = "plugin and hook calling mechanisms for python"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"},
|
{file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
|
||||||
{file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"},
|
{file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@@ -235,9 +221,8 @@ testing = ["pytest", "pytest-benchmark"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pybricks"
|
name = "pybricks"
|
||||||
version = "3.5.0b2"
|
version = "3.6.0b5"
|
||||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||||
category = "main"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "^3.8"
|
python-versions = "^3.8"
|
||||||
files = []
|
files = []
|
||||||
@@ -251,7 +236,6 @@ url = ".."
|
|||||||
name = "pycodestyle"
|
name = "pycodestyle"
|
||||||
version = "2.8.0"
|
version = "2.8.0"
|
||||||
description = "Python style guide checker"
|
description = "Python style guide checker"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
files = [
|
files = [
|
||||||
@@ -263,7 +247,6 @@ files = [
|
|||||||
name = "pyflakes"
|
name = "pyflakes"
|
||||||
version = "2.4.0"
|
version = "2.4.0"
|
||||||
description = "passive checker of Python programs"
|
description = "passive checker of Python programs"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
files = [
|
files = [
|
||||||
@@ -275,7 +258,6 @@ files = [
|
|||||||
name = "pytest"
|
name = "pytest"
|
||||||
version = "7.4.4"
|
version = "7.4.4"
|
||||||
description = "pytest: simple powerful testing with Python"
|
description = "pytest: simple powerful testing with Python"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
@@ -296,21 +278,49 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tomli"
|
name = "tomli"
|
||||||
version = "2.0.1"
|
version = "2.2.1"
|
||||||
description = "A lil' TOML parser"
|
description = "A lil' TOML parser"
|
||||||
category = "dev"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
|
||||||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
|
||||||
|
{file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
|
||||||
|
{file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
|
||||||
|
{file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
|
||||||
|
{file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
|
||||||
|
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typing-extensions"
|
name = "typing-extensions"
|
||||||
version = "4.2.0"
|
version = "4.2.0"
|
||||||
description = "Backported and Experimental Type Hints for Python 3.7+"
|
description = "Backported and Experimental Type Hints for Python 3.7+"
|
||||||
category = "main"
|
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
@@ -321,4 +331,4 @@ files = [
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">= 3.10, < 3.12"
|
python-versions = ">= 3.10, < 3.12"
|
||||||
content-hash = "a634c0231937213565b3dff33539075fd544a4261bf8f84e99b294f34ec7edd4"
|
content-hash = "0a796ac6867c41e8cf0ce289beca1cebb4066b622c2c538c11589413dcb579af"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pybricks_jedi"
|
name = "pybricks_jedi"
|
||||||
version = "1.16.0"
|
version = "1.17.0"
|
||||||
description = "Code completion for Pybricks."
|
description = "Code completion for Pybricks."
|
||||||
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">= 3.10, < 3.12"
|
python = ">= 3.10, < 3.12"
|
||||||
pybricks = "3.5.0b2"
|
pybricks = "3.6.0b5"
|
||||||
jedi = "0.18.1"
|
jedi = "0.18.1"
|
||||||
typing-extensions = "4.2.0"
|
typing-extensions = "4.2.0"
|
||||||
docstring-parser = "0.14.1"
|
docstring-parser = "0.14.1"
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ def test_hub_dot_system_dot():
|
|||||||
code = _create_snippet(line)
|
code = _create_snippet(line)
|
||||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||||
assert [c["insertText"] for c in completions] == [
|
assert [c["insertText"] for c in completions] == [
|
||||||
"name",
|
"info",
|
||||||
"reset_reason",
|
"reset_storage",
|
||||||
"set_stop_button",
|
"set_stop_button",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ def test_hub_dot_system_dot():
|
|||||||
code = _create_snippet(line)
|
code = _create_snippet(line)
|
||||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||||
assert [c["insertText"] for c in completions] == [
|
assert [c["insertText"] for c in completions] == [
|
||||||
"name",
|
"info",
|
||||||
"reset_reason",
|
"reset_storage",
|
||||||
"set_stop_button",
|
"set_stop_button",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ def test_hub_dot_system_dot():
|
|||||||
code = _create_snippet(line)
|
code = _create_snippet(line)
|
||||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||||
assert [c["insertText"] for c in completions] == [
|
assert [c["insertText"] for c in completions] == [
|
||||||
"name",
|
"info",
|
||||||
"reset_reason",
|
"reset_storage",
|
||||||
"set_stop_button",
|
"set_stop_button",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ def test_hub_dot_system_dot():
|
|||||||
code = _create_snippet(line)
|
code = _create_snippet(line)
|
||||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||||
assert [c["insertText"] for c in completions] == [
|
assert [c["insertText"] for c in completions] == [
|
||||||
"name",
|
"info",
|
||||||
"reset_reason",
|
"reset_storage",
|
||||||
"set_stop_button",
|
"set_stop_button",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ def test_hub_dot_system_dot():
|
|||||||
code = _create_snippet(line)
|
code = _create_snippet(line)
|
||||||
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
|
||||||
assert [c["insertText"] for c in completions] == [
|
assert [c["insertText"] for c in completions] == [
|
||||||
"name",
|
"info",
|
||||||
"reset_reason",
|
"reset_storage",
|
||||||
"set_stop_button",
|
"set_stop_button",
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -86,12 +86,12 @@ CONSTRUCTOR_PARAMS = [
|
|||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"MoveHub",
|
"MoveHub",
|
||||||
[["broadcast_channel: int=0", "observe_channels: Sequence[int]=[]"]],
|
[["broadcast_channel: int=None", "observe_channels: Sequence[int]=[]"]],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"CityHub",
|
"CityHub",
|
||||||
[["broadcast_channel: int=0", "observe_channels: Sequence[int]=[]"]],
|
[["broadcast_channel: int=None", "observe_channels: Sequence[int]=[]"]],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -100,7 +100,7 @@ CONSTRUCTOR_PARAMS = [
|
|||||||
[
|
[
|
||||||
"top_side: Axis=Axis.Z",
|
"top_side: Axis=Axis.Z",
|
||||||
"front_side: Axis=Axis.X",
|
"front_side: Axis=Axis.X",
|
||||||
"broadcast_channel: int=0",
|
"broadcast_channel: int=None",
|
||||||
"observe_channels: Sequence[int]=[]",
|
"observe_channels: Sequence[int]=[]",
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -112,7 +112,7 @@ CONSTRUCTOR_PARAMS = [
|
|||||||
[
|
[
|
||||||
"top_side: Axis=Axis.Z",
|
"top_side: Axis=Axis.Z",
|
||||||
"front_side: Axis=Axis.X",
|
"front_side: Axis=Axis.X",
|
||||||
"broadcast_channel: int=0",
|
"broadcast_channel: int=None",
|
||||||
"observe_channels: Sequence[int]=[]",
|
"observe_channels: Sequence[int]=[]",
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -124,7 +124,7 @@ CONSTRUCTOR_PARAMS = [
|
|||||||
[
|
[
|
||||||
"top_side: Axis=Axis.Z",
|
"top_side: Axis=Axis.Z",
|
||||||
"front_side: Axis=Axis.X",
|
"front_side: Axis=Axis.X",
|
||||||
"broadcast_channel: int=0",
|
"broadcast_channel: int=None",
|
||||||
"observe_channels: Sequence[int]=[]",
|
"observe_channels: Sequence[int]=[]",
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -264,7 +264,6 @@ METHOD_PARAMS = [
|
|||||||
"system.set_stop_button",
|
"system.set_stop_button",
|
||||||
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "MoveHub", "system.name", [([], "str")]),
|
|
||||||
pytest.param("pybricks.hubs", "MoveHub", "system.shutdown", [([], "None")]),
|
pytest.param("pybricks.hubs", "MoveHub", "system.shutdown", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -275,7 +274,6 @@ METHOD_PARAMS = [
|
|||||||
(["offset: int", "*", "write: bytes"], "None"),
|
(["offset: int", "*", "write: bytes"], "None"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "MoveHub", "system.reset_reason", [([], "int")]),
|
|
||||||
pytest.param("pybricks.hubs", "CityHub", "light.on", [(["color: Color"], "None")]),
|
pytest.param("pybricks.hubs", "CityHub", "light.on", [(["color: Color"], "None")]),
|
||||||
pytest.param("pybricks.hubs", "CityHub", "light.off", [([], "None")]),
|
pytest.param("pybricks.hubs", "CityHub", "light.off", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
@@ -299,7 +297,6 @@ METHOD_PARAMS = [
|
|||||||
"system.set_stop_button",
|
"system.set_stop_button",
|
||||||
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "CityHub", "system.name", [([], "str")]),
|
|
||||||
pytest.param("pybricks.hubs", "CityHub", "system.shutdown", [([], "None")]),
|
pytest.param("pybricks.hubs", "CityHub", "system.shutdown", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -310,7 +307,6 @@ METHOD_PARAMS = [
|
|||||||
(["offset: int", "*", "write: bytes"], "None"),
|
(["offset: int", "*", "write: bytes"], "None"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "CityHub", "system.reset_reason", [([], "int")]),
|
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs", "TechnicHub", "light.on", [(["color: Color"], "None")]
|
"pybricks.hubs", "TechnicHub", "light.on", [(["color: Color"], "None")]
|
||||||
),
|
),
|
||||||
@@ -327,19 +323,35 @@ METHOD_PARAMS = [
|
|||||||
"light.animate",
|
"light.animate",
|
||||||
[(["colors: Collection[Color]", "interval: Number"], "None")],
|
[(["colors: Collection[Color]", "interval: Number"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "imu.up", [([], "Side")]),
|
pytest.param(
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "imu.tilt", [([], "Tuple[int, int]")]),
|
"pybricks.hubs",
|
||||||
|
"TechnicHub",
|
||||||
|
"imu.up",
|
||||||
|
[(["calibrated: bool=True"], "Side")],
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
"pybricks.hubs",
|
||||||
|
"TechnicHub",
|
||||||
|
"imu.tilt",
|
||||||
|
[(["calibrated: bool=True"], "Tuple[int, int]")],
|
||||||
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"TechnicHub",
|
"TechnicHub",
|
||||||
"imu.acceleration",
|
"imu.acceleration",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"TechnicHub",
|
"TechnicHub",
|
||||||
"imu.angular_velocity",
|
"imu.angular_velocity",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "imu.heading", [([], "float")]),
|
pytest.param("pybricks.hubs", "TechnicHub", "imu.heading", [([], "float")]),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "imu.orientation", [([], "Matrix")]),
|
pytest.param("pybricks.hubs", "TechnicHub", "imu.orientation", [([], "Matrix")]),
|
||||||
@@ -353,7 +365,7 @@ METHOD_PARAMS = [
|
|||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"TechnicHub",
|
"TechnicHub",
|
||||||
"imu.rotation",
|
"imu.rotation",
|
||||||
[(["axis: Axis"], "float")],
|
[(["axis: Axis", "calibrated: bool=True"], "float")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "battery.voltage", [([], "int")]),
|
pytest.param("pybricks.hubs", "TechnicHub", "battery.voltage", [([], "int")]),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "battery.current", [([], "int")]),
|
pytest.param("pybricks.hubs", "TechnicHub", "battery.current", [([], "int")]),
|
||||||
@@ -366,7 +378,6 @@ METHOD_PARAMS = [
|
|||||||
"system.set_stop_button",
|
"system.set_stop_button",
|
||||||
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "system.name", [([], "str")]),
|
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "system.shutdown", [([], "None")]),
|
pytest.param("pybricks.hubs", "TechnicHub", "system.shutdown", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -377,7 +388,6 @@ METHOD_PARAMS = [
|
|||||||
(["offset: int", "*", "write: bytes"], "None"),
|
(["offset: int", "*", "write: bytes"], "None"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "TechnicHub", "system.reset_reason", [([], "int")]),
|
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "light.on", [(["color: Color"], "None")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "light.on", [(["color: Color"], "None")]),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "light.off", [([], "None")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "light.off", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
@@ -424,19 +434,32 @@ METHOD_PARAMS = [
|
|||||||
[(["text: str", "on: Number=500", "off: Number=50"], "None")],
|
[(["text: str", "on: Number=500", "off: Number=50"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "buttons.pressed", [([], "Set[Button]")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "buttons.pressed", [([], "Set[Button]")]),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "imu.up", [([], "Side")]),
|
pytest.param(
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "imu.tilt", [([], "Tuple[int, int]")]),
|
"pybricks.hubs", "PrimeHub", "imu.up", [(["calibrated: bool=True"], "Side")]
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
"pybricks.hubs",
|
||||||
|
"PrimeHub",
|
||||||
|
"imu.tilt",
|
||||||
|
[(["calibrated: bool=True"], "Tuple[int, int]")],
|
||||||
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"PrimeHub",
|
"PrimeHub",
|
||||||
"imu.acceleration",
|
"imu.acceleration",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"PrimeHub",
|
"PrimeHub",
|
||||||
"imu.angular_velocity",
|
"imu.angular_velocity",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "imu.heading", [([], "float")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "imu.heading", [([], "float")]),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "imu.orientation", [([], "Matrix")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "imu.orientation", [([], "Matrix")]),
|
||||||
@@ -450,7 +473,7 @@ METHOD_PARAMS = [
|
|||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"PrimeHub",
|
"PrimeHub",
|
||||||
"imu.rotation",
|
"imu.rotation",
|
||||||
[(["axis: Axis"], "float")],
|
[(["axis: Axis", "calibrated: bool=True"], "float")],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -481,7 +504,6 @@ METHOD_PARAMS = [
|
|||||||
"system.set_stop_button",
|
"system.set_stop_button",
|
||||||
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "system.name", [([], "str")]),
|
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "system.shutdown", [([], "None")]),
|
pytest.param("pybricks.hubs", "PrimeHub", "system.shutdown", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -492,7 +514,6 @@ METHOD_PARAMS = [
|
|||||||
(["offset: int", "*", "write: bytes"], "None"),
|
(["offset: int", "*", "write: bytes"], "None"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "PrimeHub", "system.reset_reason", [([], "int")]),
|
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs", "EssentialHub", "light.on", [(["color: Color"], "None")]
|
"pybricks.hubs", "EssentialHub", "light.on", [(["color: Color"], "None")]
|
||||||
),
|
),
|
||||||
@@ -512,21 +533,32 @@ METHOD_PARAMS = [
|
|||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs", "EssentialHub", "buttons.pressed", [([], "Set[Button]")]
|
"pybricks.hubs", "EssentialHub", "buttons.pressed", [([], "Set[Button]")]
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "imu.up", [([], "Side")]),
|
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs", "EssentialHub", "imu.tilt", [([], "Tuple[int, int]")]
|
"pybricks.hubs", "EssentialHub", "imu.up", [(["calibrated: bool=True"], "Side")]
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
"pybricks.hubs",
|
||||||
|
"EssentialHub",
|
||||||
|
"imu.tilt",
|
||||||
|
[(["calibrated: bool=True"], "Tuple[int, int]")],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"EssentialHub",
|
"EssentialHub",
|
||||||
"imu.acceleration",
|
"imu.acceleration",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"EssentialHub",
|
"EssentialHub",
|
||||||
"imu.angular_velocity",
|
"imu.angular_velocity",
|
||||||
[(["axis: Axis"], "float"), ([], "Matrix")],
|
[
|
||||||
|
(["axis: Axis=None", "calibrated: bool=True"], "float"),
|
||||||
|
(["calibrated: bool=True"], "Matrix"),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "imu.heading", [([], "float")]),
|
pytest.param("pybricks.hubs", "EssentialHub", "imu.heading", [([], "float")]),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "imu.orientation", [([], "Matrix")]),
|
pytest.param("pybricks.hubs", "EssentialHub", "imu.orientation", [([], "Matrix")]),
|
||||||
@@ -540,7 +572,7 @@ METHOD_PARAMS = [
|
|||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
"EssentialHub",
|
"EssentialHub",
|
||||||
"imu.rotation",
|
"imu.rotation",
|
||||||
[(["axis: Axis"], "float")],
|
[(["axis: Axis", "calibrated: bool=True"], "float")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "battery.voltage", [([], "int")]),
|
pytest.param("pybricks.hubs", "EssentialHub", "battery.voltage", [([], "int")]),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "battery.current", [([], "int")]),
|
pytest.param("pybricks.hubs", "EssentialHub", "battery.current", [([], "int")]),
|
||||||
@@ -553,7 +585,6 @@ METHOD_PARAMS = [
|
|||||||
"system.set_stop_button",
|
"system.set_stop_button",
|
||||||
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
[(["button: Optional[Union[Button, Iterable[Button]]]"], "None")],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "system.name", [([], "str")]),
|
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "system.shutdown", [([], "None")]),
|
pytest.param("pybricks.hubs", "EssentialHub", "system.shutdown", [([], "None")]),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.hubs",
|
"pybricks.hubs",
|
||||||
@@ -564,7 +595,6 @@ METHOD_PARAMS = [
|
|||||||
(["offset: int", "*", "write: bytes"], "None"),
|
(["offset: int", "*", "write: bytes"], "None"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.hubs", "EssentialHub", "system.reset_reason", [([], "int")]),
|
|
||||||
# TODO: iodevices module here
|
# TODO: iodevices module here
|
||||||
pytest.param("pybricks.pupdevices", "DCMotor", "dc", [(["duty: Number"], "None")]),
|
pytest.param("pybricks.pupdevices", "DCMotor", "dc", [(["duty: Number"], "None")]),
|
||||||
pytest.param("pybricks.pupdevices", "DCMotor", "stop", [([], "None")]),
|
pytest.param("pybricks.pupdevices", "DCMotor", "stop", [([], "None")]),
|
||||||
@@ -994,7 +1024,12 @@ METHOD_PARAMS = [
|
|||||||
pytest.param(
|
pytest.param(
|
||||||
"pybricks.robotics", "DriveBase", "state", [([], "Tuple[int, int, int, int]")]
|
"pybricks.robotics", "DriveBase", "state", [([], "Tuple[int, int, int, int]")]
|
||||||
),
|
),
|
||||||
pytest.param("pybricks.robotics", "DriveBase", "reset", [([], "None")]),
|
pytest.param(
|
||||||
|
"pybricks.robotics",
|
||||||
|
"DriveBase",
|
||||||
|
"reset",
|
||||||
|
[(["distance: Number=0", "angle: Number=0"], "None")],
|
||||||
|
),
|
||||||
pytest.param("pybricks.robotics", "DriveBase", "done", [([], "bool")]),
|
pytest.param("pybricks.robotics", "DriveBase", "done", [([], "bool")]),
|
||||||
pytest.param("pybricks.robotics", "DriveBase", "stalled", [([], "bool")]),
|
pytest.param("pybricks.robotics", "DriveBase", "stalled", [([], "bool")]),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||||
|
|
||||||
|
## 2.20.0 - 2024-02-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated docs to v3.6.0b5.
|
||||||
|
|
||||||
## 2.19.0 - 2024-04-11
|
## 2.19.0 - 2024-04-11
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pybricks/ide-docs",
|
"name": "@pybricks/ide-docs",
|
||||||
"version": "2.19.0",
|
"version": "2.20.0",
|
||||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||||
|
|
||||||
|
## 1.4.0 - 2022-12-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added existing NXT and EV3 hub images to published package.
|
||||||
|
|
||||||
## 1.3.0 - 2022-12-19
|
## 1.3.0 - 2022-12-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
|||||||
IMAGE_DIR = (
|
IMAGE_DIR = (
|
||||||
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "diagrams"
|
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "diagrams"
|
||||||
).resolve()
|
).resolve()
|
||||||
HUBS = ["move", "city", "technic", "prime", "essential", "inventor"]
|
HUBS = ["move", "city", "technic", "prime", "essential", "inventor", "ev3", "nxt"]
|
||||||
|
|
||||||
package_json = {
|
package_json = {
|
||||||
"name": "@pybricks/images",
|
"name": "@pybricks/images",
|
||||||
"version": "1.3.0",
|
"version": "1.4.0",
|
||||||
"description": "Distribution of Pybricks images.",
|
"description": "Distribution of Pybricks images.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 1.17.0 - 2025-02-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated `pybricks_jedi` Python package to v1.17.0.
|
||||||
|
|
||||||
## 1.16.0 - 2024-04-05
|
## 1.16.0 - 2024-04-05
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
|||||||
|
|
||||||
package_json = {
|
package_json = {
|
||||||
"name": "@pybricks/jedi",
|
"name": "@pybricks/jedi",
|
||||||
"version": "1.16.0",
|
"version": "1.17.0",
|
||||||
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
|
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -38,7 +38,7 @@ subprocess.check_call(
|
|||||||
"pip",
|
"pip",
|
||||||
"download",
|
"download",
|
||||||
"--only-binary=any",
|
"--only-binary=any",
|
||||||
"pybricks-jedi==1.16.0",
|
"pybricks-jedi==1.17.0",
|
||||||
],
|
],
|
||||||
cwd=BUILD_DIR,
|
cwd=BUILD_DIR,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pybricks"
|
name = "pybricks"
|
||||||
version = "3.5.0"
|
version = "3.6.1"
|
||||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||||
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
||||||
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
||||||
|
|||||||
@@ -69,32 +69,6 @@ class System:
|
|||||||
|
|
||||||
Stops your program and shuts the hub down."""
|
Stops your program and shuts the hub down."""
|
||||||
|
|
||||||
def reset_reason(self) -> int:
|
|
||||||
"""reset_reason() -> int
|
|
||||||
|
|
||||||
Finds out how and why the hub (re)booted. This can be useful to
|
|
||||||
diagnose some problems.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
* ``0`` if the hub was previously powered off
|
|
||||||
normally.
|
|
||||||
* ``1`` if the hub rebooted automatically, like
|
|
||||||
after a firmware update.
|
|
||||||
* ``2`` if the hub previously
|
|
||||||
crashed due to a watchdog timeout, which indicates a firmware
|
|
||||||
issue.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def name(self) -> str:
|
|
||||||
"""name() -> str
|
|
||||||
|
|
||||||
Gets the hub name. This is the name you see when connecting
|
|
||||||
via Bluetooth.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The hub name.
|
|
||||||
"""
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def storage(self, offset: int, *, read: int) -> bytes: ...
|
def storage(self, offset: int, *, read: int) -> bytes: ...
|
||||||
|
|
||||||
@@ -131,6 +105,40 @@ class System:
|
|||||||
If you try to read or write data outside of the allowed range.
|
If you try to read or write data outside of the allowed range.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def reset_storage(self) -> None:
|
||||||
|
"""reset_storage()
|
||||||
|
|
||||||
|
Resets all user settings to default values and erases user programs.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def info(self) -> dict:
|
||||||
|
"""info() -> dict
|
||||||
|
|
||||||
|
Gets information about the hub as a dictionary with the following keys:
|
||||||
|
|
||||||
|
- ``"name"``: The hub name. This is the name you see when connecting
|
||||||
|
via Bluetooth.
|
||||||
|
- ``"reset_reason"``: Why the hub (re)booted. It is ``0`` if the hub
|
||||||
|
was previously powered off normally. It is ``1`` if the hub rebooted
|
||||||
|
automatically, like after a firmware update. It is ``2`` if the hub
|
||||||
|
previously crashed due to a watchdog timeout, which indicates a
|
||||||
|
firmware issue.
|
||||||
|
- ``"host_connected_ble"``: ``True`` if the hub is connected to a
|
||||||
|
computer, tablet, or phone via Bluetooth, and ``False`` otherwise.
|
||||||
|
- ``"program_start_type"``: It is ``1`` if the program started
|
||||||
|
automatically when the hub was powered on. It is ``2`` if the program
|
||||||
|
was started with the hub buttons. It is ``3`` if the program was
|
||||||
|
started from your connected computer.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A dictionary with system info.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
The name and reset reason where previously available as separate
|
||||||
|
methods. Now they are included in the info dictionary. The methods
|
||||||
|
are still available for backwards compatibility.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class DCMotor:
|
class DCMotor:
|
||||||
"""Generic class to control simple motors without rotation sensors, such
|
"""Generic class to control simple motors without rotation sensors, such
|
||||||
@@ -471,6 +479,11 @@ class Motor(DCMotor):
|
|||||||
|
|
||||||
Sets the accumulated rotation angle of the motor to a desired value.
|
Sets the accumulated rotation angle of the motor to a desired value.
|
||||||
|
|
||||||
|
If this motor is also being used by a drive base, its distance and
|
||||||
|
angle values will also be affected. You might want to
|
||||||
|
use its :meth:`reset <pybricks.robotics.DriveBase.reset>`
|
||||||
|
method instead.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
angle (Number, deg): Value to which the angle should be reset.
|
angle (Number, deg): Value to which the angle should be reset.
|
||||||
"""
|
"""
|
||||||
@@ -1013,34 +1026,67 @@ class SimpleAccelerometer:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Accelerometer(SimpleAccelerometer):
|
class IMU:
|
||||||
"""Get measurements from an accelerometer."""
|
|
||||||
|
def up(self, calibrated: bool = True) -> Side:
|
||||||
|
"""up(calibrated=True) -> Side
|
||||||
|
|
||||||
|
Checks which side of the hub currently faces upward.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
calibrated (bool): Choose ``True`` to use calibrated gyroscope and
|
||||||
|
accelerometer data to determine which way is up. Choose
|
||||||
|
``False`` to use raw acceleration values.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``,
|
||||||
|
``Side.FRONT`` or ``Side.BACK``.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def tilt(self, calibrated: bool = True) -> Tuple[int, int]:
|
||||||
|
"""tilt(calibrated=True) -> Tuple[int, int]
|
||||||
|
|
||||||
|
Gets the pitch and roll angles. This is relative to the
|
||||||
|
:ref:`user-specified neutral orientation <robotframe>`.
|
||||||
|
|
||||||
|
The order of rotation is pitch-then-roll. This is equivalent to a
|
||||||
|
positive rotation along the robot y-axis and then a positive rotation
|
||||||
|
along the x-axis.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
calibrated (bool): Choose ``True`` to use calibrated gyroscope and
|
||||||
|
accelerometer data to determine the tilt. Choose ``False``
|
||||||
|
to use raw acceleration values.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Tuple of pitch and roll angles in degrees.
|
||||||
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def acceleration(self, axis: Axis) -> float: ...
|
def acceleration(self, axis: Axis = None, calibrated: bool = True) -> float: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def acceleration(self) -> Matrix: ...
|
def acceleration(self, calibrated: bool = True) -> Matrix: ...
|
||||||
|
|
||||||
def acceleration(self, *args):
|
def acceleration(self, *args):
|
||||||
"""
|
"""
|
||||||
acceleration(axis) -> float: mm/s²
|
acceleration(axis, calibrated=True) -> float: mm/s²
|
||||||
acceleration() -> vector: mm/s²
|
acceleration(calibrated=True) -> vector: mm/s²
|
||||||
|
|
||||||
|
|
||||||
Gets the acceleration of the device along a given axis in the
|
Gets the acceleration of the device along a given axis in the
|
||||||
:ref:`robot reference frame <robotframe>`.
|
:ref:`robot reference frame <robotframe>`.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
axis (Axis): Axis along which the acceleration should be
|
axis (Axis): Axis along which the acceleration should be
|
||||||
measured.
|
measured, or ``None`` to get a vector along all axes.
|
||||||
|
calibrated (bool): Choose ``True`` to use calibrated acceleration
|
||||||
|
values. Choose ``False`` to use raw acceleration values.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Acceleration along the specified axis. If you specify no axis,
|
Acceleration along the specified axis. If you specify no axis,
|
||||||
this returns a vector of accelerations along all axes.
|
this returns a vector of accelerations along all axes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class IMU(Accelerometer):
|
|
||||||
def ready(self) -> bool:
|
def ready(self) -> bool:
|
||||||
"""ready() -> bool
|
"""ready() -> bool
|
||||||
|
|
||||||
@@ -1068,38 +1114,91 @@ class IMU(Accelerometer):
|
|||||||
@overload
|
@overload
|
||||||
def settings(
|
def settings(
|
||||||
self,
|
self,
|
||||||
|
*,
|
||||||
angular_velocity_threshold: float = None,
|
angular_velocity_threshold: float = None,
|
||||||
acceleration_threshold: float = None,
|
acceleration_threshold: float = None,
|
||||||
|
heading_correction: float = None,
|
||||||
|
angular_velocity_bias: Tuple[float, float, float] = None,
|
||||||
|
angular_velocity_scale: Tuple[float, float, float] = None,
|
||||||
|
acceleration_correction: Tuple[float, float, float, float, float, float] = None,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def settings(self) -> Tuple[float, float]: ...
|
def settings(
|
||||||
|
self,
|
||||||
|
) -> Tuple[
|
||||||
|
float,
|
||||||
|
float,
|
||||||
|
float,
|
||||||
|
Tuple[float, float, float],
|
||||||
|
Tuple[float, float, float],
|
||||||
|
Tuple[float, float, float, float, float, float],
|
||||||
|
]: ...
|
||||||
|
|
||||||
def settings(self, *args):
|
def settings(self, *args):
|
||||||
"""
|
"""
|
||||||
settings(angular_velocity_threshold, acceleration_threshold)
|
settings(*, angular_velocity_threshold, acceleration_threshold, heading_correction, angular_velocity_bias, angular_velocity_scale, acceleration_correction)
|
||||||
settings() -> Tuple[float, float]
|
settings() -> Tuple
|
||||||
|
|
||||||
Configures the IMU settings. If no arguments are given,
|
Configures the IMU settings. If no arguments are given,
|
||||||
this returns the current values.
|
this returns the current values. Use keyword arguments for each value
|
||||||
|
to ensure correct behavior because settings may be added or changed in
|
||||||
|
future releases.
|
||||||
|
|
||||||
|
These IMU settings are saved on the hub. They will keep their values
|
||||||
|
until you change them again. The values will be reset to default values
|
||||||
|
if you update the hub to a different firmware version or call the
|
||||||
|
``hub.system.reset_storage`` method.
|
||||||
|
|
||||||
The ``angular_velocity_threshold`` and ``acceleration_threshold``
|
The ``angular_velocity_threshold`` and ``acceleration_threshold``
|
||||||
define when the hub is considered stationary. If all
|
define when the hub is considered stationary. If all
|
||||||
measurements stay below these thresholds for one second, the IMU
|
measurements stay below these thresholds for one second, the IMU
|
||||||
will recalibrate itself.
|
will recalibrate itself. In a noisy room with high ambient vibrations (such as a
|
||||||
|
competition hall), you can increase the thresholds
|
||||||
In a noisy room with high ambient vibrations (such as a
|
|
||||||
competition hall), it is recommended to increase the thresholds
|
|
||||||
slightly to give your robot the chance to calibrate.
|
slightly to give your robot the chance to calibrate.
|
||||||
To verify that your settings are working as expected, test that
|
To verify that your settings are working as expected, test that
|
||||||
the ``stationary()`` method gives ``False`` if your robot is moving,
|
the ``stationary()`` method gives ``False`` if your robot is moving,
|
||||||
and ``True`` if it is sitting still for at least a second.
|
and ``True`` if it is sitting still.
|
||||||
|
|
||||||
|
The gyroscope measures how fast the hub rotates to estimate the total
|
||||||
|
angle. Due to variations in the production process, each
|
||||||
|
hub consistently reports a different value for a full rotation. For
|
||||||
|
example, your hub might consistently report `357` degrees for every
|
||||||
|
`360` degree turn. You can measure this value
|
||||||
|
with ``hub.imu.rotation(-Axis.Z, calibrated=False)`` and enter it as
|
||||||
|
the ``heading_correction`` setting. Then, the ``hub.imu.heading()``
|
||||||
|
method will take it into account going forward, correctly scaling it
|
||||||
|
to 360 degrees for a full rotation.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
angular_velocity_threshold (Number, deg/s): The threshold for
|
angular_velocity_threshold (Number, deg/s): The threshold for
|
||||||
angular velocity. The default value is 1.5 deg/s.
|
variations in the angular velocity below which the hub is
|
||||||
acceleration_threshold (Number, mm/s²): The threshold for angular
|
considered stationary enough to calibrate.
|
||||||
velocity. The default value is 250 mm/s².
|
After a reset the value is 2 deg/s.
|
||||||
|
acceleration_threshold (Number, mm/s²): The threshold for
|
||||||
|
variations in acceleration below which the hub is considered
|
||||||
|
stationary enough to calibrate. After a reset the value
|
||||||
|
is 2500 mm/s².
|
||||||
|
heading_correction (Number, deg): Number of degrees
|
||||||
|
reported by for one full rotation of your robot.
|
||||||
|
After a reset the value is 360 degrees. This is applied on top
|
||||||
|
of any scaling that is done by the ``angular_velocity_scale``
|
||||||
|
setting.
|
||||||
|
angular_velocity_bias (tuple, deg/s): Initial bias for angular
|
||||||
|
velocity measurements along x, y, and z immediately after boot.
|
||||||
|
After a reset the value is (0, 0, 0) deg/s.
|
||||||
|
angular_velocity_scale (tuple, deg): Scale adjustment for x, y, and
|
||||||
|
z rotation to account for manufacturing differences. After a
|
||||||
|
reset the value is (360, 360, 360) deg/s. The correct values
|
||||||
|
can be obtained using `hub.imu.rotation(Axis.X, calibrated=False)`
|
||||||
|
and repeating it for each axis.
|
||||||
|
acceleration_correction (tuple, mm/s²): Scale adjustment for x, y,
|
||||||
|
and z gravity magnitude in both directions to account for
|
||||||
|
manufacturing differences. After a reset the
|
||||||
|
value is (9806.65, -9806.65, 9806.65, -9806.65, 9806.65, -9806.65) mm/s².
|
||||||
|
The correct values can be
|
||||||
|
obtained using `hub.imu.acceleration(Axis.X, calibrated=False)`
|
||||||
|
and repeating it for all axes in both directions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def heading(self) -> float:
|
def heading(self) -> float:
|
||||||
@@ -1117,11 +1216,11 @@ class IMU(Accelerometer):
|
|||||||
the robot is on a flat surface.*
|
the robot is on a flat surface.*
|
||||||
|
|
||||||
This means that the value is
|
This means that the value is
|
||||||
no longer correct if you lift it from the table. To solve
|
no longer correct if you lift it from the table or turn on
|
||||||
this, you can call ``reset_heading`` to reset the heading to
|
a ramp. Try ``hub.imu.heading('3D')`` for a heading value
|
||||||
a known value *after* you put it back down. For example, you
|
that compensates for this. This will become the default in a
|
||||||
could align your robot with the side of the competition table
|
future release. If you try it, please let us know on our
|
||||||
and reset the heading 90 degrees as the new starting point.
|
forums!
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Heading angle relative to starting orientation.
|
Heading angle relative to starting orientation.
|
||||||
@@ -1133,35 +1232,50 @@ class IMU(Accelerometer):
|
|||||||
|
|
||||||
Resets the accumulated heading angle of the robot.
|
Resets the accumulated heading angle of the robot.
|
||||||
|
|
||||||
|
This cannot be called while a drive base is using the gyro to drive or
|
||||||
|
hold position.
|
||||||
|
Use :meth:`DriveBase.reset() <pybricks.robotics.DriveBase.reset>`
|
||||||
|
instead, which will stop the robot and then set the new heading value.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6 Resetting the angle while driving is not allowed. Stop first.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
angle (Number, deg): Value to which the heading should be reset.
|
angle (Number, deg): Value to which the heading should be reset.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
OSError:
|
||||||
|
There is a drive base that is currently using the gyro.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def angular_velocity(self, axis: Axis) -> float: ...
|
def angular_velocity(self, axis: Axis = None, calibrated: bool = True) -> float: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def angular_velocity(self) -> Matrix: ...
|
def angular_velocity(self, calibrated: bool = True) -> Matrix: ...
|
||||||
|
|
||||||
def angular_velocity(self, *args):
|
def angular_velocity(self, *args):
|
||||||
"""
|
"""
|
||||||
angular_velocity(axis) -> float: deg/s
|
angular_velocity(axis, calibrated=True) -> float: deg/s
|
||||||
angular_velocity() -> vector: deg/s
|
angular_velocity(calibrated=True) -> vector: deg/s
|
||||||
|
|
||||||
Gets the angular velocity of the device along a given axis in
|
Gets the angular velocity of the device along a given axis in
|
||||||
the :ref:`robot reference frame <robotframe>`.
|
the :ref:`robot reference frame <robotframe>`.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
axis (Axis): Axis along which the angular velocity should be
|
axis (Axis): Axis along which the angular velocity should be
|
||||||
measured.
|
measured, or ``None`` to get a vector along all axes.
|
||||||
|
calibrated (bool): Choose ``True`` to compensate for the estimated
|
||||||
|
bias and configured scale of the gyroscope. Choose ``False``
|
||||||
|
to get raw angular velocity values.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Angular velocity along the specified axis. If you specify no axis,
|
Angular velocity along the specified axis. If you specify no axis,
|
||||||
this returns a vector of accelerations along all axes.
|
this returns a vector of accelerations along all axes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def rotation(self, axis: Axis) -> float:
|
def rotation(self, axis: Axis, calibrated: bool = True) -> float:
|
||||||
"""
|
"""
|
||||||
rotation(axis) -> float: deg
|
rotation(axis, calibrated=True) -> float: deg
|
||||||
|
|
||||||
Gets the rotation of the device along a given axis in
|
Gets the rotation of the device along a given axis in
|
||||||
the :ref:`robot reference frame <robotframe>`.
|
the :ref:`robot reference frame <robotframe>`.
|
||||||
@@ -1170,10 +1284,11 @@ class IMU(Accelerometer):
|
|||||||
axis. For general three-dimensional motion, use the
|
axis. For general three-dimensional motion, use the
|
||||||
``orientation()`` method instead.
|
``orientation()`` method instead.
|
||||||
|
|
||||||
The value starts counting from ``0`` when you initialize this class.
|
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
axis (Axis): Axis along which the rotation should be measured.
|
axis (Axis): Axis along which the rotation should be measured.
|
||||||
|
calibrated (bool): Choose ``True`` to compensate for configured
|
||||||
|
scale of the gyroscope. Choose ``False`` to get unscaled values.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The rotation angle.
|
The rotation angle.
|
||||||
"""
|
"""
|
||||||
@@ -1188,10 +1303,8 @@ class IMU(Accelerometer):
|
|||||||
It returns a rotation matrix whose columns represent the ``X``, ``Y``,
|
It returns a rotation matrix whose columns represent the ``X``, ``Y``,
|
||||||
and ``Z`` axis of the robot.
|
and ``Z`` axis of the robot.
|
||||||
|
|
||||||
.. note:: This method is not yet implemented.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The rotation matrix.
|
The 3x3 rotation matrix.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@@ -1335,14 +1448,14 @@ class BLE:
|
|||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def broadcast(self, data: Union[bool, int, float, str, bytes]) -> None:
|
def broadcast(self, data: Union[bool, int, float, str, bytes]) -> MaybeAwaitable:
|
||||||
"""broadcast(data)
|
"""broadcast(data)
|
||||||
|
|
||||||
Starts broadcasting the given data on
|
Starts broadcasting the given data on
|
||||||
the ``broadcast_channel`` you selected when initializing the hub.
|
the ``broadcast_channel`` you selected when initializing the hub.
|
||||||
|
|
||||||
Data may be of type ``int``, ``float``, ``str``, ``bytes``,
|
Data may be of type ``int``, ``float``, ``str``, ``bytes``,
|
||||||
``True``, or ``False``, or a list thereof.
|
``True``, or ``False``. It can also be a list or tuple of these.
|
||||||
|
|
||||||
Choose ``None`` to stop broadcasting. This helps improve performance
|
Choose ``None`` to stop broadcasting. This helps improve performance
|
||||||
when you don't need the broadcast feature, especially when observing
|
when you don't need the broadcast feature, especially when observing
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ class MoveHub:
|
|||||||
ble = _common.BLE()
|
ble = _common.BLE()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, broadcast_channel: int = 0, observe_channels: Sequence[int] = []
|
self, broadcast_channel: int = None, observe_channels: Sequence[int] = []
|
||||||
):
|
):
|
||||||
"""MoveHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[])
|
"""MoveHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=None, observe_channels=[])
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
top_side (Axis): The axis that passes through the *top side* of
|
top_side (Axis): The axis that passes through the *top side* of
|
||||||
@@ -54,8 +54,8 @@ class MoveHub:
|
|||||||
front_side (Axis): The axis that passes through the *front side* of
|
front_side (Axis): The axis that passes through the *front side* of
|
||||||
the hub.
|
the hub.
|
||||||
broadcast_channel:
|
broadcast_channel:
|
||||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
Channel number (0 to 255) used to broadcast data.
|
||||||
will use. Default is channel 0.
|
Choose ``None`` when not using broadcasting.
|
||||||
observe_channels:
|
observe_channels:
|
||||||
A list of channels to listen to when ``hub.ble.observe()`` is
|
A list of channels to listen to when ``hub.ble.observe()`` is
|
||||||
called. Listening to more channels requires more memory.
|
called. Listening to more channels requires more memory.
|
||||||
@@ -78,14 +78,14 @@ class CityHub:
|
|||||||
ble = _common.BLE()
|
ble = _common.BLE()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, broadcast_channel: int = 0, observe_channels: Sequence[int] = []
|
self, broadcast_channel: int = None, observe_channels: Sequence[int] = []
|
||||||
):
|
):
|
||||||
"""CityHub(broadcast_channel=0, observe_channels=[])
|
"""CityHub(broadcast_channel=None, observe_channels=[])
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
broadcast_channel:
|
broadcast_channel:
|
||||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
Channel number (0 to 255) used to broadcast data.
|
||||||
will use. Default is channel 0.
|
Choose ``None`` when not using broadcasting.
|
||||||
observe_channels:
|
observe_channels:
|
||||||
A list of channels to listen to when ``hub.ble.observe()`` is
|
A list of channels to listen to when ``hub.ble.observe()`` is
|
||||||
called. Listening to more channels requires more memory.
|
called. Listening to more channels requires more memory.
|
||||||
@@ -112,10 +112,10 @@ class TechnicHub:
|
|||||||
self,
|
self,
|
||||||
top_side: Axis = Axis.Z,
|
top_side: Axis = Axis.Z,
|
||||||
front_side: Axis = Axis.X,
|
front_side: Axis = Axis.X,
|
||||||
broadcast_channel: int = 0,
|
broadcast_channel: int = None,
|
||||||
observe_channels: Sequence[int] = [],
|
observe_channels: Sequence[int] = [],
|
||||||
):
|
):
|
||||||
"""TechnicHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[])
|
"""TechnicHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=None, observe_channels=[])
|
||||||
|
|
||||||
Initializes the hub. Optionally, specify how the hub is
|
Initializes the hub. Optionally, specify how the hub is
|
||||||
:ref:`placed in your design <robotframe>` by saying in which
|
:ref:`placed in your design <robotframe>` by saying in which
|
||||||
@@ -128,8 +128,8 @@ class TechnicHub:
|
|||||||
front_side (Axis): The axis that passes through the *front side* of
|
front_side (Axis): The axis that passes through the *front side* of
|
||||||
the hub.
|
the hub.
|
||||||
broadcast_channel:
|
broadcast_channel:
|
||||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
Channel number (0 to 255) used to broadcast data.
|
||||||
will use. Default is channel 0.
|
Choose ``None`` when not using broadcasting.
|
||||||
observe_channels:
|
observe_channels:
|
||||||
A list of channels to listen to when ``hub.ble.observe()`` is
|
A list of channels to listen to when ``hub.ble.observe()`` is
|
||||||
called. Listening to more channels requires more memory.
|
called. Listening to more channels requires more memory.
|
||||||
@@ -157,10 +157,10 @@ class EssentialHub:
|
|||||||
self,
|
self,
|
||||||
top_side: Axis = Axis.Z,
|
top_side: Axis = Axis.Z,
|
||||||
front_side: Axis = Axis.X,
|
front_side: Axis = Axis.X,
|
||||||
broadcast_channel: int = 0,
|
broadcast_channel: int = None,
|
||||||
observe_channels: Sequence[int] = [],
|
observe_channels: Sequence[int] = [],
|
||||||
):
|
):
|
||||||
"""EssentialHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[])
|
"""EssentialHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=None, observe_channels=[])
|
||||||
|
|
||||||
Initializes the hub. Optionally, specify how the hub is
|
Initializes the hub. Optionally, specify how the hub is
|
||||||
:ref:`placed in your design <robotframe>` by saying in which
|
:ref:`placed in your design <robotframe>` by saying in which
|
||||||
@@ -173,8 +173,8 @@ class EssentialHub:
|
|||||||
front_side (Axis): The axis that passes through the *front side* of
|
front_side (Axis): The axis that passes through the *front side* of
|
||||||
the hub.
|
the hub.
|
||||||
broadcast_channel:
|
broadcast_channel:
|
||||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
Channel number (0 to 255) used to broadcast data.
|
||||||
will use. Default is channel 0.
|
Choose ``None`` when not using broadcasting.
|
||||||
observe_channels:
|
observe_channels:
|
||||||
A list of channels to listen to when ``hub.ble.observe()`` is
|
A list of channels to listen to when ``hub.ble.observe()`` is
|
||||||
called. Listening to more channels requires more memory.
|
called. Listening to more channels requires more memory.
|
||||||
@@ -212,10 +212,10 @@ class PrimeHub:
|
|||||||
self,
|
self,
|
||||||
top_side: Axis = Axis.Z,
|
top_side: Axis = Axis.Z,
|
||||||
front_side: Axis = Axis.X,
|
front_side: Axis = Axis.X,
|
||||||
broadcast_channel: int = 0,
|
broadcast_channel: int = None,
|
||||||
observe_channels: Sequence[int] = [],
|
observe_channels: Sequence[int] = [],
|
||||||
):
|
):
|
||||||
"""PrimeHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=0, observe_channels=[])
|
"""PrimeHub(top_side=Axis.Z, front_side=Axis.X, broadcast_channel=None, observe_channels=[])
|
||||||
|
|
||||||
Initializes the hub. Optionally, specify how the hub is
|
Initializes the hub. Optionally, specify how the hub is
|
||||||
:ref:`placed in your design <robotframe>` by saying in which
|
:ref:`placed in your design <robotframe>` by saying in which
|
||||||
@@ -228,8 +228,8 @@ class PrimeHub:
|
|||||||
front_side (Axis): The axis that passes through the *front side* of
|
front_side (Axis): The axis that passes through the *front side* of
|
||||||
the hub.
|
the hub.
|
||||||
broadcast_channel:
|
broadcast_channel:
|
||||||
A value from 0 to 255 indicating which channel ``hub.ble.broadcast()``
|
Channel number (0 to 255) used to broadcast data.
|
||||||
will use. Default is channel 0.
|
Choose ``None`` when not using broadcasting.
|
||||||
observe_channels:
|
observe_channels:
|
||||||
A list of channels to listen to when ``hub.ble.observe()`` is
|
A list of channels to listen to when ``hub.ble.observe()`` is
|
||||||
called. Listening to more channels requires more memory.
|
called. Listening to more channels requires more memory.
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ class Color:
|
|||||||
The brightness value.
|
The brightness value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
"""Allows unpacking of the Color instance into h, s, and v."""
|
||||||
|
return iter((self.h, self.s, self.v))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "Color(h={}, s={}, v={})".format(self.h, self.s, self.v)
|
return "Color(h={}, s={}, v={})".format(self.h, self.s, self.v)
|
||||||
|
|
||||||
|
|||||||
@@ -86,11 +86,15 @@ class Motor(_common.Motor):
|
|||||||
|
|
||||||
Sets the accumulated rotation angle of the motor to a desired value.
|
Sets the accumulated rotation angle of the motor to a desired value.
|
||||||
|
|
||||||
If you don't specify an angle, the absolute angle
|
If this motor is also being used by a drive base, its distance and
|
||||||
will be used if your motor supports it.
|
angle values will also be affected. You might want to
|
||||||
|
use its :meth:`reset <pybricks.robotics.DriveBase.reset>`
|
||||||
|
method instead.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
angle (Number, deg): Value to which the angle should be reset.
|
angle (Number, deg): Value to which the angle should be reset.
|
||||||
|
Choose ``None`` to reset it to the absolute
|
||||||
|
value of the motor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,19 @@ class DriveBase:
|
|||||||
Tuple of distance, drive speed, angle, and turn rate of the robot.
|
Tuple of distance, drive speed, angle, and turn rate of the robot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def reset(self) -> None:
|
def reset(self, distance: Number = 0, angle: Number = 0) -> None:
|
||||||
"""reset()
|
"""reset(distance=0, angle=0)
|
||||||
|
|
||||||
Resets the estimated driven distance and angle to 0."""
|
Resets the estimated driven distance and heading angle.
|
||||||
|
|
||||||
|
This also calls :meth:`.stop` to stop ongoing movements.
|
||||||
|
If your robot is controlled with :meth:`.use_gyro` set to ``True``,
|
||||||
|
calling this method will `also` set the gyro to the given angle.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
distance (Number, mm): Speed of the robot.
|
||||||
|
angle (Number, deg): Heading angle of the robot.
|
||||||
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def settings(
|
def settings(
|
||||||
@@ -191,6 +200,40 @@ class DriveBase:
|
|||||||
with the rest of the program.
|
with the rest of the program.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def arc(
|
||||||
|
self,
|
||||||
|
radius: Number,
|
||||||
|
angle: Number = None,
|
||||||
|
distance: Number = None,
|
||||||
|
then: Stop = Stop.HOLD,
|
||||||
|
wait: bool = True,
|
||||||
|
) -> MaybeAwaitable:
|
||||||
|
"""arc(radius, angle=None, distance=None, then=Stop.HOLD, wait=True)
|
||||||
|
|
||||||
|
Drives an arc (a partial circle) with a given radius. You can specify
|
||||||
|
how far to drive using either an angle or a distance.
|
||||||
|
|
||||||
|
With a positive radius, the robot drives along a circle to its right.
|
||||||
|
With a negative radius, the robot drives along a circle to its left.
|
||||||
|
|
||||||
|
You can specify how far to travel along that circle as an angle
|
||||||
|
(degrees) or distance (mm). A positive value means driving forward
|
||||||
|
along the circle. Negative means driving in reverse.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
radius (Number, mm): Radius of the circle.
|
||||||
|
angle (Number, deg): Angle to drive along the circle.
|
||||||
|
distance (Number, mm): Distance to drive along the circle,
|
||||||
|
measured at the center of the robot.
|
||||||
|
then (Stop): What to do after coming to a standstill.
|
||||||
|
wait (bool): Wait for the maneuver to complete before continuing
|
||||||
|
with the rest of the program.
|
||||||
|
Raises:
|
||||||
|
ValueError:
|
||||||
|
You must specify ``angle`` or ``distance``, but not both. The
|
||||||
|
radius cannot be zero. Use :meth:`.turn` for in-place turns.
|
||||||
|
"""
|
||||||
|
|
||||||
def curve(
|
def curve(
|
||||||
self, radius: Number, angle: Number, then: Stop = Stop.HOLD, wait: bool = True
|
self, radius: Number, angle: Number, then: Stop = Stop.HOLD, wait: bool = True
|
||||||
) -> MaybeAwaitable:
|
) -> MaybeAwaitable:
|
||||||
@@ -224,7 +267,7 @@ class DriveBase:
|
|||||||
with the maximum actuation signal.
|
with the maximum actuation signal.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
``True`` if the drivebase is stalled, ``False`` if not.
|
``True`` if the drive base is stalled, ``False`` if not.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def use_gyro(self, use_gyro: bool) -> None:
|
def use_gyro(self, use_gyro: bool) -> None:
|
||||||
@@ -234,6 +277,9 @@ class DriveBase:
|
|||||||
straight. Choose ``False`` to rely only on the motor's built-in
|
straight. Choose ``False`` to rely only on the motor's built-in
|
||||||
rotation sensors.
|
rotation sensors.
|
||||||
|
|
||||||
|
This method will automatically call :meth:`.stop` to stop ongoing
|
||||||
|
movements.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
use_gyro (bool): ``True`` to enable, ``False`` to disable.
|
use_gyro (bool): ``True`` to enable, ``False`` to disable.
|
||||||
"""
|
"""
|
||||||
|
|||||||