Compare commits

..
Author SHA1 Message Date
David Lechner bf59ef4478 v2.0.0.post2 2022-02-21 11:29:57 -06:00
David Lechner 6b1f7d8eaa pybricks.ev3devices: fix Motor code completion
The Microsoft Python extension for VS code doesn't include imports in
type hints, so the Motor type wasn't working properly. We can fix this
by wrapping the import type in a new, empty class definition.

The DCMotor class was also missing from ev3devices so this is fixed as well.
2022-02-21 11:01:11 -06:00
David Lechner df27ebc27e pybricks.messaging: fix BluetoothMailboxServer close
As per standard Python socketserver, there is `server_close()` rather than `close()`.

Fixes #51
2021-04-07 19:41:30 +02:00
David Lechner b471cae0bc v2.0.0.post1 2020-12-28 16:40:42 -06:00
David Lechner eb7f441c9e pybricks: remove non-EV3 APIs
This is the v2 branch which only supports EV3. Removing the extra APIs
will prevent them from showing up when this library is used for code
completion.
2020-12-28 16:36:47 -06:00
David Lechner dca8518575 pybricks: add type hints for v2
This adds PEP 561 style type hints for Pybricks v2 (just EV3).
2020-12-28 16:21:56 -06:00
579 changed files with 4406 additions and 18416 deletions
-2
View File
@@ -1,2 +0,0 @@
github: [pybricks]
-38
View File
@@ -1,38 +0,0 @@
name: Release @pybricks/ide-docs
on:
push:
tags:
- '@pybricks/ide-docs/**'
jobs:
publish_ide_docs:
runs-on: ubuntu-20.04
steps:
- name: Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y dvisvgm preview-latex-style texlive texlive-fonts-extra texlive-latex-extra
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install poetry
poetry run python -m pip install --upgrade pip
poetry run python -m pip install --upgrade setuptools
poetry install
- uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn build
working-directory: doc/main
- run: yarn publish
working-directory: doc/main
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
@@ -1,14 +1,14 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build Python package and docs
name: Python package
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
@@ -32,12 +32,6 @@ jobs:
- name: Build package
run: poetry build
- name: Lint docs
run: poetry run doc8
- name: Build html docs for Read the Docs
run: poetry run doc8 --extension .inc
- name: Build html docs
run: poetry run make -C doc html
- name: Instal IDE docs dependencies
run: |
sudo apt-get update
sudo apt-get install dvisvgm preview-latex-style texlive texlive-fonts-extra texlive-latex-extra
- name: Build html docs for Pybricks Code IDE
run: poetry run make -C doc html TAG=ide
-22
View File
@@ -1,22 +0,0 @@
name: Release to PyPI
on:
release:
types: [published]
jobs:
build_and_publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.6
- run: poetry install
- run: poetry build
- run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
+3
View File
@@ -1,3 +1,6 @@
[submodule "pybricks-projects"]
path = pybricks-projects
url = https://github.com/pybricks/pybricks-projects
[submodule "media/ev3dev-media"]
path = media/ev3dev-media
url = https://github.com/ev3dev/ev3dev-media.git
-22
View File
@@ -1,22 +0,0 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
#
# Settings in the readthedocs online dashboard will be ignored.
# Required
version: 2
# Build documentation in the doc/main directory with Sphinx
sphinx:
configuration: doc/main/conf.py
# Build your docs in additional formats such as PDF
formats:
- pdf
# Set the version of Python and requirements required to build the docs
python:
version: 3.8
install:
- requirements: rtd-requirements.txt
+1 -1
View File
@@ -6,7 +6,7 @@
"python.linting.enabled": true,
"python.languageServer": "Pylance",
"files.associations": {"*.inc": "restructuredtext"},
"restructuredtext.confPath": "${workspaceFolder}/doc/main",
"restructuredtext.confPath": "${workspaceFolder}/doc/api",
"spellright.language": [
"en_US"
],
+1 -1
View File
@@ -15,7 +15,7 @@ builtins
cdot
Celcius
cityhub
technichub
cplushub
de
dev
en
+12
View File
@@ -0,0 +1,12 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.0.0.post2
### Added
- Added this changelog.
### Fixed
- Fixed code completion for `DCMotor` and `Motor` classes in MS Python VS Code extension.
- Fixed missing `DCMotor` type in `ev3devices`.
+12 -24
View File
@@ -20,23 +20,20 @@ will actually be implemented.
- Commit messages have a one-line subject, a blank line and a multiline body:
prefix: Subject of the change.
prefix: subject
body...
- Use a prefix to categorize the change:
- Use the import path as the prefix whenever possible. Examples:
- pybricks.tools: Add StopWatch class.
- pybricks.tools: Reorganize RST files.
- pybricks.tools.StopWatch: Fix return type.
- pybricks.tools.wait: Add example of waiting.
- pybricks.pupdevices: Fix all sensor class ports.
- umath.sin: Fix spelling of Hypotenuse.
- If an import path makes no sense, just use the file path without extensions:
- .vscode/settings: Fix file associations.
- The subject briefly describes _what_ was changed. Use a short full sentence as in the examples above.
- Use a prefix to categorize the change. Usually this is the path the the file
being changed.
- If it is a documentation change, it can be shortened to `doc/<file>` (omit
`api` from the path).
- If it is an API change (in the `pybricks` folder), write `api/<file>`
instead of `pybricks/<file>`.
- The subject briefly describes _what_ was changed, e.g. `fix typo`.
- The body describes _why_ the change was made, e.g. `The word "sensor" was
spelled incorrectly`.
- See the [commit history][commits] for more examples.
[commits]: https://github.com/pybricks/pybricks-api/commits/master
@@ -62,24 +59,15 @@ Build docs:
# Linux
poetry run make -C doc html
xdg-open doc/main/build/html/index.html
xdg-open doc/api/build/html/index.html
# macOS
poetry run make -C doc html
open doc/main/build/html/index.html
open doc/api/build/html/index.html
# Windows (PowerShell)
poetry run doc\make.bat html
Invoke-Item doc\main\build\html\index.html
Building IDE docs variant:
# Linux/macOS
poetry run make -C doc html TAG=ide
# Windows (PowerShell)
$env:TAG="ide"
poetry run doc\make.bat html
Invoke-Item doc\api\build\html\index.html
Linting:
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018-2021 The Pybricks Authors
Copyright (c) 2018-2020 The Pybricks Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+3 -4
View File
@@ -5,13 +5,12 @@
SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
SPHINXPROJ = Pybricks
SOURCEDIR = main
SOURCEDIR = api
BUILDDIR = "$(SOURCEDIR)"/build
TAG = main
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) -t $(TAG) $(O)
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
@@ -22,4 +21,4 @@ diagrams:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) -t $(TAG) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Pybricks documentation build configuration file
#
import os
# General information about the project.
project = 'pybricks-micropython'
copyright = '2018-2020 The Pybricks Authors'
author = ''
_TITLE = 'Pybricks Modules and Examples'
_DISCLAIMER = 'LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are\
trademarks and/or copyrights of the LEGO Group of companies \
which does not sponsor, authorize or endorse this site.'
html_logo = '../common/images/pybricks-logo-rtd.png'
latex_logo = '../common/images/pybricks-logo-large.png'
exec(open(os.path.abspath("../common/conf.py")).read())

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 236 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

+11
View File
@@ -0,0 +1,11 @@
0 Name: pupmotors
0 Author: Pybricks {laurens@pybricks.com}
0 !LICENSE MIT
1 15 -420 -56 -250 1 0 0 0 1 0 0 0 1 26910.dat
1 15 10 -80 140 1 0 0 0 1 0 0 0 1 28738.dat
1 71 -270 -40 630 1 0 0 0 1 0 0 0 1 22127.dat
1 15 200 -96 600 -1 0 0 0 1 0 0 0 -1 28739.dat
1 15 470 -16 -90 1 0 0 0 1 0 0 0 1 45601p02.dat
1 15 -800 -40 360 1 0 0 0 1 0 0 0 1 95646c01.dat
1 15 -1160 32 -310 1 0 0 0 1 0 0 0 1 53788c01.dat
1 71 -1340 -40 430 1 0 0 0 1 0 0 0 1 87576c01.dat

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 163 KiB

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 259 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

+8
View File
@@ -0,0 +1,8 @@
0 Name: pupmotors
0 Author: Pybricks {laurens@pybricks.com}
0 !LICENSE MIT
1 15 430 -96 190 0 0 1 1 0 0 0 1 0 54675c01.dat
1 15 410 -72 30 0 0 1 1 0 0 0 1 0 54696c01.dat
1 71 230 -144 0 1 0 0 0 1 0 0 0 1 22169c01.dat
1 71 40 -216 0 1 0 0 0 1 0 0 0 1 22172c01.dat
1 15 -140 -320 80 1 0 0 0 1 0 0 0 1 26913c01.dat
Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

@@ -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="610"
viewBox="0 0 529.16666 161.39583"
version="1.1"
id="svg8"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
@@ -57,9 +57,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="619.19211"
inkscape:cy="823.24691"
inkscape:zoom="0.49497475"
inkscape:cx="899.69341"
inkscape:cy="449.26412"
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,-135.60415)">
<image
sodipodi:absref="pupmotors.png"
xlink:href="pupmotors.png"
width="529.16669"
height="295.80417"
preserveAspectRatio="none"
id="image853"
y="135.60416"
x="-2.220446e-16"
y="1.1958181" />
id="image853"
preserveAspectRatio="none"
height="161.39583"
width="529.16669" />
<g
transform="matrix(1.9732825,0,0,1.9732825,82.068314,-182.19652)"
transform="matrix(1.9732825,0,0,1.9732825,-10.059646,-179.85595)"
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,79.305221,-182.52003)">
<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,125.04034,-119.77598)"
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,-108.71143,-177.21012)">
<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,-212.65488,-179.47797)"
id="g2767">
<g
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)"
@@ -219,61 +219,5 @@
id="path2765"
inkscape:connector-curvature="0" />
</g>
<g
id="g874"
transform="matrix(1.9732825,0,0,1.9732825,-208.72093,-323.71573)">
<g
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="g868"
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)">
<path
id="path866"
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="path870"
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="path872"
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
transform="matrix(1.9732825,0,0,1.9732825,-134.6376,-374.36454)"
id="g884">
<g
transform="matrix(1,-0.27773651,0,1,59.387949,102.27922)"
id="g878"
style="fill:#2980b9;fill-opacity:1;stroke:#fffbfb;stroke-width:0.13229167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
<path
inkscape:connector-curvature="0"
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"
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"
id="path876" />
</g>
<path
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"
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"
id="path880"
inkscape:connector-curvature="0" />
<path
style="fill:#2980b9;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
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"
id="path882"
inkscape:connector-curvature="0" />
</g>
<ellipse
style="fill:#454545;fill-opacity:1;stroke:none;stroke-width:0.68220371;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:75.59054565;stroke-opacity:1"
id="path886"
cx="158.78319"
cy="17.35313"
rx="1.295833"
ry="1.1623898"
transform="matrix(0.89702138,0.44198716,0,1,0,0)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 17 KiB

+12
View File
@@ -0,0 +1,12 @@
0 Name: pupmotors
0 Author: Pybricks {laurens@pybricks.com}
0 !LICENSE MIT
1 15 600 -280 240 -1 0 0 0 -1 0 0 0 1 37316c01.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
1 0 -400 -310 -374 -1 0 0 0 -1 0 0 0 1 u9218c01.dat
1 15 -400 -320 -410 0 0 1 0 1 0 -1 0 0 20841.dat
1 15 630 -320 -420 1 0 0 0 1 0 0 0 1 26912.dat
1 0 630 -310 -384 -1 0 0 0 -1 0 0 0 1 u9218c01.dat
1 15 60 -320 -430 0 0 1 0 1 0 -1 0 0 20844.dat
1 0 60 -310 -394 -1 0 0 0 -1 0 0 0 1 u9218c01.dat

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

@@ -76,7 +76,7 @@
inkscape:current-layer="svg2"
showguides="false" />
<image
sodipodi:absref="terminal.png"
sodipodi:absref="/home/laurens/pybricks/git/pybricks-api/doc/api/diagram_source/terminal.png"
xlink:href="terminal.png"
width="967.99994"
height="402"

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

@@ -9,13 +9,12 @@ Motors
.. _fig_ev3motors:
.. figure:: ../main/images/ev3motors_label.png
.. figure:: ../api/images/ev3motors_label.png
:width: 100 %
EV3-compatible motors. The arrows indicate the default positive direction.
.. autoclass:: pybricks.ev3devices.Motor
:noindex:
:no-members:
.. rubric:: Measuring
@@ -59,7 +58,7 @@ Motors
Touch Sensor
^^^^^^^^^^^^
.. figure:: ../main/images/sensor_ev3_touch.png
.. figure:: ../api/images/sensor_ev3_touch.png
:width: 18 %
.. autoclass:: pybricks.ev3devices.TouchSensor
@@ -67,7 +66,7 @@ Touch Sensor
Color Sensor
^^^^^^^^^^^^
.. figure:: ../main/images/sensor_ev3_color.png
.. figure:: ../api/images/sensor_ev3_color.png
:width: 18 %
.. autoclass:: pybricks.ev3devices.ColorSensor
@@ -75,11 +74,7 @@ Color Sensor
Infrared Sensor and Beacon
^^^^^^^^^^^^^^^^^^^^^^^^^^
Each method of this class puts the sensor in a different *mode*. Switching
modes takes about one second on this sensor. To make sure that your program
runs quickly, use only of these methods in your program.
.. figure:: ../main/images/sensor_ev3_ir.png
.. figure:: ../api/images/sensor_ev3_ir.png
:width: 60 %
.. autoclass:: pybricks.ev3devices.InfraredSensor
@@ -87,7 +82,7 @@ runs quickly, use only of these methods in your program.
Ultrasonic Sensor
^^^^^^^^^^^^^^^^^
.. figure:: ../main/images/sensor_ev3_ultrasonic.png
.. figure:: ../api/images/sensor_ev3_ultrasonic.png
:width: 22 %
.. autoclass:: pybricks.ev3devices.UltrasonicSensor
@@ -95,7 +90,7 @@ Ultrasonic Sensor
Gyroscopic Sensor
^^^^^^^^^^^^^^^^^
.. figure:: ../main/images/sensor_ev3_gyro.png
.. figure:: ../api/images/sensor_ev3_gyro.png
:width: 18 %
.. autoclass:: pybricks.ev3devices.GyroSensor
+32
View File
@@ -0,0 +1,32 @@
Working with vectors
====================
Scalars and Vectors
~~~~~~~~~~~~~~~~~~~~~~~
.. _scalar:
scalar
--------------
TODO
.. _vector:
vector
--------------
TODO
Robot reference frame
~~~~~~~~~~~~~~~~~~~~~~~
.. _robotframe:
Robot reference frame
----------------------
TODO (explanation, diagram, etc)::
* X: To the right
* Y: forward
* Z: upward
+18
View File
@@ -0,0 +1,18 @@
:mod:`hubs <pybricks.hubs>` -- Programmable Hubs
================================================
.. module:: pybricks.hubs
.. _fig_hubs:
Select your programmable hub using the buttons below.
.. content-tabs::
.. tab-container:: ev3brick
:title: EV3 Brick
.. figure:: ../api/images/ev3brick.png
:height: 15 em
.. include:: hubs_ev3brick.inc
+230
View File
@@ -0,0 +1,230 @@
.. autoclass:: pybricks.hubs.EV3Brick
:no-members:
.. rubric:: Using the buttons
.. automethod:: pybricks.hubs::EV3Brick.buttons.pressed
.. rubric:: Using the brick status light
.. automethod:: pybricks.hubs::EV3Brick.light.on
.. toggle-header::
:header: **Show/hide example**
**Example: Turn the light on and change the color.**
.. literalinclude::
../../pybricks-projects/snippets/ev3/light_color/main.py
.. automethod:: pybricks.hubs::EV3Brick.light.off
.. rubric:: Using the speaker
.. automethod:: pybricks.hubs::EV3Brick.speaker.beep
.. automethod:: pybricks.hubs::EV3Brick.speaker.play_notes
.. toggle-header::
:header: **Show/hide musical note format**
Each note is a string with the following format:
- The first character is the name of the note, ``A`` to ``G``
or ``R`` for a rest.
- Note names can also include an accidental ``#`` (sharp) or
``b`` (flat). ``B#``/``Cb`` and ``E#``/``Fb`` are not
allowed.
- The note name is followed by the octave number ``2``
to ``8``. For example ``C4`` is middle C. The octave changes
to the next number at the note C, for example, ``B3`` is the
note below middle C (``C4``).
- The octave is followed by ``/`` and a number that indicates
the size of the note. For example ``/4`` is a quarter note,
``/8`` is an eighth note and so on.
- This can optionally followed by a ``.`` to make a dotted
note. Dotted notes are 1-1/2 times as long as notes without a
dot.
- The note can optionally end with a ``_`` which is a tie or a
slur. This causes there to be no pause between this note and
the next note.
.. automethod:: pybricks.hubs::EV3Brick.speaker.play_file
.. automethod:: pybricks.hubs::EV3Brick.speaker.say
.. automethod:: pybricks.hubs::EV3Brick.speaker.set_speech_options
.. toggle-header::
:header: **Show/hide available languages and voices**
You can choose the following languages:
- ``'af'``: Afrikaans
- ``'an'``: Aragonese
- ``'bg'``: Bulgarian
- ``'bs'``: Bosnian
- ``'ca'``: Catalan
- ``'cs'``: Czech
- ``'cy'``: Welsh
- ``'da'``: Danish
- ``'de'``: German
- ``'el'``: Greek
- ``'en'``: English (default)
- ``'en-gb'``: English (United Kingdom)
- ``'en-sc'``: English (Scotland)
- ``'en-uk-north'``: English (United Kingdom, Northern)
- ``'en-uk-rp'``:
English (United Kingdom, Received Pronunciation)
- ``'en-uk-wmids'``: English (United Kingdom, West Midlands)
- ``'en-us'``: English (United States)
- ``'en-wi'``: English (West Indies)
- ``'eo'``: Esperanto
- ``'es'``: Spanish
- ``'es-la'``: Spanish (Latin America)
- ``'et'``: Estonian
- ``'fa'``: Persian
- ``'fa-pin'``: Persian
- ``'fi'``: Finnish
- ``'fr-be'``: French (Belgium)
- ``'fr-fr'``: French (France)
- ``'ga'``: Irish
- ``'grc'``: Greek
- ``'hi'``: Hindi
- ``'hr'``: Croatian
- ``'hu'``: Hungarian
- ``'hy'``: Armenian
- ``'hy-west'``: Armenian (Western)
- ``'id'``: Indonesian
- ``'is'``: Icelandic
- ``'it'``: Italian
- ``'jbo'``: Lojban
- ``'ka'``: Georgian
- ``'kn'``: Kannada
- ``'ku'``: Kurdish
- ``'la'``: Latin
- ``'lfn'``: Lingua Franca Nova
- ``'lt'``: Lithuanian
- ``'lv'``: Latvian
- ``'mk'``: Macedonian
- ``'ml'``: Malayalam
- ``'ms'``: Malay
- ``'ne'``: Nepali
- ``'nl'``: Dutch
- ``'no'``: Norwegian
- ``'pa'``: Punjabi
- ``'pl'``: Polish
- ``'pt-br'``: Portuguese (Brazil)
- ``'pt-pt'``: Portuguese (Portugal)
- ``'ro'``: Romanian
- ``'ru'``: Russian
- ``'sk'``: Slovak
- ``'sq'``: Albanian
- ``'sr'``: Serbian
- ``'sv'``: Swedish
- ``'sw'``: Swahili
- ``'ta'``: Tamil
- ``'tr'``: Turkish
- ``'vi'``: Vietnamese
- ``'vi-hue'``: Vietnamese (Hue)
- ``'vi-sgn'``: Vietnamese (Saigon)
- ``'zh'``: Mandarin Chinese
- ``'zh-yue'``: Cantonese Chinese
You can choose the following voices:
- ``'f1'``: female variant 1
- ``'f2'``: female variant 2
- ``'f3'``: female variant 3
- ``'f4'``: female variant 4
- ``'f5'``: female variant 5
- ``'m1'``: male variant 1
- ``'m2'``: male variant 2
- ``'m3'``: male variant 3
- ``'m4'``: male variant 4
- ``'m5'``: male variant 5
- ``'m6'``: male variant 6
- ``'m7'``: male variant 7
- ``'croak'``: croak
- ``'whisper'``: whisper
- ``'whisperf'``: female whisper
.. automethod:: pybricks.hubs::EV3Brick.speaker.set_volume
.. rubric:: Using the screen
.. |this image| replace:: the screen
.. automethod:: pybricks.hubs::EV3Brick.screen.clear
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_text
.. automethod:: pybricks.hubs::EV3Brick.screen.print
.. toggle-header::
:header: **Show/hide example**
**Example: Say hello... in several ways.**
.. raw:: latex
\begin{CJK}{UTF8}{gbsn}
.. literalinclude::
../../pybricks-projects/snippets/ev3/screen_print/main.py
.. raw:: latex
\end{CJK}
.. automethod:: pybricks.hubs::EV3Brick.screen.set_font
**Example:** See example in :meth:`print`.
.. automethod:: pybricks.hubs::EV3Brick.screen.load_image
.. toggle-header::
:header: **Show/hide example**
**Example: Show an image on the screen.**
.. literalinclude::
../../pybricks-projects/snippets/ev3/screen_image/main.py
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_image
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_line
.. toggle-header::
:header: **Show/hide example**
**Example: Draw some shapes on the screen.**
.. literalinclude::
../../pybricks-projects/snippets/ev3/screen_draw/main.py
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_box
**Example:** See example in :meth:`draw_line`.
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_circle
**Example:** See example in :meth:`draw_line`.
.. autoattribute:: pybricks.hubs::EV3Brick.screen.width
.. autoattribute:: pybricks.hubs::EV3Brick.screen.height
.. automethod:: pybricks.hubs::EV3Brick.screen.save
.. rubric:: Using the battery
.. automethod:: pybricks.hubs::EV3Brick.battery.voltage
.. automethod:: pybricks.hubs::EV3Brick.battery.current

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Some files were not shown because too many files have changed in this diff Show More