agent_sensor behaviour (macula_neuroevolution v0.28.0)

View Source

See also: agent_actuator, agent_bridge, agent_definition.

Summary

Types

Agent-specific state containing position, energy, etc. Structure is domain-defined.

Environment state containing world information. Structure is domain-defined.

Number of neural network input nodes this sensor provides. Must be positive (at least 1 input).

Unique identifier for the sensor type within an agent. Examples: <<"vision">>, <<"hearing">>, <<"energy">>.

List of sensor readings, length must match input_count/0. Values should be normalized to [0.0, 1.0] range.

Types

agent_state/0

-type agent_state() :: map().

Agent-specific state containing position, energy, etc. Structure is domain-defined.

env_state/0

-type env_state() :: map().

Environment state containing world information. Structure is domain-defined.

input_count/0

-type input_count() :: pos_integer().

Number of neural network input nodes this sensor provides. Must be positive (at least 1 input).

sensor_name/0

-type sensor_name() :: binary().

Unique identifier for the sensor type within an agent. Examples: <<"vision">>, <<"hearing">>, <<"energy">>.

sensor_values/0

-type sensor_values() :: [float()].

List of sensor readings, length must match input_count/0. Values should be normalized to [0.0, 1.0] range.

Callbacks

input_count/0

-callback input_count() -> input_count().

name/0

-callback name() -> sensor_name().

read/2

-callback read(AgentState, EnvState) -> sensor_values()
                  when AgentState :: agent_state(), EnvState :: env_state().

Functions

get_info(Module)

-spec get_info(Module) -> {ok, Info} | {error, Reason}
                  when
                      Module :: module(),
                      Info :: #{name := sensor_name(), input_count := input_count()},
                      Reason :: term().

validate(Module)

-spec validate(Module) -> ok | {error, [Reason]} when Module :: module(), Reason :: term().

validate_values(Module, Values)

-spec validate_values(Module, Values) -> ok | {error, Reason}
                         when Module :: module(), Values :: sensor_values(), Reason :: term().