A Python library for Roomba Open Interface
Project description
PyRoombaAdapter
A Python library for Roomba Open Interface
What is this?
This is a python library for Roomba Open Interface(ROI)
This module is based on the document:
It aims to control a Roomba easily.
This module is only tested on Roomba 690 model.
Install
You can use setup.py to install it.
$ git clone https://github.com/AtsushiSakai/PyRoombaAdapter.git $ sudo python PyRoombaAdapter/setup.py install
Requirements
Python 3.6.x or higher (2.7 is not supported)
Documentation
Please check the document for all API and usages.
Usage examples
All examples are in examples directory.
Click each image to see each example movie.
Go and back example
This example uses “move” API.
"""
Go and back example with roomba
"""
from time import sleep
import numpy as np
from pyroombaadapter import PyRoombaAdapter
PORT = "/dev/ttyUSB0"
adapter = PyRoombaAdapter(PORT)
adapter.move(0.2, np.deg2rad(0.0)) # go straight
sleep(1.0)
adapter.move(0, np.deg2rad(-20)) # turn right
sleep(6.0)
adapter.move(0.2, np.deg2rad(0.0)) # go straight
sleep(1.0)
adapter.move(0, np.deg2rad(20)) # turn left
sleep(6.0)
Play song1
This example uses “send_song_cmd” and “send_play_cmd” API.
"""
Play Darth Vader song
"""
from time import sleep
from pyroombaadapter import PyRoombaAdapter
PORT = "/dev/ttyUSB0"
adapter = PyRoombaAdapter(PORT)
adapter.send_song_cmd(0, 9,
[69, 69, 69, 65, 72, 69, 65, 72, 69],
[40, 40, 40, 30, 10, 40, 30, 10, 80])
adapter.send_play_cmd(0)
sleep(10.0)
Play song2
This example uses “send_song_cmd” and “send_play_cmd” API.
"""
Play namidaga kirari by spitz
"""
from time import sleep
from pyroombaadapter import PyRoombaAdapter
PORT = "/dev/ttyUSB0"
adapter = PyRoombaAdapter(PORT)
adapter.send_song_cmd(0, 10,
[66, 67, 69, 67, 66, 62, 64, 66, 67, 66],
[16, 16, 16, 32, 32, 16, 16, 16, 16, 64])
sleep(1.0)
adapter.send_song_cmd(1, 9,
[66, 67, 69, 67, 66, 71, 59, 62, 61],
[16, 16, 16, 32, 32, 32, 16, 16, 64])
sleep(1.0)
adapter.send_song_cmd(2, 13,
[62, 64, 61, 62, 64, 66, 62, 64, 66, 67, 64, 66, 71],
[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16])
sleep(1.0)
adapter.send_song_cmd(3, 7,
[71, 67, 64, 62, 61, 62, 62],
[16, 16, 16, 16, 48, 16, 64])
sleep(3.0)
adapter.send_play_cmd(0)
sleep(4.0)
adapter.send_play_cmd(1)
sleep(4.0)
adapter.send_play_cmd(0)
sleep(4.0)
adapter.send_play_cmd(1)
sleep(4.0)
adapter.send_play_cmd(2)
sleep(4.0)
adapter.send_play_cmd(3)
sleep(4.0)
Contribution
Any contributions to this project are welcome!
Feel free to make an issue and a PR to improve this OSS.
License
MIT
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
Built Distribution
File details
Details for the file pyroombaadapter-0.1.1.tar.gz
.
File metadata
- Download URL: pyroombaadapter-0.1.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 536157fbfdbb1903aafe6b211b8ff01346672c63b3b9db20db86fdd50709d62e |
|
MD5 | 0cfed1fe2906404d030ebfa67254438b |
|
BLAKE2b-256 | 9183084f579c332a27774d343b903d5e4025b7c41e0148addb029bcab7fe00dd |
File details
Details for the file pyroombaadapter-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyroombaadapter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd49137a1af1170a96a4792eef8cbaae677f58f89eba2f9902f43de571cc3f93 |
|
MD5 | e47cd1f11d2f4fdc58a70bb943d65337 |
|
BLAKE2b-256 | 8469c0dd3a73595876e5b8c7b428cf9d4c7e0cdef165476be30ccb961bc05680 |