Skip to main content

The robot API for the Smallpeice summer school

Project description

sbot

Lint & build PyPI version Documentation Status MIT license Bees

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 a BoardDisconnectionError.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sbot-2025.0.1.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

sbot-2025.0.1-py3-none-any.whl (71.5 kB view details)

Uploaded Python 3

File details

Details for the file sbot-2025.0.1.tar.gz.

File metadata

  • Download URL: sbot-2025.0.1.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sbot-2025.0.1.tar.gz
Algorithm Hash digest
SHA256 8d8e56cddd03453f45ef72ec95f20cfa7b0c6335020d60c5d803e407f6f9d42b
MD5 f7f8712b19c3537c110b71f404ab205d
BLAKE2b-256 9b4d02deba003e39db88ef78eac895741681f87a594f93a91a89c46351281acb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbot-2025.0.1.tar.gz:

Publisher: test_build.yml on sourcebots/sbot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sbot-2025.0.1-py3-none-any.whl.

File metadata

  • Download URL: sbot-2025.0.1-py3-none-any.whl
  • Upload date:
  • Size: 71.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sbot-2025.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bbf8592d990127e2621423e026eb6119d6e9aba6f02cd5037c9d7581b597e46
MD5 18278c90ba71075d643b008046429cf6
BLAKE2b-256 86c0d4012860f98013ee6c937d41f402e067deb47c4aa37176bf61588b4a9f0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbot-2025.0.1-py3-none-any.whl:

Publisher: test_build.yml on sourcebots/sbot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page