tbp.monty.sensor_modules#
tbp.monty.sensor_modules.sensor_module#
- class Payload(observation: SensorObservation, percept: Message | None, goals: list[Goal], region: AttentionRegion | None, telemetry: dict[str, Any]) None[source]#
Bases:
object- __init__(observation: SensorObservation, percept: Message | None, goals: list[Goal], region: AttentionRegion | None, telemetry: dict[str, Any]) None#
- goals: list[Goal]#
- observation: SensorObservation#
- percept: Message | None#
- region: AttentionRegion | None#
- telemetry: dict[str, Any]#
- class RuntimeSensorModule(*args, **kwargs)[source]#
Bases:
ProtocolMonty runtime interface to a Sensor Module.
- __init__(*args, **kwargs)#
- propose_goals() Collection[Goal][source]#
Return the goals proposed by this Sensor Module.
- Return type:
- Returns:
A collection of proposed Goals.
- propose_region() AttentionRegion[source]#
Return the region proposed by this Sensor Module.
- Return type:
- Returns:
An AttentionRegion.
- step(ctx: RuntimeContext, observation: SensorObservation, motor_only_step: bool = False) Message | None[source]#
Execute a time-step for the Sensor Module.
- Parameters:
ctx (RuntimeContext) – The runtime context.
observation (SensorObservation) – Sensor observation.
motor_only_step (bool) – Whether the current step is a motor-only step.
- Return type:
Message | None
- Returns:
An optional percept with features and morphological features.
- update_state(agent: AgentState) None[source]#
Update the proprioceptive state for this Sensor Module.
- Parameters:
agent (
AgentState) – The proprioceptive state of this sensor module’s Agent.- Return type:
- class SensorModule(sensor_module_id: str, sensor_id: SensorID, transforms: Sequence[tbp.monty.sensor_modules.sensor_module.Transform][Sequence[Transform]]) None[source]#
Bases:
RuntimeSensorModule,SnapshotableA sensor module implemented as a pipeline of configurable transforms.
This sensor module does not implement a specific observation processing itself. Instead, it is a generic mechanism for processing a
SensorObservationthrough a configurable sequence of transforms to produce sensor module outputs.- __init__(sensor_module_id: str, sensor_id: SensorID, transforms: Sequence[tbp.monty.sensor_modules.sensor_module.Transform][Sequence[Transform]]) None[source]#
Initialize the sensor module.
- Parameters:
sensor_module_id (
str) – The unique identifier for this sensor module.sensor_id (
NewType()(SensorID,str)) – The unique identifier for the sensor associated with this module.transforms (
Sequence[Sequence[Transform]]) – A sequence of transforms to process thePayloadcontaining the sensor observation and produce sensor module outputs.
- load_state_dict(memento: Mapping[str, Any]) None[source]#
Load the internal object state from a previously snapshot memento.
- propose_goals() Collection[Goal][source]#
Return the goals proposed by this Sensor Module.
- Return type:
- Returns:
A collection of proposed Goals.
- propose_region() AttentionRegion[source]#
Return the region proposed by this Sensor Module.
- Return type:
- Returns:
An AttentionRegion.
- state_dict() Mapping[str, Any][source]#
Snapshot a memento representing the internal state of this object.
- step(ctx: RuntimeContext, observation: SensorObservation, motor_only_step: bool = False) Message | None[source]#
Execute a time-step for the Sensor Module.
- Parameters:
ctx (RuntimeContext) – The runtime context.
observation (SensorObservation) – Sensor observation.
motor_only_step (bool) – Whether the current step is a motor-only step.
- Return type:
Message | None
- Returns:
An optional percept with features and morphological features.
- update_state(agent: AgentState) None[source]#
Update the proprioceptive state for this Sensor Module.
- Parameters:
agent (
AgentState) – The proprioceptive state of this sensor module’s Agent.- Return type:
- class Transform(*args, **kwargs)[source]#
Bases:
ProtocolA transform that can be applied to a payload.
- __init__(*args, **kwargs)#
- class TransformContext(rng: numpy.random.RandomState, agent_state: AgentState, sensor_state: SensorState, motor_only_step: bool = False, suppress_runtime_errors: bool = False) None[source]#
Bases:
object- __init__(rng: numpy.random.RandomState, agent_state: AgentState, sensor_state: SensorState, motor_only_step: bool = False, suppress_runtime_errors: bool = False) None#
-
agent_state:
AgentState#
-
rng:
RandomState#
-
sensor_state:
SensorState#