domain_sensors behaviour (faber_neuroevolution v1.2.4)

View Source

Domain Sensor Provider behaviour.

Domains implement this behaviour to declare what sensors they provide and how to read sensor values from the domain state.

Example Implementation

A domain bridge module implementing this behaviour:

-module(my_domain_bridge). -behaviour(domain_sensors).

sensor_spec() -> [#{name => vision_food, dimension => 8, range => {0.0, 1.0}, level => l0, category => ecological, description => "Distance to food in 8 directions"}].

read_sensors(DomainState) -> #{vision_food => calculate_vision(DomainState)}.

Summary

Types

sensor_definition/0

-type sensor_definition() ::
          #{name := atom(),
            dimension := pos_integer(),
            range := {Min :: float(), Max :: float()},
            level := l0 | l1 | l2,
            category := atom(),
            description := binary()}.

sensor_readings/0

-type sensor_readings() :: #{atom() => [float()]}.

Callbacks

read_sensors/1

-callback read_sensors(DomainState :: term()) -> sensor_readings().

sensor_spec/0

-callback sensor_spec() -> [sensor_definition()].