Adapters
Adapters are the contract between your signals and the brain. An input adapter writes onto an afferent port; an output adapter reads an efferent port or a decoder on the intrinsic population. Standard adapters ship with the engine; custom adapters are yours.
Standard input adapters
| Adapter | Port | What it does |
|---|---|---|
io.Screen | visual | Coarse full-screen map plus a foveal window around a point, resampled onto the hexagonal photoreceptor grid. |
io.Camera, io.Frames | visual | Video frames onto the compound eye, with optional motion pre-emphasis. |
io.Microphone, io.Audio | mechanosensory | Audio onto the Johnston's organ afferents (antennae), 16 kHz mono. |
io.Embedding | olfactory | Any vector, up to 2,282 dimensions, from a co-processor: tokens, instructions, seed points. |
io.BodyState | ascending | Proprioception: cursor position, controller state, joint encoders. |
io.IMU | mechanosensory | Accelerometer and gyro as mechanosensory input. |
Standard output adapters
| Adapter | Port | What it does |
|---|---|---|
io.Mouse | descending | dx, dy and three button states at 100 Hz. |
io.Keyboard | descending | Key down and key up events with timing. |
io.Gamepad | descending | Two sticks, triggers and buttons. |
io.Motors | descending, motor | Torque or position targets per joint, up to 1 kHz. |
io.Readout | central, optic | A small trained decoder on the intrinsic population: boxes, events, segments. |
Custom adapters
A custom adapter is a small module with an encode or decode method and a declared port. The engine checks the port size at load time and trains the adapter together with the weights.
import flycore, torch
class Lidar(flycore.InputAdapter):
port = "visual" # 11,390 afferents
def encode(self, scan: torch.Tensor) -> torch.Tensor:
# scan: (N, 2) ranges and angles -> (11390,) activations
return self.hex_project(scan)
brain = flycore.load("flylabs/servo", adapters={"lidar": Lidar()})Co-processors
A co-processor is a classical network that runs before or beside the brain and feeds it through an adapter, almost always the embedding port. Intent (a vision-language model), the speech recogniser in Dictate and the CNN classifier in Gaze are co-processors. They are ordinary PyTorch modules; you can replace them.
intent = flycore.load("flylabs/intent")
cursor = flycore.load("flylabs/cursor", coprocessors=[intent])
cursor.do("click Save")