Library for connecting hardware and software, like aconnect for anything.
Project description
r0b0
r0b0 is a communication library for connecting hardware and software.
Think of it like aconnect
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 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.
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.
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.
Setup
The package can be installed through PyPi with pip3 install r0b0-io
, but will be updated infrequently.
It is best to install from this source.
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 the pyproject.toml
.
This has been tested on python3.10.12
.
python3 -m venv venv
source venv/bin/activate
pip3 install .
Some gadgets like mouse and MIDI controllers require additional dependencies.
These can be installed with pip
, e.g. pip3 install requirements/mouse.txt
.
Example Rigs
I've used r0b0 to power not just Blossom, but also other non-robotic platforms.
I am currently (231223) refactoring the package to start rigs from scripts instead of config.yaml
s, in a more Pythonic / functional interface.
Examples will be stored in examples/
Blossom
Blossom-specific documentation is available here.
Leica MPi
The Leica 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 thePiCamera
's electronic shutter. - Using the
PiButton
's physical buttons to control thePiCamera
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 ofpygame
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 positionMouse
relative motion. - Mapping
PyGameJoystick
button presses toMouse
left/middle/right presses/releases/clicks.
Robot Death Star Lamp
Setup
Install
Clone this repo and pull the submodules
git clone https://github.com/psychomugs/r0b0
git submodule update --init --recursive
Environment setup
Set up conda, then set up a conda environment and install some other dependencies with pip
(because of issues with mouse
). Docker maybe coming soon (maybe).
conda env create r0b0 -f env.yaml
conda activate r0b0
pip3 install -r req.txt
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 Distributions
Built Distribution
File details
Details for the file blsm_io-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: blsm_io-0.0.0-py3-none-any.whl
- Upload date:
- Size: 62.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cd07528a2af1c911ec9a294607f1a52a62e772022bd3a17854a4959251b30b9 |
|
MD5 | bb5eebea71a74053f9aae8e799f373b6 |
|
BLAKE2b-256 | 1df2ae281498f15ef1e0bfc82d57dbe740d46f9200526f1b73a07df455667c2b |