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

AdapterPortWhat it does
io.ScreenvisualCoarse full-screen map plus a foveal window around a point, resampled onto the hexagonal photoreceptor grid.
io.Camera, io.FramesvisualVideo frames onto the compound eye, with optional motion pre-emphasis.
io.Microphone, io.AudiomechanosensoryAudio onto the Johnston's organ afferents (antennae), 16 kHz mono.
io.EmbeddingolfactoryAny vector, up to 2,282 dimensions, from a co-processor: tokens, instructions, seed points.
io.BodyStateascendingProprioception: cursor position, controller state, joint encoders.
io.IMUmechanosensoryAccelerometer and gyro as mechanosensory input.

Standard output adapters

AdapterPortWhat it does
io.Mousedescendingdx, dy and three button states at 100 Hz.
io.KeyboarddescendingKey down and key up events with timing.
io.GamepaddescendingTwo sticks, triggers and buttons.
io.Motorsdescending, motorTorque or position targets per joint, up to 1 kHz.
io.Readoutcentral, opticA 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.

Python
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.

Python
intent = flycore.load("flylabs/intent")
cursor = flycore.load("flylabs/cursor", coprocessors=[intent])
cursor.do("click Save")