Package: r0b0-io
r0b0r0b0 is a communication system for connecting human interface device (HID) hardware and system software.
Think of it likeaconnectfor things beyond MIDI devices.
The system is my general-purpose tool for quickly prototyping mechatronic systems with a bend towards creative applications.Design rationaler0b0 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.StructureExampleRigconfiguration.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.GadgetsGadgets 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 arehere.CablesCables are connections that translate between Gadgets.
For example, amidi2motorCable 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 arehere.RigsRigs 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 RigsI've used r0b0 to power not just Blossom, but also other non-robotic platforms.BlossomBlossom-specific documentation is availablehere.Leica MPiTheLeica MPiis 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:APiButtonGadget 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.APiCameraGadget for the camera module.Cables between the Gadgets handle:Using the flash sync socket as aPiButtonto begin an exposure with thePiCamera's electronic shutter.Using thePiButton's physical buttons to control thePiCamerasettings, e.g. shutter speed.Joystick-controlled mouseI 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:APyGameJoystickGadget to handle events from the physical joystick. On a technical note, the use ofpygamealters the behavior of the Rig's event loop, which (is/will be) explained in the Rig's README.AMouseGadget to control the software mouse, including motion and button press/release/click.Cables between the Gadgets handle:MappingPyGameJoystickabsolute positionMouserelative motion.MappingPyGameJoystickbutton presses toMouseleft/middle/right presses/releases/clicks.Robot Death Star LampAmotorized IKEA PS2014 lamp.SetupInstallClone this repo and pull the submodulesgit clone https://github.com/psychomugs/r0b0
cd r0b0
git submodule update --init --recursiveEnvironment setupCreate a Python virtual environment (venv) and install fromrequirements/requirements.txt.
This has been tested onpython3.10.12.python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements/requirements.txtIf you run into errors, you may not be onpython3.10.
In that case, change thevenvinitialization frompython3->python3.10.python3.10 -m venv venvThis will install the base dependencies.
To avoid clogging thevenv, specific dependencies for specific gadgets are broken out into separate files inrequirements/.
For example, to install the dependencies for theMousegadget:pip3 install -r requirements/mouse.txtPeruserequirements/for other gadget dependencies to install.Set upconda, then set up a conda environment and install some other dependencies withpip(because of issues withmouse). Docker maybe coming soon (maybe).It's best to just use avenv— keeping this here for backup.conda env create r0b0 -f env.yaml
conda activate r0b0
pip3 install -r req.txt