> ## Documentation Index
> Fetch the complete documentation index at: https://aegean.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Beam-based Sensor Models

> Probabilistic models for sonar, lidar, and range sensors.

<img src="https://mintcdn.com/aegeanaiinc/hS9p_kPxnquN68XS/aiml-common/lectures/sensor-models/beam/images/beam-measurement-model.png?fit=max&auto=format&n=hS9p_kPxnquN68XS&q=85&s=de740c356ef6b098a6668cebea2a70ed" alt="Beam measurement model" width="946" height="553" data-path="aiml-common/lectures/sensor-models/beam/images/beam-measurement-model.png" />

Beam-based distance sensors (sonar, lidar, depth IR) measure distances to the nearest surface along discrete directions (beams). We develop a probabilistic forward (generative) model $p(\mathbf z_t \mid \mathbf x_t, m)$ describing the likelihood of receiving range scan $\mathbf z_t$ from pose $\mathbf x_t$ in map $m$, and an inverse model for occupancy mapping.

Notation:

* Robot pose (planar): $\mathbf x_t = (x_t, y_t, \theta_t)$.
* Map $m$: occupancy grid (binary / probabilistic) or geometric (polygonal, mesh).
* Scan: $\mathbf z_t = { z_t^k }_{k=1}^K$ with beam angles $\phi_k$ relative to sensor frame.
* Maximum sensor range: $z_{\max}$.
* Expected (ideal) range along beam $k$: $\hat z_t^k = r(\mathbf x_t, \phi_k, m)$ found via ray casting.

Assumed conditional independence (approximation):

$$
p(\mathbf z_t \mid \mathbf x_t, m) = \prod_{k=1}^K p(z_t^k \mid \mathbf x_t, m).
$$

<img src="https://mintcdn.com/aegeanaiinc/hS9p_kPxnquN68XS/aiml-common/lectures/sensor-models/beam/images/measurement-model-components.png?fit=max&auto=format&n=hS9p_kPxnquN68XS&q=85&s=26ee83bfff2a1294b3a0e3ef7f19f86b" alt="Measurement model components" width="1191" height="691" data-path="aiml-common/lectures/sensor-models/beam/images/measurement-model-components.png" />

## Beam-Based Forward Model (Mixture)

Real measurements exhibit multiple phenomena: precise hits, unexpected short returns, max-range (no return), and random noise. Model each beam as a weighted mixture:

$$
p(z \mid \hat z) = \alpha_{\text{hit}} p_{\text{hit}}(z \mid \hat z) +
\alpha_{\text{short}} p_{\text{short}}(z \mid \hat z) +
\alpha_{\text{max}} p_{\text{max}}(z) +
\alpha_{\text{rand}} p_{\text{rand}}(z),
$$

with $\sum_i \alpha_i = 1$.

<img src="https://mintcdn.com/aegeanaiinc/hS9p_kPxnquN68XS/aiml-common/lectures/sensor-models/beam/images/hit-unexpected-components.png?fit=max&auto=format&n=hS9p_kPxnquN68XS&q=85&s=be630d6f29b76796c0b97d0d609cdcc1" alt="Hit and Unexpected components" width="1191" height="691" data-path="aiml-common/lectures/sensor-models/beam/images/hit-unexpected-components.png" />

### Precise Hit Component

$$
p_{\text{hit}}(z \mid \hat z) =
\begin{cases}
\eta \exp\!\left(-\dfrac{(z - \hat z)^2}{2\sigma_{\text{hit}}^2}\right), & 0 \le z \le z_{\max}\\
0, & \text{otherwise}
\end{cases}
$$

$\eta$ normalizes over $[0,z_{\max}]$.

### Unexpected Short Return

Captures unmodelled obstacles between sensor and predicted surface:

$$
p_{\text{short}}(z \mid \hat z) =
\begin{cases}
\eta \lambda e^{-\lambda z}, & 0 \le z \le \hat z\\
0, & z > \hat z
\end{cases}
$$

<img src="https://mintcdn.com/aegeanaiinc/iBnrtTVFaQnAQQVi/aiml-common/lectures/sensor-models/beam/images/random-max-range-components.png?fit=max&auto=format&n=iBnrtTVFaQnAQQVi&q=85&s=a35f3613f27d02980b1d4b2621352a20" alt="Max range and Random components" width="1191" height="691" data-path="aiml-common/lectures/sensor-models/beam/images/random-max-range-components.png" />

### Max Range

$$
p_{\text{max}}(z) =
\begin{cases}
1, & z = z_{\max}\\
0, & \text{otherwise}
\end{cases}
$$

### Random Noise

$$
p_{\text{rand}}(z) =
\begin{cases}
\dfrac{1}{z_{\max}}, & 0 \le z < z_{\max}\\
0, & \text{otherwise}
\end{cases}
$$

### Final Per-Beam Likelihood

$$
p(z_t^k \mid \mathbf x_t, m) = p(z \mid \hat z_t^k).
$$

Log form for numerical stability:

$$
\log p(\mathbf z_t \mid \mathbf x_t, m) = \sum_k \log\left( \sum_j \alpha_j p_j(z_t^k) \right).
$$

## Parameter Estimation

Given training set ${ (z_n, \hat z_n)}$:

* Closed-form for $\sigma_{\text{hit}}^2$ using weighted residual variance if component assignments known.
* Use EM:
  * E-step: responsibilities $r_{ni} = \dfrac{\alpha_i p_i(z_n)}{\sum_j \alpha_j p_j(z_n)}$.
  * M-step: $\alpha_i = \frac{1}{N}\sum_n r_{ni}$; update $\sigma_{\text{hit}}, \lambda$ via weighted MLE.

Constrain $\alpha_i \ge 0$, $\sum\alpha_i=1$.

## Dynamic Obstacles

Augment forward model with dynamic layer $m_D$:

$$
p(z \mid \hat z, m, m_D) = (1-\beta) p(z \mid \hat z, m) + \beta p_{\text{dyn}}(z),
$$

where $p_{\text{dyn}}$ could emphasize short / random returns; $\beta$ from motion segmentation.

**Key references**: (Zeng et al., 2016)

## References

* Zeng, A., Song, S., Nießner, M., Fisher, M., Xiao, J., et al. (2016). *3DMatch: Learning Local Geometric Descriptors from RGB-D Reconstructions*.

***

<Callout icon="pen-to-square" iconType="regular">
  [Edit this page on GitHub](https://github.com/aegean-ai/eaia/edit/main/src/aiml-common/lectures/sensor-models/beam/index.mdx) or [file an issue](https://github.com/aegean-ai/eaia/issues/new/choose).
</Callout>
