-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d58efcb
commit 1d5ceac
Showing
31 changed files
with
19,296 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
build/html/ | ||
.DS_Store | ||
.idea | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Overview: module code — PyRoombaAdapter 0.2.0 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css" /> | ||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> | ||
<script src="../_static/jquery.js"></script> | ||
<script src="../_static/underscore.js"></script> | ||
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> | ||
<script src="../_static/doctools.js"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
|
||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" /> | ||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> | ||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>All modules for which code is available</h1> | ||
<ul><li><a href="pyroombaadapter.html">pyroombaadapter</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> | ||
<div class="sphinxsidebarwrapper"> | ||
<p class="logo"><a href="../index.html"> | ||
<img class="logo" src="../_static/icon.png" alt="Logo"/> | ||
</a></p> | ||
<h1 class="logo"><a href="../index.html">PyRoombaAdapter</a></h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<p> | ||
<iframe src="https://ghbtns.com/github-btn.html?user=AtsushiSakai&repo=PyRoombaAdapter&type=watch&count=true&size=large&v=2" | ||
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe> | ||
</p> | ||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../API.html">API</a></li> | ||
<li class="toctree-l1"><a class="reference external" href="https://github.com/AtsushiSakai/PyRoombaAdapter/">GitHub</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../index.html">Documentation overview</a><ul> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<div id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</div> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
<h3 class="donation">Donate/support</h3> | ||
|
||
|
||
|
||
<p> | ||
<a class="badge" href="https://www.patreon.com/myenigma"> | ||
<img src="https://img.shields.io/badge/donate-%E2%9D%A4%C2%A0-ff69b4.svg?style=flat" alt="Donate"> | ||
</a> | ||
</p> | ||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2019, Atsushi Sakai. | ||
|
||
| | ||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.0.2</a> | ||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a> | ||
|
||
</div> | ||
|
||
|
||
<a href="https://github.com/AtsushiSakai/PyRoombaAdapter" class="github"> | ||
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" class="github"/> | ||
</a> | ||
|
||
|
||
|
||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
API | ||
================== | ||
|
||
.. automodule:: pyroombaadapter | ||
:members: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,260 @@ | ||
PyRoombaAdapter | ||
=============== | ||
|
||
A Python library for Roomba Open Interface | ||
|
||
|Downloads| |image1| |image2| | ||
|
||
What is this? | ||
============= | ||
|
||
This is a python library for Roomba Open Interface(ROI) | ||
|
||
This module is based on the document: | ||
|
||
- `iRobot® Roomba 500 Open Interface (OI) | ||
Specification <https://www.irobot.lv/uploaded_files/File/iRobot_Roomba_500_Open_Interface_Spec.pdf>`__ | ||
|
||
It aims to control a Roomba easily. | ||
|
||
This module is only tested on Roomba 690 model. | ||
|
||
Install | ||
======= | ||
|
||
You can use pip to install it. | ||
|
||
:: | ||
|
||
$ pip install pyroombaadapter | ||
|
||
- `pyroombaadapter · | ||
PyPI <https://pypi.org/project/pyroombaadapter/>`__ | ||
|
||
Requirements | ||
============ | ||
|
||
- Python 3.6.x or higher (2.7 is not supported) | ||
|
||
- `pyserial <https://pythonhosted.org/pyserial/>`__ | ||
|
||
Documentation | ||
============= | ||
|
||
Please check the document for all API and usages. | ||
|
||
- `Welcome to PyRoombaAdapter’s | ||
documentation! <https://atsushisakai.github.io/PyRoombaAdapter/>`__ | ||
|
||
Usage examples | ||
============== | ||
|
||
All examples are in examples directory. | ||
|
||
Click each image to see each example movie. | ||
|
||
Go and back example | ||
------------------- | ||
|
||
|image3| | ||
|
||
This example uses “move” API. | ||
|
||
- `move | ||
API <https://atsushisakai.github.io/PyRoombaAdapter/API.html#pyroombaadapter.PyRoombaAdapter.move>`__ | ||
|
||
.. code:: python | ||
""" | ||
Go and back example with roomba | ||
""" | ||
from time import sleep | ||
import math | ||
from pyroombaadapter import PyRoombaAdapter | ||
PORT = "/dev/ttyUSB0" | ||
adapter = PyRoombaAdapter(PORT) | ||
adapter.move(0.2, math.radians(0.0)) # go straight | ||
sleep(1.0) | ||
adapter.move(0, math.radians(-20)) # turn right | ||
sleep(6.0) | ||
adapter.move(0.2, math.radians(0.0)) # go straight | ||
sleep(1.0) | ||
adapter.move(0, math.radians(20)) # turn left | ||
sleep(6.0) | ||
#Print the total distance traveled | ||
print(f"distance: {adapter.request_distance()} mm, angle: {adapter.request_angle()} rad") | ||
Play song1 | ||
---------- | ||
|
||
|image4| | ||
|
||
This example uses “send_song_cmd” and “send_play_cmd” API. | ||
|
||
- `send_song_cmd | ||
API <https://atsushisakai.github.io/PyRoombaAdapter/API.html#pyroombaadapter.PyRoombaAdapter.send_song_cmd>`__ | ||
|
||
- `send_play_cmd | ||
API <https://atsushisakai.github.io/PyRoombaAdapter/API.html#pyroombaadapter.PyRoombaAdapter.send_play_cmd>`__ | ||
|
||
.. code:: python | ||
""" | ||
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 | ||
---------- | ||
|
||
|image5| | ||
|
||
This example uses “send_song_cmd” and “send_play_cmd” API. | ||
|
||
- `send_song_cmd | ||
API <https://atsushisakai.github.io/PyRoombaAdapter/API.html#pyroombaadapter.PyRoombaAdapter.send_song_cmd>`__ | ||
|
||
- `send_play_cmd | ||
API <https://atsushisakai.github.io/PyRoombaAdapter/API.html#pyroombaadapter.PyRoombaAdapter.send_play_cmd>`__ | ||
|
||
.. code:: python | ||
""" | ||
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) | ||
Read sensors | ||
------------ | ||
|
||
There are two ways how to read sensor values. Request manually on | ||
demand: | ||
|
||
.. code:: python | ||
""" | ||
Read Roomba sensors | ||
""" | ||
from time import sleep | ||
from pyroombaadapter import PyRoombaAdapter | ||
PORT = "/dev/ttyUSB0" | ||
adapter = PyRoombaAdapter(PORT) | ||
adapter.change_mode_to_passive() | ||
# Request sensor value manually | ||
print(adapter.request_charging_state()) | ||
print(adapter.request_voltage()) | ||
print(adapter.request_current()) | ||
print(adapter.request_temperature()) | ||
print(adapter.request_charge()) | ||
print(adapter.request_capacity()) | ||
print(adapter.request_oi_mode()) | ||
print(adapter.request_distance()) | ||
print(adapter.request_angle()) | ||
Start a data stream: | ||
|
||
.. code:: python | ||
""" | ||
Read Roomba sensors | ||
""" | ||
from time import sleep | ||
from pyroombaadapter import PyRoombaAdapter | ||
PORT = "/dev/ttyUSB0" | ||
adapter = PyRoombaAdapter(PORT) | ||
adapter.change_mode_to_passive() | ||
# Read sensor value from data stream | ||
adapter.data_stream_start( | ||
["Charging State", "Voltage", "Current", "Temperature", "Battery Charge", "Battery Capacity", "OI Mode"]) | ||
sleep(1) | ||
print(adapter.data_stream_read()) | ||
sleep(1) | ||
print(adapter.data_stream_read()) | ||
sleep(1) | ||
print(adapter.data_stream_read()) | ||
sleep(1) | ||
adapter.data_stream_stop() | ||
Contribution | ||
============ | ||
|
||
Any contributions to this project are welcome! | ||
|
||
Feel free to make an issue and a PR to improve this OSS. | ||
|
||
License | ||
======= | ||
|
||
MIT | ||
|
||
Authors | ||
======= | ||
|
||
- `Atsushi Sakai <https://github.com/AtsushiSakai/>`__ | ||
|
||
.. |Downloads| image:: https://pepy.tech/badge/pyroombaadapter | ||
:target: https://pepy.tech/project/pyroombaadapter | ||
.. |image1| image:: https://pepy.tech/badge/pyroombaadapter/month | ||
:target: https://pepy.tech/project/pyroombaadapter | ||
.. |image2| image:: https://pepy.tech/badge/pyroombaadapter/week | ||
:target: https://pepy.tech/project/pyroombaadapter | ||
.. |image3| image:: https://img.youtube.com/vi/rGppIKN-roE/0.jpg | ||
:target: https://www.youtube.com/watch?v=rGppIKN-roE | ||
.. |image4| image:: https://img.youtube.com/vi/0XqpQq7PQ8I/0.jpg | ||
:target: https://www.youtube.com/watch?v=0XqpQq7PQ8I | ||
.. |image5| image:: https://img.youtube.com/vi/nYstniMkJo0/0.jpg | ||
:target: https://www.youtube.com/watch?v=nYstniMkJo0 |
Oops, something went wrong.