Bardo.AgentManager.Sensor behaviour (Bardo v0.1.0)

View Source

Defines generic sensor behavior.

A sensor is a process that takes input from the environment, converts it into a signal, and then forwards this signal to the cortex neurons to which it is connected.

Summary

Callbacks

Callback to initialize the sensor module state.

Callback to process percept data and generate output signals.

Callback to sense input from the environment.

Optional callback for cleanup when terminating.

Functions

Initializes the sensor process.

Sends a perception from the environment to the sensor.

Spawns a Sensor process belonging to the exoself process that spawned it and calls init to initialize.

Terminates the sensor.

Syncs the sensor with the cortex.

Callbacks

init(list)

@callback init(list()) :: {:ok, any()}

Callback to initialize the sensor module state.

percept(atom, {})

@callback percept(
  atom(),
  {percept :: [float()], agent_id :: tuple(), vl :: non_neg_integer(),
   params :: any(), mod_state :: any()}
) :: {[float()], any()}

Callback to process percept data and generate output signals.

sense(atom, {})

@callback sense(
  atom(),
  {agent_id :: tuple(), percept :: [float()], params :: any(),
   vl :: non_neg_integer(), sensor :: pid() | tuple(), op_mode :: atom(),
   mod_state :: any()}
) :: any()

Callback to sense input from the environment.

terminate(reason, mod_state)

(optional)
@callback terminate(reason :: atom(), mod_state :: any()) :: :ok

Optional callback for cleanup when terminating.

Functions

init(exoself_pid)

@spec init(pid()) :: no_return()

Initializes the sensor process.

init_phase2(pid, exoself_pid, id, agent_id, fanout_pids, cx_pid, scape, s_name, vl, params, op_mode)

@spec init_phase2(
  pid(),
  pid(),
  tuple(),
  tuple(),
  [pid()],
  pid(),
  pid(),
  {atom(), atom()},
  integer(),
  any(),
  atom()
) :: :ok

Initializes the sensor setting it to its initial state.

percept(sensor_pid, percept)

@spec percept(pid(), [float()]) :: :ok

Sends a perception from the environment to the sensor.

For use in tests and simulations.

start(node, exoself_pid)

@spec start(node(), pid()) :: pid()

Spawns a Sensor process belonging to the exoself process that spawned it and calls init to initialize.

stop(pid, exoself_pid)

@spec stop(pid(), pid()) :: :ok

Terminates the sensor.

sync(sensor_pid, cx_pid)

@spec sync(pid(), pid()) :: :ok

Syncs the sensor with the cortex.