Monty.Simulators.Port.Environment (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

A simulator process on the other side of this port.

The world Monty needs is Python — MuJoCo or Habitat — and it cannot run in the BEAM. This is the Elixir half of that boundary: it owns the operating-system process, sends it one request at a time, and answers the payloads Monty.Runtime.Step already expects (observations, proprioceptive_state). What the two say to each other is Monty.Simulators.Port.Protocol.

One request in flight at a time. A simulator advances its own state, so two steps cannot be interleaved, and a step that does not answer in time is an error rather than something to carry on past: a step that silently produced no observation would be counted as a step the model took.

Nothing here is a ported module — Monty's simulators are not part of the core — so it does not appear in the module map.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the simulator afresh, for the first step of an episode.

One step of the world: the actions the model chose, the observation it gets.

Closes the port: the simulator process is stopped with it.

Types

options()

@type options() :: [
  command: [String.t()],
  sensor_ids: [String.t()],
  timeout: timeout(),
  name: GenServer.name() | nil
]

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

reset(server)

@spec reset(GenServer.server()) :: {:ok, map()} | {:error, term()}

Starts the simulator afresh, for the first step of an episode.

Answers what the world said about that episode — the target it chose, when it chooses one — because a world that samples an object is the only one that knows which.

start_link(options)

@spec start_link(options()) :: GenServer.on_start()

step(server, actions)

@spec step(GenServer.server(), [Monty.Frameworks.Actions.Action.t()]) ::
  {:ok, map(), map()} | {:error, term()}

One step of the world: the actions the model chose, the observation it gets.

stop(server)

@spec stop(GenServer.server()) :: :ok

Closes the port: the simulator process is stopped with it.