-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f4a74d1
Showing
292 changed files
with
178,248 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,173 @@ | ||
venv* | ||
*.pyc | ||
.vscode | ||
*.DS | ||
*.pem | ||
ngrok.sh | ||
tapes/* | ||
!tapes/blsm_* | ||
*notes.md | ||
|
||
# speech recognition models | ||
vosk* | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/#use-with-ide | ||
.pdm.toml | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
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,3 @@ | ||
[submodule "deps/dynamixel_python"] | ||
path = deps/dynamixel_python | ||
url = https://github.com/psychomugs/dynamixel_python |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Michael Suguitan | ||
|
||
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. |
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,112 @@ | ||
# `r0b0` | ||
|
||
r0b0 is a communication system for connecting human interface device (HID) hardware and system software. | ||
Think of it like [`aconnect`](https://man.archlinux.org/man/aconnect.1.en) for things beyond MIDI devices. | ||
The system is my general-purpose tool for quickly prototyping mechatronic systems with a bend towards creative applications. | ||
|
||
## Design rationale | ||
r0b0 started as a refactor of the control software for Blossom, the open-source robot platform that I developed during my PhD. | ||
Other existing robot-/mechatronic-oriented communication frameworks are very heavy and geared towards technical applications. | ||
r0b0 | ||
Some design goals: | ||
- Parity with Blossom's functionality by the last subproject of my PhD: remote motion-based telepresence. | ||
- Portability: like Blossom's codebase which ran identically on any UNIX-based system, r0b0 should be easy to set up and run whether on a macOS laptop or Raspberry Pi. | ||
- Extensibility and modularity: the structure is based on devices (Gadgets) that communicate among each other through messaging functions (Cables) in networked groups (Rigs). Components should be ignorant of each other to enable ease of modification. | ||
|
||
## Structure | ||
|
||
![Example structure of the r0b0 framework](docs/assets/r0b0.png) | ||
*Example `Rig` configuration.* | ||
|
||
This section provides a brief overview of the structure. | ||
More technical and implementation information is available on the respective READMEs in each module. | ||
|
||
The main structural metaphor comes from connecting musical instruments, either through MIDI cables or direct audio inputs and outputs. | ||
|
||
|
||
### Gadgets | ||
Gadgets are individual hardware devices or software services, e.g. motors and joysticks (hardware), emulated mice and key presses (software). | ||
Gadgets can exist as standalone objects, e.g. a single motor controlled manually through the command line. | ||
Gadgets also exist as nodes in a network of other Gadgets, transmitting and receiving messages through Cables. | ||
Gadget docs are [here](/r0b0/gadgets/README.md). | ||
|
||
### Cables | ||
Cables are connections that translate between Gadgets. | ||
For example, a `midi2motor` Cable could translate incoming MIDI messages from the turning of a MIDI controller knob into the outgoing motor position message to the actuation of a robot's motor. | ||
Cables are small, lightweight functions that abstract Gadgets from each other, preserving the system's modularity. | ||
Defining Cables is where most domain knowledge/personal taste comes in. | ||
Cable docs are [here](/r0b0/cables//README.md). | ||
|
||
### Rigs | ||
Rigs are networks of Gadgets connected by Cables; they essentially represent the entire system/project. | ||
Rigs manage the connections and higher-level functionalities required to use the system. | ||
Rigs are largely static wrappers that should not need much modification on a case-by-case basis. | ||
|
||
|
||
## Example Rigs | ||
I've used r0b0 to power not just Blossom, but also other non-robotic platforms. | ||
|
||
### Blossom | ||
Blossom-specific documentation is available [here](/docs/blsm.md). | ||
|
||
### Leica MPi | ||
The [Leica MPi](https://psychomugs.github.io/mpi) is a Raspberry Pi-powered digital back for my Leica M2 film camera. | ||
The hardware includes a Raspberry Pi Zero as the main board, the Raspberry Pi HQ Camera Module as the digital sensor, and an LCD module with buttons as an interface. | ||
This Rig uses two Gadgets: | ||
- A `PiButton` Gadget for the buttons on the LCD module and the shutter sync cable. The sync cable connects the flash sync socket to a GPIO pin on the Pi; pressing the mechanical shutter closes the flash sync socket as if it were a physical button. | ||
- A `PiCamera` Gadget for the camera module. | ||
|
||
Cables between the Gadgets handle: | ||
- Using the flash sync socket as a `PiButton` to begin an exposure with the `PiCamera`'s electronic shutter. | ||
- Using the `PiButton`'s physical buttons to control the `PiCamera` settings, e.g. shutter speed. | ||
|
||
### Joystick-controlled mouse | ||
I was born too early to actualize my true calling as a giant robot pilot. | ||
Controlling my computer's mouse with a consumer-grade gaming joystick is a close simulation. | ||
This Rig uses two Gadgets: | ||
- A `PyGameJoystick` Gadget to handle events from the physical joystick. On a technical note, the use of `pygame` alters the behavior of the Rig's event loop, which (is/will be) explained in the Rig's README. | ||
- A `Mouse` Gadget to control the software mouse, including motion and button press/release/click. | ||
|
||
Cables between the Gadgets handle: | ||
- Mapping `PyGameJoystick` absolute position `Mouse` relative motion. | ||
- Mapping `PyGameJoystick` button presses to `Mouse` left/middle/right presses/releases/clicks. | ||
|
||
### Robot Death Star Lamp | ||
A [motorized IKEA PS2014 lamp](https://psychomugs.github.io/ps2014). | ||
|
||
## Setup | ||
### Install | ||
Clone this repo and pull the submodules | ||
``` | ||
git clone https://github.com/psychomugs/r0b0 | ||
cd r0b0 | ||
git submodule update --init --recursive | ||
``` | ||
|
||
### Environment setup | ||
Create a Python virtual environment (`venv`) and install from `requirements/requirements.txt`. | ||
This has been tested on `python3.10.12`. | ||
``` | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip3 install -r requirements/requirements.txt | ||
``` | ||
If you run into errors, you may not be on `python3.10`. | ||
In that case, change the `venv` initialization from `python3` -> `python3.10`. | ||
``` | ||
python3.10 -m venv venv | ||
``` | ||
This will install the base dependencies. | ||
To avoid clogging the `venv`, specific dependencies for specific gadgets are broken out into separate files in `requirements/`. | ||
For example, to install the dependencies for the `Mouse` gadget: | ||
``` | ||
pip3 install -r requirements/mouse.txt | ||
``` | ||
Peruse `requirements/` for other gadget dependencies to install. | ||
|
||
~~Set up [conda](https://conda.io), then set up a conda environment and install some other dependencies with `pip` (because of issues with [`mouse`](https://github.com/boppreh/mouse/issues/75)). Docker maybe coming soon (maybe).~~ It's best to just use a `venv` — keeping this here for backup. | ||
``` | ||
conda env create r0b0 -f env.yaml | ||
conda activate r0b0 | ||
pip3 install -r req.txt | ||
``` |
Empty file.
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,35 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = 'r0b0' | ||
copyright = '2023, Michael Suguitan' | ||
author = 'Michael Suguitan' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
# 'sphinx.ext.duration', | ||
# 'sphinx.ext.doctest', | ||
'sphinx.ext.autodoc', | ||
] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
import os | ||
import sys | ||
# Will point to the top level of the project | ||
sys.path.insert(0,os.path.abspath('../')) | ||
# sys.path.insert('./r0b0/gadgets') | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "sphinx_rtd_theme" | ||
html_static_path = ['_static'] |
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,29 @@ | ||
type: ArduinoRobot | ||
usb_port: /dev/cu.usbserial-ADAQDbKpQ | ||
baud_rate: 115200 | ||
timeout: 2 | ||
motors: # use these same names as kwargs to constructors | ||
- name: base | ||
id: 9 | ||
position: | ||
reset: 0 | ||
min: -40 | ||
max: 140 | ||
- name: tower_1 | ||
id: 5 | ||
position: | ||
reset: 0 | ||
min: -40 | ||
max: 140 | ||
- name: tower_2 | ||
id: 6 | ||
position: | ||
reset: 0 | ||
min: -40 | ||
max: 140 | ||
- name: tower_3 | ||
id: 10 | ||
position: | ||
reset: 0 | ||
min: -40 | ||
max: 140 |
Oops, something went wrong.