Compare commits

...
Author SHA1 Message Date
David Lechner dd77c548d2 v3.1.0 2021-12-16 15:35:09 -06:00
David Lechner 022afabd30 pybricks.robotics: add type hint for curve()
This method was added in 30803fc.
2021-12-16 15:33:00 -06:00
David Lechner ce17123325 pybricks._common: remove type hint for integral_range()
This was removed in e061617.

Also fix import of Axis while we are touching this file.
2021-12-16 15:29:44 -06:00
Laurens Valk f2346df4e5 pybricks.iodevices: Hide LWP3Device
This is not part of the upcoming release.

Hiding is nicer than adding not-ready disclaimers throughout, especially since this information is very easy to access via our beta channel.
2021-12-01 15:39:05 +01:00
Laurens Valk 94c659ba6d pybricks.geometry: Hide module and IMU examples.
This is not part of the upcoming release.

Hiding is nicer than adding not-ready disclaimers throughout, especially since this information is very easy to access via our beta channel.
2021-12-01 15:39:04 +01:00
Laurens Valk 9c0298bad0 doc/main/index: Drop beta note.
This is a normal release.
2021-12-01 15:39:04 +01:00
Laurens Valk 602b21fe9d doc/main/hubs: Hide Prime Hub.
This is not part of the upcoming release.

Hiding is nicer than adding not-ready disclaimers throughout, especially
since this information is very easy to access via our beta channel.
2021-12-01 15:39:04 +01:00
Laurens Valk 30803fc017 pybricks.robotics.DriveBase: Add curve method.
This generalizes motion to curves (arcs), which is in
between straight lines and in-place turns.
2021-12-01 15:38:27 +01:00
Laurens Valk 749eceefc4 pybricks.robotics.DriveBase: Document then and wait arguments. 2021-12-01 15:35:37 +01:00
Laurens Valk 57f6f0fbef pybricks.pupdevices.DCMotor: Document settings method.
Also update changelog for recent changes.
2021-12-01 14:55:34 +01:00
Laurens Valk e061617c34 pybricks.common.Control: Drop integral_range.
This setting is no longer used. We leave a placeholder setting so we don't break existing programs.

See https://github.com/pybricks/pybricks-micropython/commit/e82dd6a2be4e378ab0b1ee7e3b2643fe654de4a9#diff-e529f43c94cf766ade4b68930f9713a45b62618f4305e4c0c88ba872e9f9cd0e
2021-12-01 14:54:21 +01:00
Laurens Valk eb09ecd7c7 pybricks.common.Control: Drop duty limit.
This is now a per-motor voltage limit.

See https://github.com/pybricks/support/issues/536
2021-12-01 14:41:09 +01:00
Laurens Valk 06a1542613 pybricks.pupdevices.DCMotor: Document settings method.
See https://github.com/pybricks/support/issues/536
2021-12-01 14:40:06 +01:00
Laurens Valk 82a8f2ae89 pybricks.pupdevices.Motor: Add small motor render.
Fixes https://github.com/pybricks/support/issues/441
2021-11-23 08:59:44 +01:00
Laurens Valk 7d0fe9cb85 doc/common/extensions: Fix classlink.
Allow the link to be different from the name.

This lets us fix the link for the Inventor Hub, which was linking to a non-existent page.
2021-11-22 14:49:20 +01:00
Laurens Valk 1af876ac8f pybricks.pupdevices.ColorLightMatrix: Fix render.
- Use isometric projection
- Fix broken plug
- Use correct background color

While we are at it, add colors to show which 9 colors this device supports.
2021-11-22 14:49:20 +01:00
David Lechner 718a28c0da @pybricks/ide-docs v2.0.1 2021-11-19 20:30:11 -06:00
David Lechner a2a375cb5c docs/pupdevices: fix broken link
The link to the color light matrix page was broken due to an invalid
file name.
2021-11-19 20:28:33 -06:00
David Lechner 466d8d6c86 @pybricks/ide-docs v2.0.0 2021-11-19 19:59:19 -06:00
David Lechner e77b3dcf4d v3.1.0rc1 2021-11-19 19:42:07 -06:00
David Lechner b6d1eef2a1 pybricks.iodevices.LWP3Device: add api and docs
This adds docs and API stubs for pybricks.iodevices.LWP3Device.

Fixes: https://github.com/pybricks/support/issues/534
2021-11-19 19:31:53 -06:00
David Lechner 20cb5fdde5 doc: make all titles sentence case
This makes the casing of titles consistent throughout the docs.

Fixes: https://github.com/pybricks/pybricks-api/issues/75
2021-11-19 19:30:57 -06:00
David Lechner 2f574e8c03 pybricks.pupdevices.ColorLightMatrix: add api and docs
This adds the SPIKE 3x3 Color Light Matrix to the API and docs.
2021-11-19 19:30:57 -06:00
David Lechner 9d8531a85b npm/ide-docs: move npm packaging to separate directory
This makes a clean separation between the packaging and the docs.
2021-11-19 19:30:57 -06:00
David Lechner fee122cf33 CHANGELOG: move to top level
This makes the CHANGELOG easy to find.
2021-11-19 16:37:38 -06:00
David Lechner f42ed06d4f doc/main/CHANGELOG: use keepachangelog.com recommendations
This updates the changelog to use keepachangelog.com recommendations
to make it consistent with other Pybricks changelogs.
2021-08-30 13:29:38 -05:00
David Lechner a8126f0bed doc/main: fix dir in package.json
Another case of a missed ide to main directory.
2021-08-30 12:20:44 -05:00
45 changed files with 570 additions and 251 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ jobs:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn build
working-directory: doc/main
working-directory: npm/ide-docs
- run: yarn publish
working-directory: doc/main
working-directory: npm/ide-docs
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
+93
View File
@@ -0,0 +1,93 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 3.1.0 - 2021-12-16
### Added
- Added maximum voltage setter for `DCMotor` and `Motor`.
- Documented `DriveBase.curve()` method.
### Changed
- Removed `duty` setting from `Control.limits` method.
- Removed `integral_range` setting from `Control.pid` method.
### Fixed
- Fixed link to Color Light Matrix page.
- Fixed link to Inventor Hub page.
## 3.1.0rc1 - 2021-11-19
### Added
- Added `ColorLightMatrix` class.
- Added `LWP3Device` class.
**NOTE: version number after this point were from JavaScript package and do
not correspond to Pybricks firmware version numbers.**
## 1.6.0 - 2021-08-30
### Added
- MicroPython module documentation.
- Examples for hub system functions including stop button and shutdown.
### Changed
- Build IDE docs as main docs with minor changes, instead of a completely
separate build.
- Moved motor control documentation to the motor page.
## 1.5.0 - 2021-07-01
### Added
- Documentation for Powered Up Remote Control.
## 1.4.0 - 2021-06-23
### Added
- Enabled beta content that was hidden for the 3.0 release.
- Added notice about using the latest beta version.
## 1.3.3 - 2021-05-21
### Changed
- Match example snippet styling to IDE.
- Add more examples.
## 1.3.2 - 2021-04-26
## Changed
- Theme style fixes.
- Example code fixes
- Match doc version to firmware version.
## 1.3.1 - 2021-04-12
### Changed
- Upgrade sphinx and rtd-theme to fix style issues.
## 1.3.0 - 2021-04-12
### Removed
- Removed features which not be in the official 3.0 release. These features
are still in beta. They'll come back in future releases once tested.
## 1.2.0 - 2021-04-09
### Changed
- Moved installation guide to external site.
## 1.1.1 - 2021-02-14
### Added
- Added installation guide.
- Various documentation fixes.
## 1.1.0 - 2021-01-28
### Added
- Scrollbar styling.
## 1.0.0 - 2021-01-25
### Added
- Sphinx build output.
+3
View File
@@ -265,11 +265,14 @@ latex_documents = [
exclude_patterns = [
'ev3devices.rst',
'hubs/ev3brick.rst',
'hubs/primehub.rst',
'geometry.rst',
'iodevices/analogsensor.rst',
'iodevices/dcmotor.rst',
'iodevices/ev3devsensor.rst',
'iodevices/i2cdevice.rst',
'iodevices/lumpdevice.rst',
'iodevices/lwp3device.rst',
'iodevices/uartdevice.rst',
'media.rst',
'messaging.rst',
+4 -2
View File
@@ -5,13 +5,15 @@ from docutils.parsers.rst import Directive
class PybricksClasslinkDirective(Directive):
required_arguments = 1
optional_arguments = 1
def run(self):
# Get link name from sphinx-directive
# Get link and name from sphinx-directive
name = self.arguments[0]
link = name if len(self.arguments) == 1 else self.arguments[1]
html = (
'<a href="{0}.html">'.format(name.lower()) +
'<a href="{0}.html">'.format(link.lower()) +
'<dl class="py class">' +
'<dt>' +
'<em class="property">class </em>' +
-66
View File
@@ -1,66 +0,0 @@
# 1.6.0 - 2021-08-30
## Added:
- MicroPython module documentation.
- Examples for hub system functions including stop button and shutdown.
## Changed:
- Build IDE docs as main docs with minor changes, instead of a completely
separate build.
- Moved motor control documentation to the motor page.
# 1.5.0 - 2021-07-01
## Added:
- Documentation for Powered Up Remote Control.
# 1.4.0 - 2021-06-23
## Added:
- Enabled beta content that was hidden for the 3.0 release.
- Added notice about using the latest beta version.
# 1.3.3 - 2021-05-21
## Changed:
- Match example snippet styling to IDE.
- Add more examples.
# 1.3.2 - 2021-04-26
## Changed:
- Theme style fixes.
- Example code fixes
- Match doc version to firmware version.
# 1.3.1 - 2021-04-12
## Changed:
- Upgrade sphinx and rtd-theme to fix style issues.
# 1.3.0 - 2021-04-12
## Removed:
- Removed features which not be in the official 3.0 release. These features
are still in beta. They'll come back in future releases once tested.
# 1.2.0 - 2021-04-09
## Changed:
- Moved installation guide to external site.
# 1.1.1 - 2021-02-14
## Added:
- Added installation guide.
- Various documentation fixes.
# 1.1.0 - 2021-01-28
## Added:
- Scrollbar styling.
# 1.0.0 - 2021-01-25
## Added:
- Sphinx build output.
+8 -7
View File
@@ -3,11 +3,12 @@
0 !LICENSE MIT
0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0
1 15 430 -96 190 0 0 1 1 0 0 0 1 0 54675c01.dat
1 15 430 -96 400 0 0 1 1 0 0 0 1 0 54675c01.dat
1 322 430 -72 30 0 0 1 1 0 0 0 1 0 54696c01.dat
1 71 430 -72 -180 0 0 1 1 0 0 0 1 0 54696c01.dat
1 71 190 -144 -180 1 0 0 0 1 0 0 0 1 22169c01.dat
1 71 -20 -216 -140 1 0 0 0 1 0 0 0 1 22172c01.dat
1 15 120 -320 160 1 0 0 0 1 0 0 0 1 26913c01.dat
1 15 450 -76 -20 0 0 1 1 0 0 0 1 0 54675c01.dat
1 15 -30 -76 280 0 0 1 1 0 0 0 1 0 68488c01.dat
1 71 550 -76 200 0 0 1 1 0 0 0 1 0 69730c01.dat
1 15 180 -72 140 0 0 1 1 0 0 0 1 0 54696c01.dat
1 15 260 -72 350 0 0 1 1 0 0 0 1 0 54696p02c01.dat
1 71 430 -84 470 1 0 0 0 1 0 0 0 1 22169c01.dat
1 71 590 -86 360 1 0 0 0 1 0 0 0 1 22172c01.dat
1 15 300 -110 630 1 0 0 0 1 0 0 0 1 26913c01.dat
0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 KiB

After

Width:  |  Height:  |  Size: 860 KiB

+41 -17
View File
@@ -11,8 +11,8 @@
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="2000"
height="1118"
viewBox="0 0 529.16666 295.80416"
height="1126"
viewBox="0 0 529.16666 297.92083"
version="1.1"
id="svg8"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
@@ -58,8 +58,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="619.19211"
inkscape:cy="823.24691"
inkscape:cx="930.75599"
inkscape:cy="703.45816"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
@@ -87,18 +87,18 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1.1958167)">
transform="translate(0,0.92084997)">
<image
sodipodi:absref="pupmotors.png"
xlink:href="pupmotors.png"
width="529.16669"
height="295.80417"
y="-0.92085403"
x="0"
id="image876"
preserveAspectRatio="none"
id="image853"
x="-2.220446e-16"
y="1.1958181" />
height="297.92084"
width="529.16669" />
<g
transform="matrix(1.9732825,0,0,1.9732825,82.068314,-182.19652)"
transform="matrix(1.9732825,0,0,1.9732825,94.897251,-184.86922)"
id="g2717">
<g
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)"
@@ -123,7 +123,7 @@
</g>
<g
id="g2727"
transform="matrix(1.7059944,0,0,1.7059944,-18.326438,-250.00951)">
transform="matrix(1.7059944,0,0,1.7059944,-93.696445,-190.67567)">
<g
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g2721"
@@ -147,7 +147,7 @@
sodipodi:nodetypes="ccccsc" />
</g>
<g
transform="matrix(1.7059944,0,0,1.7059944,40.772154,-187.53273)"
transform="matrix(1.7059944,0,0,1.7059944,105.45138,-208.37975)"
id="g2747">
<g
transform="matrix(1,-0.27773651,0,1,61.231459,102.02783)"
@@ -173,7 +173,7 @@
</g>
<g
id="g2757"
transform="matrix(1.9732825,0,0,1.9732825,-63.81015,-178.54646)">
transform="matrix(1.9732825,0,0,1.9732825,-99.624267,-179.081)">
<g
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g2751"
@@ -196,7 +196,7 @@
style="fill:#2980b9;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(1.9732825,0,0,1.9732825,-192.3424,-182.95247)"
transform="matrix(1.9732825,0,0,1.9732825,-253.27985,-174.39985)"
id="g2767">
<g
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)"
@@ -221,7 +221,7 @@
</g>
<g
id="g874"
transform="matrix(1.9732825,0,0,1.9732825,-208.72093,-323.71573)">
transform="matrix(1.9732825,0,0,1.9732825,-208.72093,-333.33743)">
<g
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g868"
@@ -244,7 +244,7 @@
style="fill:#2980b9;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(1.9732825,0,0,1.9732825,-134.6376,-374.36454)"
transform="matrix(1.9732825,0,0,1.9732825,-103.63433,-335.34319)"
id="g884">
<g
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)"
@@ -275,5 +275,29 @@
rx="1.295833"
ry="1.1623898"
transform="matrix(0.89702138,0.44198716,0,1,0,0)" />
<g
id="g899"
transform="matrix(1.9732825,0,0,1.9732825,15.03334,-338.81769)">
<g
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g893"
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)">
<path
id="path891"
style="fill:#2980b9;fill-opacity:1;fill-rule:evenodd;stroke:#fffbfb;stroke-width:0.13229167;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 107.60315,149.3339 -4.4195,12.01847 -4.419489,-12.01847 c 2.609269,1.92005 6.179199,1.90899 8.838989,0 z"
inkscape:connector-curvature="0" />
</g>
<path
inkscape:connector-curvature="0"
id="path895"
d="m 148.90956,215.29575 c -8.02867,2.89572 -14.60635,11.81219 -14.60635,19.93021 l 1.74541,-0.62952 c 0,-7.05178 5.7198,-14.86961 12.86094,-17.44522 7.14113,-2.57561 12.86094,1.11628 12.86094,8.16806 l 1.74541,-0.62952 c 0,-8.11802 -6.57768,-12.28973 -14.60635,-9.39401 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2980b9;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
inkscape:connector-curvature="0"
id="path897"
d="m 161.70224,224.65346 1.85836,-0.53454 0.43431,0.40926 -0.98973,1.42822 c 0,0 -2.13398,-0.30486 -2.13398,-0.32574 0,-0.0209 0.83104,-0.9772 0.83104,-0.9772 z"
style="fill:#2980b9;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 25 KiB

+2 -1
View File
@@ -1,7 +1,8 @@
0 Name: pupmotors
0 Name: pupsensors.ldr
0 Author: Pybricks {laurens@pybricks.com}
0 !LICENSE MIT
0 !LDCAD GROUP_DEF [topLevel=true] [LID=0] [GID=9FDP9pj0O55] [name=Group 1] [center=0 0 0]
1 15 190 -290 750 -1 0 0 0 -1 0 0 0 1 47592c01.dat
1 15 600 -280 180 1 0 0 0 1 0 0 0 1 37316.dat
1 15 60 -272 160 -1 0 0 0 -1 0 0 0 1 37312c01.dat
1 15 -400 -280 240 -1 0 0 0 -1 0 0 0 1 37308c01.dat
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
width="504"
height="322"
viewBox="0 0 504 322"
sodipodi:docname="sensor_colorlightmatrix.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<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" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath846">
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 384.47481,408.57086 22.58181,23.6974 88.18587,13.9655 -36.98745,-79.56651 -97.14072,-16.49296 z"
id="path848"
inkscape:connector-curvature="0" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath874">
<path
style="fill:none;stroke:#000000;stroke-width:0.10000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 491.27259,265.371 c 1.71728,2.18035 5.94442,12.92235 5.94442,12.92235 l 40.68619,39.65737 -0.39629,25.87184 -22.19247,7.07325 -62.08608,-14.9528 10.83204,-57.24707 z"
id="path876"
inkscape:connector-curvature="0" />
</clipPath>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1853"
inkscape:window-height="1145"
id="namedview4"
showgrid="false"
inkscape:zoom="0.70710678"
inkscape:cx="-39.716728"
inkscape:cy="-44.222535"
inkscape:window-x="67"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-bbox="true"
inkscape:snap-global="false" />
<image
sodipodi:absref="sensor_colorlightmatrix_main.png"
xlink:href="sensor_colorlightmatrix_main.png"
y="0"
x="0"
id="image10"
preserveAspectRatio="none"
height="322"
width="504" />
<rect
style="fill:#e51a1a;fill-opacity:0.62566845;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect31"
width="45.163605"
height="44.564522"
x="390.70432"
y="293.66827"
transform="matrix(0.94626691,-0.32338666,0,1,0,0)" />
<rect
transform="matrix(0.94626691,-0.32338666,0,1,0,0)"
y="338.23279"
x="390.70432"
height="43.275879"
width="45.163605"
id="rect838"
style="fill:#e5701a;fill-opacity:0.62566845;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
style="fill:#e5bf1a;fill-opacity:0.62566845;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect840"
width="45.163605"
height="38.992153"
x="390.70432"
y="381.46179"
transform="matrix(0.94626691,-0.32338666,0,1,0,0.05126953)"
clip-path="url(#clipPath846)" />
<rect
transform="matrix(0.94626691,-0.32338666,0,1,0,0)"
y="293.66827"
x="435.86792"
height="44.564514"
width="41.462769"
id="rect856"
style="fill:#00af05;fill-opacity:0.62566847;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
style="fill:#0044fb;fill-opacity:0.62566847;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect858"
width="40.347229"
height="44.564514"
x="477.33069"
y="293.66827"
transform="matrix(0.94626691,-0.32338666,0,1,0,0)"
clip-path="url(#clipPath874)" />
<rect
style="fill:#5dffe2;fill-opacity:1;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect860"
width="41.462769"
height="43.261936"
x="435.86792"
y="338.24722"
transform="matrix(0.94626691,-0.32338666,0,1,0,0)" />
<rect
transform="matrix(0.94626691,-0.32338666,0,1,0,0)"
y="338.24722"
x="477.33069"
height="43.261951"
width="40.347229"
id="rect862"
style="fill:#941ae5;fill-opacity:0.62566847;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
transform="matrix(0.94626691,-0.32338666,0,1,0,0)"
y="381.51306"
x="435.86792"
height="38.88504"
width="41.489174"
id="rect868"
style="fill:#1acee5;fill-opacity:0.62566847;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<rect
style="fill:#e51a9a;fill-opacity:0.62566847;stroke:none;stroke-width:1.94267738;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect870"
width="40.281181"
height="38.928104"
x="477.33069"
y="381.51306"
transform="matrix(0.94626691,-0.32338666,0,1,0,0)" />
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

+1 -1
View File
@@ -1,4 +1,4 @@
:mod:`ev3devices <pybricks.ev3devices>` -- EV3 Devices
:mod:`ev3devices <pybricks.ev3devices>` -- EV3 devices
======================================================
.. automodule:: pybricks.ev3devices
+1 -15
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements::
:mod:`hubs <pybricks.hubs>` -- Programmable Hubs
:mod:`hubs <pybricks.hubs>` -- Programmable hubs
================================================
.. module:: pybricks.hubs
@@ -12,7 +12,6 @@
movehub
cityhub
technichub
primehub
.. pybricks-classlink:: MoveHub
@@ -31,16 +30,3 @@
.. figure:: ../../main/images/technichub.png
:height: 10 em
:target: technichub.html
.. pybricks-classlink:: PrimeHub
.. figure:: ../../main/images/primehub.png
:height: 10 em
:target: primehub.html
.. pybricks-classlink:: InventorHub
.. figure:: ../../main/images/inventorhub.png
:height: 10 em
:target: primehub.html
+3 -50
View File
@@ -6,8 +6,9 @@ Technic Hub
.. figure:: ../../main/images/technichub.png
:height: 15 em
.. autoclass:: pybricks.hubs.TechnicHub
:no-members:
.. class:: TechnicHub
LEGO® Technic Hub.
.. rubric:: Using the hub status light
@@ -19,20 +20,6 @@ Technic Hub
.. automethod:: pybricks.hubs::TechnicHub.light.animate
.. rubric:: Using the IMU
.. automethod:: pybricks.hubs::TechnicHub.imu.up
.. automethod:: pybricks.hubs::TechnicHub.imu.tilt
.. automethod:: pybricks.hubs::TechnicHub.imu.acceleration
.. automethod:: pybricks.hubs::TechnicHub.imu.angular_velocity
.. automethod:: pybricks.hubs::TechnicHub.imu.heading
.. automethod:: pybricks.hubs::TechnicHub.imu.reset_heading
.. rubric:: Using the battery
.. automethod:: pybricks.hubs::TechnicHub.battery.voltage
@@ -78,40 +65,6 @@ Creating light animations
.. literalinclude::
../../../examples/pup/hub_technichub/light_animate.py
IMU examples
---------------
Testing which way is up
********************************
.. literalinclude::
../../../examples/pup/hub_technichub/imu_up.py
Reading the tilt value
********************************
.. literalinclude::
../../../examples/pup/hub_technichub/imu_tilt.py
Using a custom hub orientation
**************************************************
.. literalinclude::
../../../examples/pup/hub_technichub/imu_tilt_blast.py
Reading acceleration and angular velocity vectors
**************************************************
.. literalinclude::
../../../examples/pup/hub_technichub/imu_read_vector.py
Reading acceleration and angular velocity on one axis
*****************************************************
.. literalinclude::
../../../examples/pup/hub_technichub/imu_read_scalar.py
Button and system examples
----------------------------------
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 KiB

After

Width:  |  Height:  |  Size: 1004 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

+7 -18
View File
@@ -49,29 +49,19 @@ Pybricks Documentation
.. only:: ide
.. note::
**You are using a new beta version of Pybricks!**
This is great for trying the very latest features, but some things
might not work.
If in doubt, use the `latest stable release`_. Please report any
issues via our `support page`_. Thanks!
To begin, install the Pybricks firmware on your hub. Check
`pybricks.com/install`_ to learn how.
Use the ☰ menu to navigate all available classes, methods, and tools. A few
commonly used devices and classes are listed below for quick reference.
.. rubric:: Programmable Hubs
.. rubric:: Programmable hubs
.. figure:: ../main/images/hubsoverview.png
.. figure:: ../main/images/powereduphubs.png
:width: 100 %
:target: hubs/index.html
.. rubric:: Powered Up Motors and Sensors
.. rubric:: Powered Up motors and sensors
.. figure:: ../main/images/pupdevicesoverview.png
:width: 100 %
@@ -88,7 +78,7 @@ Pybricks Documentation
.. toctree::
:maxdepth: 1
:caption: Table of Contents
:caption: Table of contents
:hidden:
.. toctree::
@@ -96,12 +86,12 @@ Pybricks Documentation
:caption: Pybricks
:hidden:
Home Page <https://pybricks.com>
Home page <https://pybricks.com>
Installation <https://pybricks.com/install/>
.. toctree::
:maxdepth: 1
:caption: Pybricks Package
:caption: Pybricks modules
:hidden:
hubs/index
@@ -110,12 +100,11 @@ Pybricks Documentation
parameters/index
tools/index
robotics
geometry
signaltypes
.. toctree::
:maxdepth: 1
:caption: MicroPython Modules
:caption: MicroPython modules
:hidden:
micropython/builtins
+1 -1
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements:: pybricks-iodevices
:mod:`iodevices <pybricks.iodevices>` -- Generic I/O Devices
:mod:`iodevices <pybricks.iodevices>` -- Generic I/O devices
============================================================
.. module:: pybricks.iodevices
+12
View File
@@ -0,0 +1,12 @@
LEGO Wireless Protocol v3 device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning::
This is an experimental class. It has not been well tested and may be
changed in future.
.. figure:: ../../main/images/powereduphubs.png
:width: 25 %
.. autoclass:: pybricks.iodevices.LWP3Device
+4 -4
View File
@@ -1,4 +1,4 @@
:mod:`media <pybricks.media>` -- Sounds and Images
:mod:`media <pybricks.media>` -- Sounds and images
==================================================
.. module:: pybricks.media
@@ -18,7 +18,7 @@ and sound files. You can access them using the classes below.
You can also use your own sound and image files by placing them in your project
folder.
Image Files
Image files
^^^^^^^^^^^
.. autoclass:: pybricks.media.ev3dev.ImageFile
@@ -223,7 +223,7 @@ Image Files
.. image:: ../../media/ev3dev-media/images/mono/eyes/winking.png
:width: 15 %
Sound Files
Sound files
^^^^^^^^^^^
.. autoclass:: pybricks.media.ev3dev.SoundFile
@@ -1452,7 +1452,7 @@ Fonts
.. _FontConfig: https://www.freedesktop.org/wiki/Software/fontconfig/
Image Manipulation
Image manipulation
^^^^^^^^^^^^^^^^^^
Instead of drawing directly on the EV3 screen, you can make and interact
+2 -2
View File
@@ -107,13 +107,13 @@ numbers, or text), you can choose one of the Mailboxes below.
Examples
-----------------
**EV3 Bluetooth Server**
**EV3 Bluetooth server**
This is the full version of the excerpt shown in :numref:`fig_messaging`.
.. literalinclude:: ../../examples/ev3/bluetooth_server/server.py
**EV3 Bluetooth Client**
**EV3 Bluetooth client**
This is the full version of the excerpt shown in :numref:`fig_messaging`.
+1 -1
View File
@@ -1,4 +1,4 @@
:mod:`nxtdevices <pybricks.nxtdevices>` -- NXT Devices
:mod:`nxtdevices <pybricks.nxtdevices>` -- NXT devices
======================================================
.. automodule:: pybricks.nxtdevices
+1 -1
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements::
:mod:`parameters <pybricks.parameters>` -- Parameters and Constants
:mod:`parameters <pybricks.parameters>` -- Parameters and constants
===================================================================
.. automodule:: pybricks.parameters
-15
View File
@@ -26,21 +26,6 @@ Side
.. autoattribute:: pybricks.parameters.Side.RIGHT
:annotation:
Screens or light matrices have only four sides. For those,
``TOP`` is treated the same as ``FRONT``, and ``BOTTOM`` is treated the
same as ``BACK``. The diagrams below define the sides for relevant devices.
**Prime Hub**
.. figure:: ../../main/images/orientation_primehub_label.png
:height: 17 em
**Inventor Hub**
.. figure:: ../../main/images/orientation_inventorhub_label.png
:height: 17 em
**Move Hub**
.. figure:: ../../main/images/orientation_movehub_label.png
+15
View File
@@ -0,0 +1,15 @@
.. pybricks-requirements::
Color Light Matrix
^^^^^^^^^^^^^^^^^^
.. figure:: ../../main/images/sensor_colorlightmatrix_label.png
:width: 35 %
.. autoclass:: pybricks.pupdevices.ColorLightMatrix
:no-members:
.. automethod:: pybricks.pupdevices.ColorLightMatrix.on
.. automethod:: pybricks.pupdevices.ColorLightMatrix.off
+4 -1
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements::
Motors without Rotation Sensors
Motors without rotation sensors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _fig_pupdcmotors:
@@ -25,6 +25,9 @@ Motors without Rotation Sensors
.. automethod:: pybricks.pupdevices.DCMotor.brake
:noindex:
.. automethod:: pybricks.pupdevices.DCMotor.settings
:noindex:
Examples
-------------------
+8 -1
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements::
:mod:`pupdevices <pybricks.pupdevices>` -- Powered Up Devices
:mod:`pupdevices <pybricks.pupdevices>` -- Powered Up devices
=============================================================
.. automodule:: pybricks.pupdevices
@@ -19,6 +19,7 @@
colorsensor
ultrasonicsensor
forcesensor
colorlightmatrix
light
remote
@@ -76,6 +77,12 @@
:width: 35 %
:target: forcesensor.html
.. pybricks-classlink:: ColorLightMatrix
.. figure:: ../../main/images/sensor_colorlightmatrix_label.png
:width: 35 %
:target: colorlightmatrix.html
.. pybricks-classlink:: Light
.. figure:: ../../main/images/light.png
+8 -6
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements::
Motors with Rotation Sensors
Motors with rotation sensors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _fig_pupmotors:
@@ -70,6 +70,8 @@ Motors with Rotation Sensors
example, you can change them at the start of your program. Alternatively,
first call :meth:`stop() <pybricks.pupdevices.Motor.stop>`, and then change the settings.
.. automethod:: pybricks.pupdevices.Motor.settings
.. automethod:: pybricks.pupdevices.Motor.control.limits
.. automethod:: pybricks.pupdevices.Motor.control.pid
@@ -78,7 +80,7 @@ Motors with Rotation Sensors
.. automethod:: pybricks.pupdevices.Motor.control.stall_tolerances
Initialization Examples
Initialization examples
-----------------------
Making the motor move back and forth
@@ -105,7 +107,7 @@ Using gears
.. literalinclude::
../../../examples/pup/motor/motor_init_gears.py
Measurement Examples
Measurement examples
-----------------------
Measuring the angle and speed
@@ -121,7 +123,7 @@ Resetting the measured angle
../../../examples/pup/motor/motor_reset_angle.py
Movement Examples
Movement examples
-----------------------
Basic usage of all run methods
@@ -142,7 +144,7 @@ Using the ``then`` argument to change how a run command stops
.. literalinclude::
../../../examples/pup/motor/motor_action_then.py
Stall Examples
Stall examples
-----------------------
Running a motor until a mechanical endpoint
@@ -158,7 +160,7 @@ Centering a steering mechanism
../../../examples/pup/motor/motor_until_stalled.py
Parallel Movement Examples
Parallel movement examples
--------------------------
Using the ``wait`` argument to run motors in parallel
+3 -1
View File
@@ -22,6 +22,8 @@
.. automethod:: pybricks.robotics.DriveBase.turn
.. automethod:: pybricks.robotics.DriveBase.curve
.. automethod:: pybricks.robotics.DriveBase.settings
.. rubric:: Drive forever
@@ -88,7 +90,7 @@
To deactivate the :class:`.DriveBase`, call :meth:`.stop`.
.. rubric:: Advanced Settings
.. rubric:: Advanced settings
The :meth:`.settings` method is used to adjust commonly used settings like
the default speed and acceleration for straight maneuvers and turns.
+5
View File
@@ -0,0 +1,5 @@
# build directory
html/
# yarn pack output
*.tgz
+14
View File
@@ -0,0 +1,14 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.0.1 - 2021-11-19
### Fixed
- Fixed link to Color Light Matrix page.
## 2.0.0 - 2021-11-19
### Changed
- Changed package directory structure.
- Updated docs to v3.1.0rc1.
@@ -1,11 +1,11 @@
{
"name": "@pybricks/ide-docs",
"version": "1.6.0",
"version": "2.0.1",
"description": "Special build of Pybricks API docs for embedding in an IDE.",
"repository": {
"type": "git",
"url": "https://github.com/pybricks/pybricks-api",
"directory": "doc/ide"
"directory": "npm/ide-docs"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
@@ -14,11 +14,10 @@
"author": "The Pybricks Authors",
"license": "MIT",
"files": [
"build/html/**"
"html"
],
"types": "index.d.ts",
"scripts": {
"clean": "poetry run make -C .. clean",
"build": "poetry run make -C .. TAG=ide html"
"clean": "poetry run make -C ../../doc clean",
"build": "poetry run make -C ../../doc TAG=ide html && rm -rf html && cp -R ../../doc/main/build/html html"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybricks"
version = "3.1.0a1"
version = "3.1.0"
description = "Documentation and user-API stubs for Pybricks MicroPython"
authors = ["The Pybricks Authors <dev@pybricks.com>"]
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
+1 -1
View File
@@ -4,5 +4,5 @@ exclude = .venv/,*.pyi
max-line-length = 88
[doc8]
ignore-path = .venv/,doc/main/build/,pybricks.egg-info/
ignore-path = .venv/,doc/main/build/,doc/api/build/,pybricks.egg-info/,npm/
max-line-length = 88
+13 -7
View File
@@ -88,6 +88,16 @@ class DCMotor:
is generated while the motor is still moving."""
pass
def settings(self, max_voltage):
"""Configures motor settings. If no arguments are given,
this returns the current values.
Arguments:
max_voltage (:ref:`voltage`):
Maximum voltage applied to the motor during all motor commands.
"""
pass
class Control:
"""Class to interact with PID controller and settings."""
@@ -99,7 +109,7 @@ class Control:
motor this is the number of encoder pulses per degree of rotation.
"""
def limits(self, speed, acceleration, duty, torque):
def limits(self, speed, acceleration, torque):
"""Configures the maximum speed, acceleration, duty, and torque.
If no arguments are given, this will return the current values.
@@ -109,14 +119,12 @@ class Control:
Maximum speed. All speed commands will be capped to this value.
acceleration (:ref:`acceleration` or :ref:`linacceleration`):
Maximum acceleration.
duty (:ref:`percentage`):
Maximum duty cycle during control.
torque (:ref:`torque`):
Maximum feedback torque during control.
"""
pass
def pid(self, kp, ki, kd, integral_range, integral_rate):
def pid(self, kp, ki, kd, reserved, integral_rate):
"""Gets or sets the PID values for position and speed control.
If no arguments are given, this will return the current values.
@@ -130,9 +138,7 @@ class Control:
kd (int): Derivative position (or proportional speed) control
constant. It is the feedback torque per
unit of speed: µNm/(deg/s).
integral_range (:ref:`angle` or :ref:`distance`): Region around
the target angle or distance, in which integral control errors
are accumulated.
reserved: This setting is not used.
integral_rate (:ref:`speed` or :ref:`linspeed`): Maximum rate at
which the error integral is allowed to grow.
"""
+4 -5
View File
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
# Copyright (c) 2020-2021 The Pybricks Authors
from pybricks.geometry import Matrix, vector
from typing import Collection, Iterable, List, Optional, Tuple, Union, overload
from typing import Collection, Iterable, Optional, Tuple, Union, overload
from .parameters import Button, Color, Direction, Side, Stop, Port, Axis
from .geometry import Axis, Matrix, vector
from .parameters import Button, Color, Direction, Side, Stop, Port
from .media.ev3dev import SoundFile
class DCMotor:
@@ -32,7 +32,6 @@ class Control:
kp: Optional[int] = None,
ki: Optional[int] = None,
kd: Optional[int] = None,
integral_range: Optional[int] = None,
integral_rate: Optional[int] = None,
) -> None: ...
@overload
+56
View File
@@ -244,3 +244,59 @@ class UARTDevice:
def clear(self):
"""Empties the buffer."""
pass
class LWP3Device:
"""
Connects to a remote hub running official LEGO firmware using the the
`LEGO Wireless Protocol v3`_
.. _`LEGO Wireless Protocol v3`:
https://lego.github.io/lego-ble-wireless-protocol-docs/
"""
def __init__(self, hub_kind, name=None, timeout=10000):
"""
Arguments:
hub_kind (int):
The `hub type identifier`_ of the hub to connect to.
name (str):
The name of the hub to connect to or ``None`` to connect to any
hub.
timeout (int):
The time, in milliseconds, to wait for a connection before
raising an exception.
.. _`hub type identifier`:
https://github.com/pybricks/technical-info/blob/master/assigned-numbers.md#hub-type-ids
"""
def name(self, name=None):
"""Gets or sets the Bluetooth name of the remote.
If no name is given, this method returns the current name.
Arguments:
name (str): New Bluetooth name of the remote.
"""
def write(self, buf):
"""
Sends a message to the remote hub.
Arguments:
buf (bytes): The raw binary message to send.
"""
def read(self):
"""
Retrieves the most recent message received from the remote hub.
If a message has not been received since the last read, the method will
block until a message is received.
Returns:
bytes: The raw binary message.
"""
+11 -1
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Dict, Optional, Tuple
from typing import Dict, Optional, Tuple, overload
from .parameters import Port
@@ -40,3 +40,13 @@ class UARTDevice:
def write(self, data: bytes) -> None: ...
def waiting(self) -> int: ...
def clear(self) -> None: ...
class LWP3Device:
def __init__(self, hub_kind: int, name: str = None, timeout: int = 10000): ...
@overload
def name(self) -> str: ...
@overload
def name(self, name: str) -> None: ...
def name(self, *args): ...
def read(self) -> bytes: ...
def write(self, buf: bytes) -> None: ...
+33
View File
@@ -377,6 +377,39 @@ class ForceSensor:
pass
class ColorLightMatrix:
"""
LEGO® SPIKE 3x3 Color Light Matrix.
"""
def __init__(self, port):
"""
Arguments:
port (Port): Port to which the device is connected.
"""
...
def on(self, colors):
"""
Turns the lights on.
Arguments:
colors (Color or list):
If a single :class:`.Color` is given, then all 9 lights are set
to that color. If a list of colors is given, then each light is
set to that color.
"""
...
def off(self):
"""
Turns all of the lights off.
"""
...
class InfraredSensor:
"""LEGO® Powered Up Infrared Sensor."""
+5
View File
@@ -60,6 +60,11 @@ class ForceSensor:
def pressed(self, force: int = 3) -> bool: ...
def touched(self) -> bool: ...
class ColorLightMatrix:
def __init__(self, port: Port) -> None: ...
def on(self, color: Union[Color, List[Color]]) -> None: ...
def off(self)-> None: ...
class InfraredSensor:
def __init__(self, port: Port): ...
def reflection(self) -> int: ...
+34 -17
View File
@@ -1,10 +1,12 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
# Copyright (c) 2018-2021 The Pybricks Authors
"""Robotics module for the Pybricks API."""
from ._common import Control as _Control
from .parameters import Stop as _Stop
class DriveBase:
"""A robotic vehicle with two powered wheels and an optional support
@@ -14,7 +16,7 @@ class DriveBase:
makes it easy to drive a given distance in millimeters or turn by a given
number of degrees.
**Positive** distances and drive speeds mean
**Positive** distances, radii, or drive speeds mean
driving **forward**. **Negative** means **backward**.
**Positive** angles and turn rates mean turning **right**.
@@ -98,10 +100,11 @@ class DriveBase:
"""Resets the estimated driven distance and angle to 0."""
pass
def settings(self, straight_speed, straight_acceleration, turn_rate,
turn_acceleration):
def settings(
self, straight_speed, straight_acceleration, turn_rate, turn_acceleration
):
"""Configures the speed and acceleration used
by :meth:`.straight` and :meth:`.turn`.
by :meth:`.straight`, :meth:`.turn`, and :meth:`.curve`.
If you give no arguments, this returns the current values as a tuple.
@@ -109,31 +112,45 @@ class DriveBase:
either before you begin driving or after you call :meth:`.stop`.
Arguments:
straight_speed (:ref:`linspeed`): Speed of the robot during
:meth:`.straight`.
straight_acceleration (:ref:`linacceleration`): Acceleration and
deceleration of the robot at the start and end
of :meth:`.straight`.
turn_rate (:ref:`speed`): Turn rate of the robot
during :meth:`.turn`.
straight_speed (:ref:`linspeed`): Straight-line speed of the robot.
straight_acceleration (:ref:`linacceleration`): Straight-line
acceleration and deceleration of the robot.
turn_rate (:ref:`speed`): Turn rate of the robot.
turn_acceleration (:ref:`acceleration`): Angular acceleration and
deceleration of the robot at the start and end
of :meth:`.turn`.
deceleration of the robot.
"""
pass
def straight(self, distance):
def straight(self, distance, then=_Stop.HOLD, wait=True):
"""Drives straight for a given distance and then stops.
Arguments:
distance (:ref:`distance`): Distance to travel.
distance (:ref:`distance`): Distance to travel
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.
"""
pass
def turn(self, angle):
def turn(self, angle, then=_Stop.HOLD, wait=True):
"""Turns in place by a given angle and then stops.
Arguments:
angle (:ref:`angle`): Angle of the turn.
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.
"""
pass
def curve(self, radius, angle, then=_Stop.HOLD, wait=True):
"""Drives an arc along a circle of a given radius, by a given angle.
Arguments:
radius (:ref:`dimension`): Radius of the circle.
angle (:ref:`angle`): Angle along the circle.
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.
"""
pass
+6 -1
View File
@@ -1,8 +1,10 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
# Copyright (c) 2020-2021 The Pybricks Authors
from typing import Optional, Tuple, overload, Union
from ._common import Control, Motor
from .parameters import Stop
class DriveBase:
distance_control: Control
@@ -32,3 +34,6 @@ class DriveBase:
) -> None: ...
def straight(self, distance: int) -> None: ...
def turn(self, angle: int) -> None: ...
def curve(
self, radius: int, angle: int, then: Stop = Stop.HOLD, wait: bool = True
) -> None: ...