Compare commits

...
Author SHA1 Message Date
David Lechner b84fed1de9 npm/images: add hub-inventor.png file to package 2022-10-28 12:38:07 -05:00
David Lechner d49bc548c7 npm/images: new @pybricks/images package v1.0.0 2022-10-28 12:21:27 -05:00
Barry-Williams 492d6cd2d4 pybricks.robotics.DriveBase: Add basic example. 2022-10-28 08:23:14 +02:00
Laurens Valk be3558167e doc/common/extensions: Fix compatibility labels.
Fixes https://github.com/pybricks/support/issues/754
2022-10-27 15:41:42 +02:00
David Lechner 4573fd2760 LICENSE: update copyright year 2022-10-21 13:14:13 -05:00
David Lechner 2a23c2e81d npm/jedi: v1.1.0
- Update pybricks_jedi Python package dependency.
- Bump JavaScript package version for release.
2022-10-21 13:08:14 -05:00
12 changed files with 153 additions and 4 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Release @pybricks/images
on:
push:
tags:
- '@pybricks/images/**'
jobs:
publish_ide_docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: ./build.py
working-directory: npm/images
- run: yarn publish
working-directory: npm/images/build
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018-2021 The Pybricks Authors
Copyright (c) 2018-2022 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
+1 -1
View File
@@ -58,7 +58,7 @@ class PybricksRequirementsStaticDirective(Directive):
# Cell with image of a hub.
hub_cell = """
<th><div class="align-default">
<img alt="" src="{0}_images/compat_{1}_{2}_label.png">
<img alt="" src="{0}_images/compat_{1}_{2}.png">
</div></th>
"""
+9
View File
@@ -104,3 +104,12 @@
.. autoattribute:: pybricks.robotics.DriveBase.heading_control
:annotation:
Examples
-------------------
Driving straight and turning in place
**********************************************
.. literalinclude::
../../examples/pup/robotics/drivebase_basics.py
+24
View File
@@ -0,0 +1,24 @@
from pybricks.pupdevices import Motor
from pybricks.parameters import Port, Direction
from pybricks.robotics import DriveBase
# Initialize both motors. In this example, the motor on the
# left must turn counterclockwise to make the robot go forward.
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.B)
# Initialize the drive base. In this example, the wheel diameter is 56mm.
# The distance between the two wheel-ground contact points is 112mm.
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=56, axle_track=112)
# Drive forward by 500mm (half a meter).
drive_base.straight(500)
# Turn around clockwise (180 degrees)
drive_base.turn(180)
# Drive forward again to drive back.
drive_base.straight(500)
# Turn around counterclockwise.
drive_base.turn(-180)
+2
View File
@@ -0,0 +1,2 @@
version-tag-prefix "@pybricks/images/v"
version-git-message "@pybricks/images v%s"
+13
View File
@@ -0,0 +1,13 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 1.1.0 - 2022-10-28
### Added
- Added MINDSTORMS Robot Inventor hub image.
## 1.0.0 - 2022-10-28
### Added
- Added new @pybricks/images package.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018-2022 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+5
View File
@@ -0,0 +1,5 @@
@pybricks/images
================
Image resource for Pybricks Code.
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
import json
import pathlib
import shutil
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
IMAGE_DIR = (
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "cad" / "output"
).resolve()
HUBS = ["move", "city", "technic", "prime", "essential", "inventor"]
package_json = {
"name": "@pybricks/images",
"version": "1.1.0",
"description": "Distribution of Pybricks images.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pybricks/pybricks-api",
"directory": "npm/images",
},
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
}
# ensure empty build directory so we don't end up with stale files
shutil.rmtree(BUILD_DIR, True)
BUILD_DIR.mkdir()
# copy the hub images
for h in HUBS:
shutil.copyfile(IMAGE_DIR / f"hub-{h}.png", BUILD_DIR / f"hub-{h}.png")
# generate package.json file
# create "exports" item for hub images.
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
with open(BUILD_DIR / "package.json", "w") as f:
json.dump(package_json, f, indent=2)
# copy additional files
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
for file in "README.md", "CHANGELOG.md", "LICENSE":
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)
+5
View File
@@ -2,6 +2,11 @@
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 1.1.0 - 2022-10-21
### Changed
- Updated `pybricks_jedi` Python package to v1.2.0.
## 1.0.1 - 2022-09-07
### Fixed
+2 -2
View File
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
package_json = {
"name": "@pybricks/jedi",
"version": "1.0.1",
"version": "1.2.0",
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
"repository": {
"type": "git",
@@ -38,7 +38,7 @@ subprocess.check_call(
"pip",
"download",
"--only-binary=any",
"pybricks-jedi==1.1.0",
"pybricks-jedi==1.2.0",
],
cwd=BUILD_DIR,
)