tbp.monty.frameworks.models.salience#
tbp.monty.frameworks.models.salience.motor_policy#
- exception GoalCollocatedWithSensor[source]#
Bases:
RuntimeErrorRaised when a goal is collocated with a sensor.
- class LookAtGoal(agent_id: AgentID, sensor_id: SensorID) None[source]#
Bases:
MotorPolicyA policy that looks at a target.
This class assumes a system similar to a 2-DOF gimbal in which the “outer” part can yaw left/right about the y-axis and the “inner” part can pitch up/down about the x-axis. This setup is typical of our distant agent in which the agent turns left/right and sensor mounted to it looks up/down.
Note that this code only uses TurnLeft and LookUp. Turning right or looking down are performed using negative degrees with TurnLeft and LookUp, respectively.
- load_state_dict(memento: Mapping[str, Any]) None[source]#
Load the internal object state from a previously snapshot memento.
- reset(motor_system: ExperimentMotorSystem) None[source]#
Reset the internal state of this Motor Policy.
- Parameters:
motor_system (
ExperimentMotorSystem) – The associated Motor System.- Return type:
tbp.monty.frameworks.models.salience.on_object_observation#
- class OnObjectObservation(center_location: np.ndarray | None, locations: np.ndarray, salience: np.ndarray) None[source]#
Bases:
object- center_location: np.ndarray | None#
- locations: np.ndarray#
- salience: np.ndarray#
- on_object_observation(observation: SensorObservation, salience_map: numpy.ndarray) OnObjectObservation[source]#
Convert all raw observation data into image format.
This function reformats the arrays in a raw observations dictionary so that they’re all indexable by image row and column indices. It also splits the semantic_3d array into 3D locations and an on-object/surface indicator array.
- Parameters:
observation (
SensorObservation) – A sensor observation.salience_map (
ndarray) – A salience map.
- Return type:
- Returns:
The grid/matrix formatted (unraveled) on-object salience and location data, along with the location corresponding to the central pixel.
tbp.monty.frameworks.models.salience.return_inhibitor#
- class DecayField(kernel_factory: DecayKernelFactory | None = None)[source]#
Bases:
objectManages a collection of decay kernels.
- __init__(kernel_factory: DecayKernelFactory | None = None)[source]#
- add(location: numpy.ndarray) None[source]#
Add a kernel to the field.
- Return type:
- compute_weights(points: numpy.ndarray) numpy.ndarray[source]#
- Return type:
- class DecayKernel(location: np.ndarray, tau_t: float = 10.0, tau_s: float = 0.01, spatial_cutoff: float | None = 0.02, w_t_min: float = 0.1)[source]#
Bases:
objectDecay kernel represents a previously visited location.
Returns the product of time- and space-dependent exponentials.
- __init__(location: np.ndarray, tau_t: float = 10.0, tau_s: float = 0.01, spatial_cutoff: float | None = 0.02, w_t_min: float = 0.1)[source]#
- step() bool[source]#
Increment the step counter, and check if the kernel is expired.
- Return type:
- Returns:
True if the kernel is expired, False otherwise.
- w_s(points: numpy.ndarray) numpy.ndarray[source]#
Compute the distance-dependent weight.
The weight is computed as exp(-z / lam), where z is the distance between the kernel’s center and the given point(s), and lam is equal to tau_s / log(2).