The robot API for the Smallpeice summer school
Project description
sbot
sbot
- SourceBots Robot API
This is the API for SourceBots, library for writing Robotics APIs. It will first be deployed at Smallpeice 2023.
Installation
If you wish to install openCV from your package manager, you can install the base package with:
pip install sbot
To install the full package, including openCV, you can install with:
pip install sbot[vision]
Usage
The main entry point for the API is the Robot
class.
Intantiating this class will automatically detect and connect to any SR v4 boards connected to the device.
By default, the Robot
class will wait for the start button on the power board to be pressed before continuing.
from sbot import Robot
r = Robot()
To disable the waiting for the start button, you can pass wait_for_start=False
to the constructor.
The wait_for_start
method needs to be called before the metadata is available.
from sbot import Robot
r = Robot(wait_for_start=False)
# Setup in here
r.wait_start()
Developer Notes
There are a number of considerations that have been made in the design of this API. Some of these may not be immediately obvious, so they are documented below.
- The API is designed to raise exceptions for incorrect actions, such as trying to modify the output dictionary or assign a value directly to the motor object.
MappingProxyType
is used to prevent the user from adding, removing or overwriting keys in any parts of the API that return a dictionary.tuple
is used to prevent the user from adding, removing or overwriting items in any parts of the API that would return a list.__slots__
is used to prevent the user from adding, removing or overwriting attributes in any parts of the API.sbot.serial_wrapper.SerialWrapper
handles automatic reconnection to the serial port if the connection is lost and impleents 3 retries on any serial operation before raising aBoardDisconnectionError
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sbot-1.0.0.tar.gz
.
File metadata
- Download URL: sbot-1.0.0.tar.gz
- Upload date:
- Size: 42.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32306c1ae5ab1a244b5f19404f92e4633025ad925edb6f30866c77f608be428a |
|
MD5 | db551c46e2a4d9423b6f66135e2ba570 |
|
BLAKE2b-256 | 1eb650aabb84df7f091d35d3ff1885e19fdbb2fac35e89a317c43b006cabfed3 |
File details
Details for the file sbot-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: sbot-1.0.0-py3-none-any.whl
- Upload date:
- Size: 34.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e7916bdf3c46b33f1010a66af745e9ec5e8aa4b417ba38b8b17a991d2413b30 |
|
MD5 | 2df2e5b7951a981f7621bea2f9328a79 |
|
BLAKE2b-256 | 456ff772b258ee39820ed1b0851ff77ced1fdd505889dee4bc29e2dd7e9c7485 |