POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models package
Catalog of per-channel nuPlan observation models, registered for user selection.
Each observation channel has its own module of concrete
NuPlanObservationModel
implementations (ego_models, agent_models). Importing a channel module runs its
@register_observation_model decorators, so a planner environment can resolve a per-channel
selection like {"ego": "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:
EgoObservationModel: Additive-Gaussian-noise ego proprioception with a matching density. FactoredAgentObservationModel: Per-slot detection + occlusion gating + Gaussian pose noise.
- class POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.EgoObservationModel(ego_std=0.01)[source]
Bases:
NuPlanObservationModelEgo proprioception corrupted by additive Gaussian noise, with a matching density.
nuPlan gives the ego near-perfect self-localisation, so this channel is modelled as the true ego block plus small zero-mean Gaussian measurement noise. Provides both a sampler and a matching density, so it can back a scoring generative model.
- Parameters:
ego_std (float)
- ego_std
Std of the zero-mean Gaussian noise added to the ego proprioception vector.
Example
>>> import numpy as np >>> np.random.seed(0) >>> model = EgoObservationModel(ego_std=0.01) >>> perceived = model.perceive(np.zeros(7)) >>> perceived.shape (7,)
- log_probability(clean_channel, channel_observation)[source]
Log-density of
channel_observationgiven the clean channel value.- Parameters:
- Return type:
- Returns:
The channel’s observation log-probability.
- Raises:
NotImplementedError – If this is a sample-only channel without a density.
- class POMDPPlanners.environments.nuplan_pomdp.nuplan_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:
NuPlanObservationModelReference 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
Number of fixed agent slots in the
agentsblock.
- perception_range
Metres beyond which an agent is undetectable (
Nonedisables 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_probis 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
- log_probability(clean_channel, channel_observation)[source]
Log-density of
channel_observationgiven the clean channel value.- Parameters:
- Return type:
- 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.
- render(clean_channel, noisy)[source]
Gate the clean agent block per slot, optionally sampling the sensor noise.
- Parameters:
clean_channel (
Any) – The noise-free flatagentsblock.noisy (
bool) – When True, take the sampler path — a visible slot is detected with probabilitydetect_proband its pose is corrupted by Gaussian noise, matching whatlog_probability()scores. When False, return the gated but noise-free block (every visible slot detected).
- Return type:
- Returns:
The perceived flat
agentsblock.
- POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.available_observation_models(channel)[source]
Return the catalog names registered for
channel, sorted.
- POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.build_observation_model(channel, name, **kwargs)[source]
Instantiate the observation model registered under
(channel, name).- Parameters:
- Return type:
- Returns:
The instantiated per-channel observation model.
- Raises:
KeyError – If no model is registered under
(channel, name).
- POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.register_observation_model(channel, name)[source]
Register an observation-model factory under
(channel, name)for user selection.- Parameters:
- Return type:
Callable[[TypeVar(_FactoryT, bound=Callable[...,NuPlanObservationModel])],TypeVar(_FactoryT, bound=Callable[...,NuPlanObservationModel])]- Returns:
A decorator that registers the factory (a class or callable returning a
NuPlanObservationModel) and returns it unchanged (its type is preserved).
Submodules
POMDPPlanners.environments.nuplan_pomdp.nuplan_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.nuplan_pomdp.nuplan_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:
NuPlanObservationModelReference 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
Number of fixed agent slots in the
agentsblock.
- perception_range
Metres beyond which an agent is undetectable (
Nonedisables 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_probis 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
- log_probability(clean_channel, channel_observation)[source]
Log-density of
channel_observationgiven the clean channel value.- Parameters:
- Return type:
- 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.
- render(clean_channel, noisy)[source]
Gate the clean agent block per slot, optionally sampling the sensor noise.
- Parameters:
clean_channel (
Any) – The noise-free flatagentsblock.noisy (
bool) – When True, take the sampler path — a visible slot is detected with probabilitydetect_proband its pose is corrupted by Gaussian noise, matching whatlog_probability()scores. When False, return the gated but noise-free block (every visible slot detected).
- Return type:
- Returns:
The perceived flat
agentsblock.
POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.ego_models module
Ego-channel observation models.
Catalog of per-channel models for the ego observation channel (the ego proprioception
block [x, y, yaw, vx, vy, lat, heading_err]). Add new ego models here and register them with
register_observation_model() so they can be selected by name.
- Classes:
EgoObservationModel: Additive-Gaussian-noise ego proprioception with a matching density.
- class POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.ego_models.EgoObservationModel(ego_std=0.01)[source]
Bases:
NuPlanObservationModelEgo proprioception corrupted by additive Gaussian noise, with a matching density.
nuPlan gives the ego near-perfect self-localisation, so this channel is modelled as the true ego block plus small zero-mean Gaussian measurement noise. Provides both a sampler and a matching density, so it can back a scoring generative model.
- Parameters:
ego_std (float)
- ego_std
Std of the zero-mean Gaussian noise added to the ego proprioception vector.
Example
>>> import numpy as np >>> np.random.seed(0) >>> model = EgoObservationModel(ego_std=0.01) >>> perceived = model.perceive(np.zeros(7)) >>> perceived.shape (7,)
- log_probability(clean_channel, channel_observation)[source]
Log-density of
channel_observationgiven the clean channel value.- Parameters:
- Return type:
- Returns:
The channel’s observation log-probability.
- Raises:
NotImplementedError – If this is a sample-only channel without a density.
POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.registry module
Registry of per-channel nuPlan 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. {"ego": "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.nuplan_pomdp.nuplan_perception.observation_models.registry.available_observation_models(channel)[source]
Return the catalog names registered for
channel, sorted.
- POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.registry.build_observation_model(channel, name, **kwargs)[source]
Instantiate the observation model registered under
(channel, name).- Parameters:
- Return type:
- Returns:
The instantiated per-channel observation model.
- Raises:
KeyError – If no model is registered under
(channel, name).
- POMDPPlanners.environments.nuplan_pomdp.nuplan_perception.observation_models.registry.register_observation_model(channel, name)[source]
Register an observation-model factory under
(channel, name)for user selection.- Parameters:
- Return type:
Callable[[TypeVar(_FactoryT, bound=Callable[...,NuPlanObservationModel])],TypeVar(_FactoryT, bound=Callable[...,NuPlanObservationModel])]- Returns:
A decorator that registers the factory (a class or callable returning a
NuPlanObservationModel) and returns it unchanged (its type is preserved).