Metadata-Version: 2.1
Name: pydotbot
Version: 0.15.1
Summary: Package to easily control your DotBots and SailBots.
Project-URL: Homepage, https://github.com/DotBots/PyDotBot
Project-URL: Bug Tracker, https://github.com/DotBots/PyDotBot/issues
Author-email: Alexandre Abadie <alexandre.abadie@inria.fr>, Theo Akbas <theo.akbas@inria.fr>
License: BSD
License-File: LICENSE.txt
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: click==8.1.3
Requires-Dist: fastapi==0.85.1
Requires-Dist: haversine==2.7.0
Requires-Dist: numpy==1.23.4
Requires-Dist: opencv-python==4.6.0.66
Requires-Dist: pygame==2.1.2
Requires-Dist: pynput==1.7.6
Requires-Dist: pyserial==3.5
Requires-Dist: rich==12.6.0
Requires-Dist: structlog==22.3.0
Requires-Dist: uvicorn==0.18.3
Requires-Dist: websockets==10.4
Description-Content-Type: text/markdown

[![CI][ci-badge]][ci-link]
[![Coverage][codecov-badge]][codecov-link]
[![PyPI version][pypi-badge]][pypi-link]

# PyDotBot

This package contains a complete environment for controlling and visualizing
[DotBots](http://www.dotbots.org).

The DotBots hardware design can be found
[here (PCB)][dotbot-pcb-repo] and [here (chassis)][dotbot-chassis-repo].
The firmware running on the DotBots can be found [here][dotbot-firmware-repo].

This package can also be used to control devices running the SailBot firmware
application.

![DotBots controller overview][pydotbot-overview]

## Installation

Run `pip install pydotbot`

## Setup

Flash the required firmwares on the DotBots and gateway board (use an
nRF52840DK board as gateway), as explained in
[the DotBots firmware repository][dotbot-firmware-repo].

## Usage

```
dotbot-controller --help
Usage: dotbot-controller [OPTIONS]

  BotController, universal SailBot and DotBot controller.

Options:
  -t, --type [joystick|keyboard]  Type of your controller. Defaults to
                                  'keyboard'
  -p, --port TEXT                 Linux users: path to port in '/dev' folder ;
                                  Windows users: COM port. Defaults to
                                  '/dev/ttyACM0'
  -b, --baudrate INTEGER          Serial baudrate. Defaults to 1000000
  -d, --dotbot-address TEXT       Address in hex of the DotBot to control.
                                  Defaults to FFFFFFFFFFFFFFFF
  -g, --gw-address TEXT           Gateway address in hex. Defaults to
                                  0000000000000000
  -s, --swarm-id TEXT             Swarm ID in hex. Defaults to 0000
  -w, --webbrowser                Open a web browser automatically
  -T, --table                     Display table in terminal
  -v, --verbose                   Run in verbose mode (all payloads received
                                  are printed in terminal)
  --log-level [debug|info|warning|error]
                                  Logging level. Defaults to info
  --log-output PATH               Filename where logs are redirected
  --help                          Show this message and exit.
```

By default, the controller expects the serial port to be `/dev/ttyACM0`, as on
Linux, use the `--port` option to specify another one if it's different. For
example, on Windows, you'll need to check which COM port is connected to the
gateway and add `--port COM3` if it's COM3.

Using the `--webbrowser` option, a tab will automatically open at
[http://localhost:8000/dotbots](http://localhost:8000/dotbots). The page maintains
a list of available DotBots, allows to set which one is active and controllable
and provide a virtual joystick to control it or change the color of the on-board
RGB LED.

### Lighthouse positioning

The DotBots firmware comes with a cheap indoor positioning system based on
[Valve Lighthouse 2](https://www.valvesoftware.com/en/index/base-stations).

To get the positioning to work and the DotBots to be tracked in real-time the
system must be first calibrated by clicking the "Start calibration" or
"Update calibration" button below the grid map and then by following the
instructions there.

## Tests

To run the tests, install [tox](https://pypi.org/project/tox/) and use it:

```
tox
```


[ci-badge]: https://github.com/DotBots/PyDotBot/workflows/CI/badge.svg
[ci-link]: https://github.com/DotBots/PyDotBot/actions?query=workflow%3ACI+branch%3Amain
[pypi-badge]: https://badge.fury.io/py/pydotbot.svg
[pypi-link]: https://badge.fury.io/py/pydotbot
[codecov-badge]: https://codecov.io/gh/DotBots/PyDotBot/branch/main/graph/badge.svg
[codecov-link]: https://codecov.io/gh/DotBots/PyDotBot

[pydotbot-overview]: https://github.com/DotBots/PyDotBot/blob/main/dotbots.png?raw=True
[dotbot-firmware-repo]: https://github.com/DotBots/DotBot-firmware
[dotbot-pcb-repo]: https://github.com/DotBots/DotBot-pcb
[dotbot-chassis-repo]: https://github.com/DotBots/DotBot-chassis
