asyncio interface for iRobot Root
Project description
Root robot
Python async API for iRobot Root (coding robot) over bluetooth-low-energy protocol.
Protocol specifications from https://github.com/RootRobotics/root-robot-ble-protocol.
Installation
Install the aiorobot package from PyPI with pip.
pip install aiorobot
Quickstart
To simply run the robot, use the run function of aiorobot module.
It takes coroutine callbacks for different root robot events.
from aiorobot import run
async def main(robot):
for i in range(4):
await robot.led.on((0, i * 80, 100))
await robot.motor.drive(150)
await robot.motor.rotate(900)
await robot.disconnect()
run(started=main)
This will search for a root robot in bluetooth devices, connect to it and call the main coroutine when the root is ready.
So make sure you have bluetooth enabled and working on your computer.
Accepted keyword-arguments of run function are event names listed in aiorobot/events.py.
You can also directly get a robot and interact with it with get_robot function that you can use as an async context-manager to start the connection.
import asyncio
from aiorobot import get_robot
async def main():
async with get_robot() as robot:
await robot.motor.drive(150)
asyncio.run(main())
Then you will need to handle events yourself (iterate over robot.events or call robots.events.process()) to get updates from the robot.
See more code examples in aiorobot/examples directory.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiorobot-0.3.0.tar.gz.
File metadata
- Download URL: aiorobot-0.3.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56174fdabf91edbfbce973112375c700946b5b5a617dd4ddb6bd51dc2a31f2f0
|
|
| MD5 |
78604423b7371f11cc54ecbd8258e923
|
|
| BLAKE2b-256 |
b3bb2abb2c49098e989ea0e01f5ae2900d479e02b08ae72c59af7e574fcb7aa2
|
File details
Details for the file aiorobot-0.3.0-py3-none-any.whl.
File metadata
- Download URL: aiorobot-0.3.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f039beac8d0891ee0a3752352ea9109181c1170dcccc3265c75fa7e50f659b1b
|
|
| MD5 |
d7db29089254e875e7936650e4b21ce4
|
|
| BLAKE2b-256 |
436855daa8de7317702517a381c3eb3870e820d316ea515c0dced94206337317
|