POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models package

Catalog of per-channel CARLA observation models, registered for user selection.

Each observation channel has its own module of concrete CarlaObservationModel implementations (gnss_models, agent_models, and the image_models / lidar_models placeholders for future modalities). Importing a channel module runs its @register_observation_model decorators, so a planner environment can resolve a per-channel selection like {"gnss": "gaussian", "agents": "factored"} into instances via build_observation_model().

To add a modality: create/extend its <channel>_models.py, register the class, and import it here so registration runs on import.

Functions:

register_observation_model: Decorator registering a factory under (channel, name). build_observation_model: Instantiate the model registered under (channel, name). available_observation_models: List the names registered for a channel.

Classes:

GnssObservationModel: Additive-Gaussian-noise GNSS reading with a matching density. FactoredAgentObservationModel: Per-slot detection + occlusion gating + Gaussian pose noise.

class POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.FactoredAgentObservationModel(max_tracked_agents=5, perception_range=50.0, occlusion_radius=1.5, pose_std=0.5, detect_prob=0.95)[source]

Bases: CarlaObservationModel

Reference agent perception: per-slot detection gating plus additive Gaussian pose noise.

Each agent slot is detected only when in perception range and not geometrically occluded by another agent on the ego->target sight line; a detected agent’s pose is corrupted with additive Gaussian noise. Provides both a sampler and a matching density, so it can back a scoring generative model.

Parameters:
  • max_tracked_agents (int)

  • perception_range (float | None)

  • occlusion_radius (float)

  • pose_std (float)

  • detect_prob (float)

max_tracked_agents

Number of fixed agent slots in the agents block.

perception_range

Metres beyond which an agent is undetectable (None disables the range gate).

occlusion_radius

Sight-line blocking radius among agents.

pose_std

Std of Gaussian noise on a detected agent’s pose measurement.

detect_prob

Probability of detecting a visible agent; 1 - detect_prob is the miss rate scored by the density.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> model = FactoredAgentObservationModel(max_tracked_agents=1, perception_range=50.0)
>>> agents = np.array([1.0, 10.0, 0.0, 0.0, 0.0])
>>> float(model.perceive(agents)[0])  # near agent detected
1.0
channel: str = 'agents'
log_probability(clean_channel, channel_observation)[source]

Log-density of channel_observation given the clean channel value.

Parameters:
  • clean_channel (Any) – The noise-free value of this channel built from a state.

  • channel_observation (Any) – The channel value whose likelihood is scored.

Return type:

float

Returns:

The channel’s observation log-probability.

Raises:

NotImplementedError – If this is a sample-only channel without a density.

perceive(clean_channel)[source]

Sample this channel’s perceived value from its clean, fully-detected value.

Parameters:

clean_channel (Any) – The noise-free value of this channel, built from a state or taken from the world’s raw reading.

Return type:

ndarray

Returns:

The perceived value of the same channel.

render(clean_channel, noisy)[source]

Gate the clean agent block per slot, optionally adding Gaussian pose noise.

Parameters:
  • clean_channel (Any) – The noise-free flat agents block.

  • noisy (bool) – When True, add pose Gaussian noise (the sampler path); when False, return the gated but noise-free block.

Return type:

ndarray

Returns:

The perceived flat agents block.

supports_density: bool = True
class POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.GnssObservationModel(gnss_std=1e-05)[source]

Bases: CarlaObservationModel

GNSS channel corrupted by additive Gaussian noise, with a matching density.

Parameters:

gnss_std (float)

gnss_std

Std of the zero-mean Gaussian noise added to the 2-D gnss reading.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> model = GnssObservationModel(gnss_std=1e-5)
>>> perceived = model.perceive(np.zeros(2))
>>> perceived.shape
(2,)
channel: str = 'gnss'
log_probability(clean_channel, channel_observation)[source]

Log-density of channel_observation given the clean channel value.

Parameters:
  • clean_channel (Any) – The noise-free value of this channel built from a state.

  • channel_observation (Any) – The channel value whose likelihood is scored.

Return type:

float

Returns:

The channel’s observation log-probability.

Raises:

NotImplementedError – If this is a sample-only channel without a density.

perceive(clean_channel)[source]

Sample this channel’s perceived value from its clean, fully-detected value.

Parameters:

clean_channel (Any) – The noise-free value of this channel, built from a state or taken from the world’s raw reading.

Return type:

ndarray

Returns:

The perceived value of the same channel.

supports_density: bool = True
POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.available_observation_models(channel)[source]

Return the catalog names registered for channel, sorted.

Return type:

List[str]

Parameters:

channel (str)

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.build_observation_model(channel, name, **kwargs)[source]

Instantiate the observation model registered under (channel, name).

Parameters:
  • channel (str) – The observation-dict key to resolve the model for.

  • name (str) – The registered catalog name within that channel.

  • **kwargs (Any) – Forwarded to the registered factory.

Return type:

CarlaObservationModel

Returns:

The instantiated per-channel observation model.

Raises:

KeyError – If no model is registered under (channel, name).

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.register_observation_model(channel, name)[source]

Register an observation-model factory under (channel, name) for user selection.

Parameters:
  • channel (str) – The observation-dict key the model handles (e.g. "gnss", "agents").

  • name (str) – The catalog name the user selects the model by within that channel.

Return type:

Callable[[TypeVar(_FactoryT, bound= Callable[..., CarlaObservationModel])], TypeVar(_FactoryT, bound= Callable[..., CarlaObservationModel])]

Returns:

A decorator that registers the factory (a class or callable returning a CarlaObservationModel) and returns it unchanged (its type is preserved).

Submodules

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.agent_models module

Agent-channel observation models.

Catalog of per-channel models for the agents observation channel (the fixed agent-slot block). Add new agent-perception models here and register them with register_observation_model() so they can be selected by name.

Classes:

FactoredAgentObservationModel: Per-slot detection + occlusion gating + Gaussian pose noise.

class POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.agent_models.FactoredAgentObservationModel(max_tracked_agents=5, perception_range=50.0, occlusion_radius=1.5, pose_std=0.5, detect_prob=0.95)[source]

Bases: CarlaObservationModel

Reference agent perception: per-slot detection gating plus additive Gaussian pose noise.

Each agent slot is detected only when in perception range and not geometrically occluded by another agent on the ego->target sight line; a detected agent’s pose is corrupted with additive Gaussian noise. Provides both a sampler and a matching density, so it can back a scoring generative model.

Parameters:
  • max_tracked_agents (int)

  • perception_range (float | None)

  • occlusion_radius (float)

  • pose_std (float)

  • detect_prob (float)

max_tracked_agents

Number of fixed agent slots in the agents block.

perception_range

Metres beyond which an agent is undetectable (None disables the range gate).

occlusion_radius

Sight-line blocking radius among agents.

pose_std

Std of Gaussian noise on a detected agent’s pose measurement.

detect_prob

Probability of detecting a visible agent; 1 - detect_prob is the miss rate scored by the density.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> model = FactoredAgentObservationModel(max_tracked_agents=1, perception_range=50.0)
>>> agents = np.array([1.0, 10.0, 0.0, 0.0, 0.0])
>>> float(model.perceive(agents)[0])  # near agent detected
1.0
channel: str = 'agents'
log_probability(clean_channel, channel_observation)[source]

Log-density of channel_observation given the clean channel value.

Parameters:
  • clean_channel (Any) – The noise-free value of this channel built from a state.

  • channel_observation (Any) – The channel value whose likelihood is scored.

Return type:

float

Returns:

The channel’s observation log-probability.

Raises:

NotImplementedError – If this is a sample-only channel without a density.

perceive(clean_channel)[source]

Sample this channel’s perceived value from its clean, fully-detected value.

Parameters:

clean_channel (Any) – The noise-free value of this channel, built from a state or taken from the world’s raw reading.

Return type:

ndarray

Returns:

The perceived value of the same channel.

render(clean_channel, noisy)[source]

Gate the clean agent block per slot, optionally adding Gaussian pose noise.

Parameters:
  • clean_channel (Any) – The noise-free flat agents block.

  • noisy (bool) – When True, add pose Gaussian noise (the sampler path); when False, return the gated but noise-free block.

Return type:

ndarray

Returns:

The perceived flat agents block.

supports_density: bool = True

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.gnss_models module

GNSS-channel observation models.

Catalog of per-channel models for the gnss observation channel. Add new GNSS models here and register them with register_observation_model() so they can be selected by name.

Classes:

GnssObservationModel: Additive-Gaussian-noise GNSS reading with a matching density.

class POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.gnss_models.GnssObservationModel(gnss_std=1e-05)[source]

Bases: CarlaObservationModel

GNSS channel corrupted by additive Gaussian noise, with a matching density.

Parameters:

gnss_std (float)

gnss_std

Std of the zero-mean Gaussian noise added to the 2-D gnss reading.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> model = GnssObservationModel(gnss_std=1e-5)
>>> perceived = model.perceive(np.zeros(2))
>>> perceived.shape
(2,)
channel: str = 'gnss'
log_probability(clean_channel, channel_observation)[source]

Log-density of channel_observation given the clean channel value.

Parameters:
  • clean_channel (Any) – The noise-free value of this channel built from a state.

  • channel_observation (Any) – The channel value whose likelihood is scored.

Return type:

float

Returns:

The channel’s observation log-probability.

Raises:

NotImplementedError – If this is a sample-only channel without a density.

perceive(clean_channel)[source]

Sample this channel’s perceived value from its clean, fully-detected value.

Parameters:

clean_channel (Any) – The noise-free value of this channel, built from a state or taken from the world’s raw reading.

Return type:

ndarray

Returns:

The perceived value of the same channel.

supports_density: bool = True

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.image_models module

Image-channel observation models (catalog placeholder).

Register per-channel models for a future image observation channel here, with register_observation_model() (@register_observation_model("image", "<name>")), then import the new class from this subpackage’s __init__ so registration runs on import.

The CARLA world does not yet emit an image channel, so this catalog is intentionally empty. When raw camera frames enter the observation schema, add an encoder here (e.g. a learned CNN feature map). An encoder that only samples (no tractable density) sets supports_density = False: it is usable by sampling planners but rejected by beliefs that score observations.

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.lidar_models module

Lidar-channel observation models (catalog placeholder).

Register per-channel models for a future lidar observation channel here, with register_observation_model() (@register_observation_model("lidar", "<name>")), then import the new class from this subpackage’s __init__ so registration runs on import.

The CARLA world does not yet emit a lidar channel, so this catalog is intentionally empty. When raw point clouds enter the observation schema, add an encoder here (e.g. a voxel or range-image feature encoder). An encoder that only samples (no tractable density) sets supports_density = False: it is usable by sampling planners but rejected by beliefs that score observations.

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.registry module

Registry of per-channel CARLA observation models keyed by (channel, name).

Concrete per-channel models register themselves with the register_observation_model() decorator so a user can select, per observation channel, which model the planner’s generative environment holds — e.g. {"gnss": "gaussian", "agents": "factored"}. The environment resolves the selection into instances via build_observation_model().

Functions:

register_observation_model: Decorator registering a factory under (channel, name). build_observation_model: Instantiate the model registered under (channel, name). available_observation_models: List the names registered for a channel.

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.registry.available_observation_models(channel)[source]

Return the catalog names registered for channel, sorted.

Return type:

List[str]

Parameters:

channel (str)

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.registry.build_observation_model(channel, name, **kwargs)[source]

Instantiate the observation model registered under (channel, name).

Parameters:
  • channel (str) – The observation-dict key to resolve the model for.

  • name (str) – The registered catalog name within that channel.

  • **kwargs (Any) – Forwarded to the registered factory.

Return type:

CarlaObservationModel

Returns:

The instantiated per-channel observation model.

Raises:

KeyError – If no model is registered under (channel, name).

POMDPPlanners.environments.carla_pomdp.carla_perception.observation_models.registry.register_observation_model(channel, name)[source]

Register an observation-model factory under (channel, name) for user selection.

Parameters:
  • channel (str) – The observation-dict key the model handles (e.g. "gnss", "agents").

  • name (str) – The catalog name the user selects the model by within that channel.

Return type:

Callable[[TypeVar(_FactoryT, bound= Callable[..., CarlaObservationModel])], TypeVar(_FactoryT, bound= Callable[..., CarlaObservationModel])]

Returns:

A decorator that registers the factory (a class or callable returning a CarlaObservationModel) and returns it unchanged (its type is preserved).