edu_robot_api
A small, typed Python API for educational robotics. It represents robots, sensors and actuators as Python objects and provides a consistent interface for reading measurements and issuing movement commands.
RoboWorkbench uses the API for independent virtual learning robots. Their behavior is defined by the learning environment. Available components, measurements and motion depend on the selected model and world.
Installation
Requires Python 3.11 or later. Install from PyPI with pip:
python -m pip install edu_robot_api
Alternatively, install a downloaded wheel:
python -m pip install edu_robot_api-0.6.0-py3-none-any.whl
In the RoboWorkbench web app, no local installation is needed.
Documentation
See the user guide and API overview for examples and the class diagram. The source repository also provides the library source code.
Programming in RoboWorkbench
The web app provides the connected robot for the current editor as rob.
Each robot program controls its own robot. The environment stops the robot
and releases the connection when the program finishes, fails or is aborted.
import time
def program(robot):
sensor = robot.sensors()["distance_front"]
while True:
distance = sensor.read()
if distance is None or distance < 25:
robot.stop()
else:
robot.forward(30)
time.sleep(0.03)
program(rob)
This example requires a front distance sensor. In a standalone Python application, the application must supply the robot object and its backend; installing the API alone does not create a robot or a running simulation.
Components and readings
robot.sensors() and robot.actuators() return dictionaries of component
objects. Use sensor.read() for an individual reading or
robot.read_sensors() for a snapshot. Snapshot values can be selected by
sensor object, captured name or position in the selection.
left = rob.sensors()["line_left"]
right = rob.sensors()["line_right"]
values = rob.read_sensors([left, right])
print(values[left], values[right])
The package exports Robot, Sensor, Actuator, typed component classes,
SensorReadings, Bridge, Backend and FunctionBackend. Python applications
can implement the backend contract to provide measurements and execute commands.
Motor power is expressed as a percentage, distance in centimeters and angles
in degrees. Motor power is not a guaranteed speed. None indicates an unavailable
measurement; missing capabilities and connection failures can raise exceptions.
License
The library is licensed under the Apache License, Version 2.0. See LICENSE.
Metadata
Release files for edu-robot-api 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| edu_robot_api-0.6.0.tar.gz | 16.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| edu_robot_api-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.6 kB
Release files / edu_robot_api-0.6.0.tar.gz
| Download URL | edu_robot_api-0.6.0.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50cbd956715392b7a5d2f1dc94cc1a8ddb2ead36d99dc9feae068d4681b9d5ca
|
|
BLAKE2b-256 checksum How to use checksums |
5c0b1911accdef47656ceca5fcb61b87197ec1f1a79534591ddc974ae928dbd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / edu_robot_api-0.6.0-py3-none-any.whl
| Download URL | edu_robot_api-0.6.0-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5d6c4e6f06d1aaa00bcd11e28ba6d8dd49eafdd19e770d3298bf6e3b7032a39
|
|
BLAKE2b-256 checksum How to use checksums |
6b3d70d927d977b89616035a76cb3884793594f6d324e2ac9201bc2c9a74f937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for edu-robot-api 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.