Rename DSL: deviceSpec => deviceAttachmentSpec

This language is used broadly to specify how to attach (and thus
also how to detach) devices to/from Salmanoff. The next bit of work
we'll do is split off the DSL parsing from the management of the
list of parsed binary attached spec objects.

We'll be creating a PipeDeviceAttachmentParser, and later on when
we support URDF, we'll create a URDFDeviceAttachmentParser.
This commit is contained in:
2025-08-29 15:16:11 -04:00
parent 8f41e164a2
commit 6ef86eea05
10 changed files with 89 additions and 78 deletions
@@ -1,4 +1,4 @@
# Device manager: attaching sensors and actuators.
# Device Attachment Specification DSL: attaching sensors and actuators to SMO.
## Attaching sensors:
@@ -14,15 +14,17 @@ basically what conventional ML/LLM/ANN developers call an ROI ("Region of
Interest") extraction algorithm. An Implex algorithm is used to scan a frame
of input sensor data and detect objects and patterns within it.
## Sensor device spec:
## Sensor device attachment specification:
The general format of a device-spec for a sensor is:
The general format of a device attachment specification for a sensor is:
```
sensor-type|implexor|api(api-params)|provider(provider-params)|deviceselector
sensor-type|dev-identifier
|implexor|api(api-params)|provider(provider-params)|deviceselector
```
* `sensor-type` is always either '`+idev`' (interoceptor), '`+edev`'
(extrospector), or '`+adev`' (actuator).
* `dev-identifier` is a user-defined name for this specific device instance.
* `implexor` is the name of the implexor algorithm that should be used with
the data that is provided by the `provider` via the `api`.
* `api` is the interface that the provider uses to export perceptual data for
@@ -35,9 +37,9 @@ sensor-type|implexor|api(api-params)|provider(provider-params)|deviceselector
which case the parenthesis will be empty, but the parentheses must always be
written out.
* `device selector` is the idiosyncratic label/name used by the `provider` to
identify the specific device you want to access via that `provider`.
identify the specific device you want to attach via that `provider`.
## `API-params` and `provider-params` :
## `API-params` and `provider-params`:
If there's more than one parameter item in a list of `api-params` or
`provider-params`, then the individual items in a list of `api-param` or
@@ -55,7 +57,7 @@ Some examples follow:
### To attach a particular window from a window manager:
```
+edev|visual-implexor|wayland()|wayland(server-socket)|window0
+edev|my-window|visual-implexor|wayland()|wayland(server-socket)|window0
```
Connect to the Wayland server that's listening on `server-socket`, using the
`wayland` api. Ask that Wayland server to give salmanoff read-access to all of
@@ -64,7 +66,7 @@ the frames composited into the window buffer for `window0`. Use salmanoff's
### To attach a window manager's entire rendered desktop:
```
+edev|visual-implexor|wayland()|wayland(listen-socket)|all
+edev|my-desktop|visual-implexor|wayland()|wayland(listen-socket)|all
```
In most cases, this is basically the same as attempting to attach all of the
underlying GFX server's output.
@@ -76,7 +78,7 @@ that Wayland server's compositor data.
### To attach all of an Xorg server's gfx output to all screens:
```
+edev|visual-implexor|x11()|xorg(listen-socket)|all
+edev|my-xorg-display|visual-implexor|x11()|xorg(listen-socket)|all
```
Connect to the Xorg server that's listening on `listen-socket`, using the `x11`
@@ -93,7 +95,7 @@ WM's output.
### To attach all of an Xorg server's gfx output to a particular screen:
```
+edev|visual-implexor|x11()|xorg(listen-socket)|:0
+edev|my-screen|visual-implexor|x11()|xorg(listen-socket)|:0
```
Connect to the Xorg server that's listening on `listen-socket`, using the `x11`
api. Ask that Xorg server to let Salmanoff read out all of the frames written
@@ -106,7 +108,7 @@ out to display `:0`. Use salmanoff's `visual-implexor` to implex from display
### To attach a camera device by connecting directly to its Linux driver:
```
+edev|visual-implexor|v4l()|linux()|/dev/video0
+edev|my-camera|visual-implexor|v4l()|linux()|/dev/video0
```
We specify that we want to use the `linux` kernel's loaded driver to connect
to communicate with `/dev/video0`, via the `Video4Linux` API. We want salmanoff
@@ -116,7 +118,7 @@ If `/dev/video0` is already consumed by another process, this may likely fail.
### To attach a microphone that's managed by ALSA server:
```
+edev|audio-implexor|alsa(shmem)|alsa()|cardname
+edev|my-microphone|audio-implexor|alsa(shmem)|alsa()|cardname
```
Connect to the ALSA server via `shmem`, using the `alsa` API. Request access to
@@ -125,7 +127,7 @@ the microphone function of the sound card with the name `cardname`. Use the
### To attach a thermal sensor managed by Linux:
```
+idev|thermal-implexor|thermal-zone()|linux()|/sys/class/thermal_zone0
+idev|my-thermal|thermal-implexor|thermal-zone()|linux()|/sys/class/thermal_zone0
```
Use the `thermal-zone` SysFS API provided by `linux` to connect to the sensor
@@ -147,18 +149,20 @@ types of devices will require different wilzor algorithms. You need to know
what type of wilzor algorithm needs to be used to enable salmanoff to control
your actuator device.
The general format for an actuator's device spec is:
The general format for an actuator's device attachment specification is:
```
WIP: TBD.
```
## Device specification files:
## Device attachment specification files:
Inside of a device spec file, you can list any number of device specs.
Separate individual device specs with two consecutive h-bar characters (`||`),
Inside of a device attachment specification file, you can list any number of
device attachment specifications.
Separate individual device attachment specifications with two consecutive h-bar
characters (`||`),
like this:
```
+edev|visual-implexor|wayland()|wayland(server-socket)|window0
|| +edev|visual-implexor|x11()|xorg(listen-socket)|all
|| +idev|thermal-implexor|thermal-zone()|linux()|/sys/class/thermal_zone0
+edev|my-window|visual-implexor|wayland()|wayland(server-socket)|window0
|| +edev|my-xorg-display|visual-implexor|x11()|xorg(listen-socket)|all
|| +idev|my-thermal|thermal-implexor|thermal-zone()|linux()|/sys/class/thermal_zone0
```