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-2024.0.2.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

sbot-2024.0.2-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sbot-2024.0.2.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for sbot-2024.0.2.tar.gz
Algorithm Hash digest
SHA256 b25eb168a6b6978f8f8247d17c68132fe179d172f3c1a82cfca0acbf4cf1594b
MD5 916130f3349eb9ed7f63fa1b8af13bcd
BLAKE2b-256 e0d7a5b9afbbb9b68290f8429133a9fd74cbb6d97086e459c9da2bb1f65989bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sbot-2024.0.2-py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for sbot-2024.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb300804b4643e19b1b80b81404a65958b4b8ffdd465da9a080d4802827e09be
MD5 85f7982b9d1438de81330802e4a29079
BLAKE2b-256 7535e0f5162f7632357a4e732a081c577dbb780008bdd76453d709d1bd8d975b

See more details on using hashes here.

Supported by

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