Chapter 8: Basics of Robot Perception (Survey)

Lesson 1: From Raw Signals to Information

This lesson formalizes how a robot converts raw sensor signals into usable information for decision-making. We model sensing as a physical transduction followed by sampling, quantization, noise suppression, and estimation. The emphasis is on mathematical foundations that will support later lessons on calibration, features, and fusion.

1. From Physics to Bits: The Perception Pipeline

A sensor does not directly measure a “fact about the world.” It produces a signal that is a function of a hidden physical quantity. Let the latent quantity be \( x \) (e.g., distance, angle, acceleration), and the sensor output be \( y \). Perception is the process of inferring \( x \) (or some function of it) from \( y \).

flowchart TD
  P["Physical quantity x(t)"] --> T["Transduction (sensor physics)"]
  T --> A["Analog signal y_a(t)"]
  A --> C["Analog conditioning (gain/offset/filter)"]
  C --> S["Sampling + ADC"]
  S --> Q["Quantized digital y[k]"]
  Q --> F["Digital filtering"]
  F --> E["Estimation / feature"]
  E --> D["Decision / control input"]
        

We now model each stage using mathematics that you already know from signals and linear control, but adapted to robot sensing.

2. Observation Models: Deterministic and Stochastic Views

The most common abstraction is an observation model \( y = h(x) \), where \( h \) captures the sensor’s physics and geometry. Real sensors also have disturbances, so we write

\[ y = h(x) + v, \]

where \( v \) is measurement noise. In robotics, the same physical quantity may be sensed repeatedly over time, so we index by discrete time \( k \):

\[ y[k] = h(x[k]) + v[k]. \]

If \( h \) is linear, we have \( h(x)=Hx \), giving:

\[ y[k] = H x[k] + v[k]. \]

This form is the backbone of many perception algorithms. In this lesson, we only use it to study how raw signals become reliable estimates.

3. Sampling and Quantization: Converting to Digital Measurements

Sensors often output continuous-time analog signals \( y_a(t) \). An ADC converts them into discrete-time digital signals. Sampling at period \( T_s \) yields \( y_s[k] = y_a(kT_s) \).

For band-limited signals with maximum frequency \( f_{\max} \), the Nyquist condition is

\[ f_s = \frac{1}{T_s} \ge 2 f_{\max}. \]

After sampling, quantization maps a real value to one of \( 2^b \) levels for a \( b \)-bit ADC. With full-scale range \( [y_{\min},y_{\max}] \), the quantization step is

\[ \Delta = \frac{y_{\max}-y_{\min}}{2^b}. \]

The quantized output is

\[ y_q[k] = Q(y_s[k]) = y_{\min} + \Delta \cdot \left\lfloor \frac{y_s[k]-y_{\min}}{\Delta} \right\rceil, \]

where \( \lfloor \cdot \rceil \) rounds to the nearest integer. Define quantization noise \( e_q[k] = y_q[k]-y_s[k] \). Under the standard high-resolution assumption (signal not correlated with ADC bins), \( e_q[k] \sim \mathrm{Unif}(-\Delta/2,\Delta/2) \), so

\[ \mathbb{E}[e_q[k]] = 0,\qquad \operatorname{Var}(e_q[k]) = \frac{\Delta^2}{12}. \]

flowchart TD
  Y["Analog y_a(t)"] --> Samp["Sample at Ts: y_s[k]"]
  Samp --> Round["Round to nearest bin"]
  Round --> Yq["Digital y_q[k]"]
  Yq --> Eq["Quantization error e_q[k] in [-Delta/2, Delta/2]"]
        

Thus, ADC resolution directly limits the smallest detectable change in a sensed quantity.

4. Noise, Signal-to-Noise Ratio, and Filtering

Let a digital measurement be \( y[k] = s[k] + n[k] \), where \( s[k] \) is the ideal signal and \( n[k] \) noise (including sensor, environment, and quantization effects).

The discrete-time SNR (power ratio) is

\[ \mathrm{SNR} = \frac{\mathbb{E}[s[k]^2]}{\mathbb{E}[n[k]^2]}. \]

A basic denoising tool is a first-order low-pass filter:

\[ \hat{s}[k] = (1-\alpha)\hat{s}[k-1] + \alpha y[k], \qquad 0<\alpha<1. \]

This is equivalent to the stable LTI system with transfer function

\[ H(z) = \frac{\alpha}{1-(1-\alpha)z^{-1}}. \]

The parameter \( \alpha \) relates to a continuous-time time constant \( \tau \) by matching the bilinear/forward-Euler discretization:

\[ \alpha = \frac{T_s}{\tau + T_s}. \]

If noise is zero-mean and independent across time, averaging reduces variance. For a moving average of window length \( m \):

\[ \hat{s}[k] = \frac{1}{m}\sum_{i=0}^{m-1} y[k-i]. \]

Then \( \operatorname{Var}(\hat{s}[k]) = \operatorname{Var}(n[k])/m \). This simple fact explains why many robots oversample and smooth raw data.

5. Estimation as Information Extraction

Information means an estimate of \( x \) that is more reliable or more directly useful than raw \( y \). Suppose we take \( m \) measurements of a constant scalar \( x \):

\[ y_i = x + v_i,\quad i=1,\dots,m, \qquad \mathbb{E}[v_i]=0,\; \operatorname{Var}(v_i)=\sigma^2. \]

The least-squares (LS) estimator minimizes \( J(x)=\sum_{i=1}^m (y_i-x)^2 \).

Proposition (LS estimator). The minimizer is the sample mean \( \hat{x}=\bar{y} \).

Proof.

\[ J(x)=\sum_{i=1}^m (y_i-x)^2. \]

Differentiate and set to zero:

\[ \frac{dJ}{dx} = -2\sum_{i=1}^m (y_i-x) = 0 \;\Rightarrow\; mx = \sum_{i=1}^m y_i \;\Rightarrow\; \hat{x}= \frac{1}{m}\sum_{i=1}^m y_i=\bar{y}. \]

Since \( d^2J/dx^2 = 2m > 0 \), this critical point is a global minimum. ∎

The estimator variance is

\[ \operatorname{Var}(\hat{x}) = \operatorname{Var}\!\left( \frac{1}{m}\sum_{i=1}^m v_i \right) = \frac{1}{m^2}\sum_{i=1}^m \sigma^2 = \frac{\sigma^2}{m}. \]

So repeated sensing converts raw data into information by lowering uncertainty.

If the observation model is linear vector-valued, \( y = Hx + v \), the LS estimate solves:

\[ \hat{x} = \arg\min_x \|y-Hx\|_2^2. \]

Proposition (normal equations). If \( H^T H \) is invertible, then

\[ \hat{x} = (H^T H)^{-1}H^T y. \]

Proof. Expand the cost: \( \|y-Hx\|_2^2=(y-Hx)^T(y-Hx) \). Differentiate w.r.t. \( x \):

\[ \nabla_x \|y-Hx\|_2^2 = -2H^T(y-Hx)=0 \;\Rightarrow\; H^T H x = H^T y. \]

If \( H^T H \) is invertible, the unique solution is \( (H^T H)^{-1}H^T y \). ∎

Under Gaussian noise, this LS estimate is also the Maximum Likelihood (ML) estimate, connecting “information” to optimal inference, but we postpone full probabilistic robotics to later lessons.

6. Implementations: Signal Conditioning and Estimation

The following examples simulate noisy sensing, ADC quantization, and a low-pass filter. These are deliberately lightweight (no ROS yet).

6.1 Python (NumPy) — Sampling, Quantization, Low-Pass Filter


import numpy as np

# Simulated analog signal x(t) sampled at Ts
Ts = 0.01
t = np.arange(0, 2, Ts)
x_true = np.sin(2*np.pi*1.0*t)  # 1 Hz signal

# Add sensor noise (zero-mean Gaussian)
sigma = 0.2
y = x_true + np.random.normal(0, sigma, size=t.shape)

# Quantization (b-bit ADC over [-1.5, 1.5])
b = 8
ymin, ymax = -1.5, 1.5
Delta = (ymax - ymin) / (2**b)
yq = ymin + Delta * np.round((y - ymin) / Delta)

# First-order low-pass filter
tau = 0.1
alpha = Ts / (tau + Ts)  # matches alpha = Ts/(tau+Ts)
s_hat = np.zeros_like(yq)
for k in range(1, len(yq)):
    s_hat[k] = (1 - alpha) * s_hat[k-1] + alpha * yq[k]

print("Delta =", Delta)
print("Filtered estimate variance approx =", np.var(s_hat - x_true))
      

6.2 C++ (Eigen) — Moving Average and LS Estimate


#include <iostream>
#include <vector>
#include <numeric>
#include <Eigen/Dense>

double movingAverage(const std::vector<double>& y, int k, int m){
    double s = 0.0;
    for(int i = 0; i < m; ++i){
        s += y[k - i];
    }
    return s / m;
}

int main(){
    // Example LS: y = Hx + v
    Eigen::MatrixXd H(3,2);
    H << 1, 0,
         1, 1,
         0, 1;
    Eigen::VectorXd y(3);
    y << 1.1, 2.0, 0.9;

    Eigen::VectorXd x_hat = (H.transpose()*H).inverse() * H.transpose() * y;
    std::cout << "LS estimate x_hat =\\n" << x_hat << std::endl;
    return 0;
}
      

6.3 Java (EJML) — First-Order Low-Pass Filter


import java.util.Random;

public class LowPassDemo {
    public static void main(String[] args) {
        double Ts = 0.01;
        double tau = 0.1;
        double alpha = Ts / (tau + Ts);

        int N = 500;
        double[] yq = new double[N];
        double[] shat = new double[N];
        Random rng = new Random(0);

        for(int k=0;k<N;k++){
            double t = k*Ts;
            double xTrue = Math.sin(2*Math.PI*1.0*t);
            double y = xTrue + 0.2*rng.nextGaussian();

            // quantize to 8-bit over [-1.5,1.5]
            double ymin = -1.5, ymax = 1.5;
            int b = 8;
            double Delta = (ymax-ymin)/Math.pow(2,b);
            yq[k] = ymin + Delta*Math.round((y-ymin)/Delta);

            if(k>0){
                shat[k] = (1-alpha)*shat[k-1] + alpha*yq[k];
            }
        }
        System.out.println("Final filtered value = " + shat[N-1]);
    }
}
      

6.4 MATLAB / Simulink — Quantization + Filter


Ts = 0.01; t = 0:Ts:2;
x_true = sin(2*pi*1*t);
sigma = 0.2;
y = x_true + sigma*randn(size(t));

% Quantize (8-bit, range [-1.5,1.5])
b = 8; ymin=-1.5; ymax=1.5;
Delta = (ymax-ymin)/2^b;
yq = ymin + Delta*round((y-ymin)/Delta);

% First-order low-pass
tau = 0.1;
alpha = Ts/(tau+Ts);
s_hat = zeros(size(yq));
for k = 2:length(yq)
    s_hat(k) = (1-alpha)*s_hat(k-1) + alpha*yq(k);
end

disp(Delta);
disp(var(s_hat - x_true));

% Simulink hint:
% Use blocks:
%   - "Band-Limited White Noise" to add noise
%   - "Zero-Order Hold" for sampling
%   - "Quantizer" for ADC
%   - "Discrete Transfer Fcn" for H(z) low-pass
      

7. Problems and Solutions

Problem 1 (ADC variance): A sensor produces analog values in \( [-2,2] \). You use a \( b=10 \)-bit ADC. Compute the quantization step \( \Delta \) and the quantization-noise variance assuming uniform quantization noise.

Solution:

\[ \Delta = \frac{2-(-2)}{2^{10}} = \frac{4}{1024} = 0.00390625. \]

\[ \operatorname{Var}(e_q) = \frac{\Delta^2}{12} = \frac{(0.00390625)^2}{12} \approx 1.27\times 10^{-6}. \]

Problem 2 (Noise reduction by averaging): Suppose \( y_i=x+v_i \) with \( \operatorname{Var}(v_i)=\sigma^2 \) i.i.d. Show that averaging \( m \) measurements yields an estimator with variance \( \sigma^2/m \).

Solution:

\[ \hat{x}=\frac{1}{m}\sum_{i=1}^m y_i = x + \frac{1}{m}\sum_{i=1}^m v_i. \]

\[ \operatorname{Var}(\hat{x}) = \operatorname{Var}\!\left(\frac{1}{m}\sum_{i=1}^m v_i\right) = \frac{1}{m^2}\sum_{i=1}^m \sigma^2 = \frac{\sigma^2}{m}. \]

Problem 3 (LS for a linear sensor): A 2D quantity \( x\in\mathbb{R}^2 \) is measured by \( y=Hx+v \) with \( H=\begin{bmatrix}1&0\\1&1\\0&1\end{bmatrix} \). Derive the LS estimate \( \hat{x} \) in closed form.

Solution:

\[ \hat{x}=(H^TH)^{-1}H^Ty. \]

\[ H^TH =\begin{bmatrix} 1^2+1^2+0^2 & 1\cdot0 + 1\cdot1 + 0\cdot1\\ 0\cdot1 + 1\cdot1 + 1\cdot0 & 0^2+1^2+1^2 \end{bmatrix} =\begin{bmatrix} 2 & 1\\ 1 & 2 \end{bmatrix}. \]

\[ (H^TH)^{-1} =\frac{1}{3}\begin{bmatrix} 2 & -1\\ -1 & 2 \end{bmatrix}. \]

\[ H^Ty= \begin{bmatrix} y_1+y_2\\ y_2+y_3 \end{bmatrix}. \]

\[ \Rightarrow\; \hat{x}=\frac{1}{3} \begin{bmatrix} 2(y_1+y_2)-(y_2+y_3)\\ -(y_1+y_2)+2(y_2+y_3) \end{bmatrix}. \]

Problem 4 (Filter parameter selection): A robot samples a sensor at \( T_s=0.02 \) s and wants a first-order low-pass with time constant \( \tau =0.18 \) s. Compute \( \alpha \).

Solution:

\[ \alpha = \frac{T_s}{\tau+T_s} = \frac{0.02}{0.18+0.02} = \frac{0.02}{0.20} = 0.1. \]

8. Summary

We modeled sensing as a pipeline from physical quantities to digital measurements and then to estimates. Sampling and quantization impose fundamental precision limits, while noise suppression and least-squares estimation convert raw signals into actionable information. These ideas set up the next lesson on calibration, where we learn to identify and correct systematic biases in \( h(\cdot) \).

9. References (Theoretical Papers)

  1. Shannon, C.E. (1948). A mathematical theory of communication. Bell System Technical Journal, 27(3), 379–423.
  2. Wiener, N. (1949). Extrapolation, interpolation, and smoothing of stationary time series. MIT Press / Wiley (foundational filtering theory).
  3. Kalman, R.E. (1960). A new approach to linear filtering and prediction problems. Journal of Basic Engineering, 82(1), 35–45.
  4. Jazwinski, A.H. (1966). Filtering for nonlinear dynamical systems. IEEE Transactions on Automatic Control, 11(4), 765–766.
  5. van Trees, H.L. (1968). Detection, estimation, and modulation theory: Part I. Wiley (classical estimation bounds for sensing).
  6. Bar-Shalom, Y., & Fortmann, T.E. (1988). Tracking and data association. IEEE Control Systems Magazine, 8(1), 3–7.
  7. Smith, R.C., & Cheeseman, P. (1986). On the representation and estimation of spatial uncertainty. International Journal of Robotics Research, 5(4), 56–68.