Metadata-Version: 2.4
Name: sbot
Version: 2025.1.0.post1
Summary: The robot API for the Smallpeice summer school
Author-email: SourceBots <hello@sourcebots.co.uk>
License: MIT License
        
        Copyright (c) 2019-21 Dan Trickey
        Copyright (c) 2023 SourceBots
        
        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.
        
Project-URL: Repository, https://github.com/sourcebots/sbot
Project-URL: Homepage, https://sourcebots.co.uk
Project-URL: Documentation, https://docs.sourcebots.co.uk
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Classifier: Typing :: Typed
Classifier: Topic :: Education
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyserial<4,>=3
Requires-Dist: april_vision==2.2.0
Requires-Dist: typing-extensions; python_version < "3.10"
Requires-Dist: python-dotenv==1.0.1
Provides-Extra: dev
Requires-Dist: poethepoet<1,>=0.0.1; extra == "dev"
Requires-Dist: ruff==0.9.8; extra == "dev"
Requires-Dist: mypy==1.10.0; python_version < "3.9" and extra == "dev"
Requires-Dist: mypy<2,>=1.7; python_version >= "3.9" and extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: types-pyserial; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: paho-mqtt<3,>=2; extra == "dev"
Provides-Extra: vision
Requires-Dist: opencv-python-headless<5,>=4; extra == "vision"
Provides-Extra: mqtt
Requires-Dist: paho-mqtt<3,>=2; extra == "mqtt"
Dynamic: license-file

# sbot

[![Lint & build](https://github.com/sourcebots/sbot/actions/workflows/test_build.yml/badge.svg)](https://github.com/sourcebots/sbot/actions/workflows/test_build.yml)
[![PyPI version](https://badge.fury.io/py/sbot.svg)](https://badge.fury.io/py/sbot)
[![Documentation Status](https://readthedocs.org/projects/pip/badge/?version=stable)](http://pip.pypa.io/en/stable/?badge=stable)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://opensource.org/licenses/MIT)
![Bees](https://img.shields.io/badge/bees-110%25-yellow.svg)

`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:

```bash
pip install sbot
```

To install the full package, including openCV, you can install with:

```bash
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.

```python

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.

```python

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`.
