mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b84fed1de9 | ||
|
|
d49bc548c7 | ||
|
|
492d6cd2d4 | ||
|
|
be3558167e | ||
|
|
4573fd2760 | ||
|
|
2a23c2e81d |
@@ -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,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
|
||||
|
||||
@@ -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>
|
||||
"""
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,2 @@
|
||||
version-tag-prefix "@pybricks/images/v"
|
||||
version-git-message "@pybricks/images v%s"
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -0,0 +1,5 @@
|
||||
@pybricks/images
|
||||
================
|
||||
|
||||
Image resource for Pybricks Code.
|
||||
|
||||
Executable
+47
@@ -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)
|
||||
@@ -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
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user