Monty.SensorModules.SensorModule (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

A sensor module that is a pipeline of transforms rather than a class of its own.

Mirrors tbp/monty/sensor_modules/sensor_module.py::SensorModule, the shape Monty's newer sensor modules take: one step hands the raw observation to the first transform, each transform answers a changed payload, and the last one's percept is what the step reports. Nothing here knows what a patch is — a view finder whose pipeline is empty reports no percept at all, which is exactly what it should do.

The port's one sensor contract

Monty declares RuntimeSensorModule and ResettableSensorModule as Protocols, purely so a runtime can ask whether an object is one. The port has a single sensor behaviour instead (Monty.Frameworks.Models.AbstractMontyClasses.SensorModule) — a sensor module is something with update_state/2, step/4, reset/1 and the two proposal answers — so neither protocol becomes a module here (docs/monty-differences.md §2.13).

What it does not have

Monty gives the plain class no reset at all; only the experiment wrapper resets, and only its transforms. The port's behaviour requires every sensor to reset, so this one forgets what its payloads set (goals, region, telemetry) and leaves the transforms alone — the wrapper is what resets those.

Summary

Functions

A sensor module whose step is transforms, applied in the order given.

What this sensor's transforms have written down, as Monty reports it.

Types

t()

@type t() :: %Monty.SensorModules.SensorModule{
  agent_state: Monty.Frameworks.Models.MotorSystemState.AgentState.t() | nil,
  goals: [Monty.Cmp.Goal.t()],
  region: Monty.Cmp.AttentionRegion.t() | nil,
  sensor_id: atom() | String.t(),
  sensor_module_id: atom() | String.t(),
  sensor_state: term(),
  telemetry: map(),
  transforms: [transform()]
}

transform()

@type transform() :: {module(), struct()}

Functions

new(sensor_module_id, sensor_id, transforms)

@spec new(atom() | String.t(), atom() | String.t(), [transform()]) :: t()

A sensor module whose step is transforms, applied in the order given.

A transform is {module, transform}: the behaviour implementation and the config it was built from, because a config may configure the same class twice.

state_dict(sm)

@spec state_dict(t()) :: map()

What this sensor's transforms have written down, as Monty reports it.