Skip to main content
Robotics & Embodied AI

⏱ About 20 min20 XP

State Estimation and Filtering

Every sensor lies, a little. An accelerometer measuring a robot's forward motion returns not the true acceleration but the true acceleration plus noise. An encoder counting wheel rotations accumulates small errors that grow with distance. A GPS receiver places the robot within a circle of uncertainty that expands in urban canyons. No single measurement tells the robot exactly where it is or what it is doing. Yet robots act. They hold trajectories, track targets, balance on two wheels, and land on moving platforms. The mechanism that makes this possible is state estimation: the principled combination of uncertain measurements over time to maintain a best estimate of the robot's state.

The State and the Estimation Problem

The state of a robot is a vector that completely describes the robot's current relevant condition for the purpose of control and planning. A wheeled robot's state might be (x, y, theta) — position and heading. A quadrotor's state might be (x, y, z, roll, pitch, yaw, x_dot, y_dot, z_dot, roll_rate, pitch_rate, yaw_rate) — position, orientation, and their derivatives. A robot arm's state might be the angles and angular velocities of all joints. The state is never directly observable. Sensors measure projections of the state, corrupted by noise. A wheel encoder measures (approximately) the angle each wheel has turned — but not the robot's absolute position. A camera gives pixel intensities — not object distances. An IMU gives accelerations and rotation rates — not absolute velocity or position. State estimation is the problem of inferring the hidden state from a sequence of noisy, indirect measurements. It is fundamentally a Bayesian reasoning problem: maintain a probability distribution over the state, update it with each new measurement, and propagate it forward as the robot moves.

The Belief Distribution

Rather than a single estimate of state, Bayesian state estimation maintains a belief: a probability distribution p(x_t | z_1:t, u_1:t) — the probability that the state is x at time t given all measurements z and control inputs u seen up to time t. Actions narrow the distribution (more data = less uncertainty). Motion widens it (uncertainty grows as the robot moves without observing). Estimation is the art of keeping this distribution tight.

The Bayesian filter is the theoretical foundation. It has two alternating steps. Prediction step: given the current belief and the control command just executed, predict the next state distribution using a motion model. If the robot commanded 'move forward 1 meter,' the motion model predicts how the state distribution shifts. Because motion has uncertainty (wheel slip, surface irregularity, timing error), the prediction spreads the distribution — uncertainty grows. Update step: incorporate the latest sensor measurement to sharpen the estimate. The measurement model describes the probability of observing a given measurement given a hypothesized state. Bayes' rule combines the predicted distribution with this measurement likelihood to produce the posterior: the updated belief. If the measurement is highly informative, it sharply narrows the distribution; if it is noisy, it narrows it less. Repeat: move (predict, uncertainty grows) → observe (update, uncertainty shrinks) → move → observe. The filter constantly oscillates between expanding and contracting uncertainty, maintaining a running estimate that is better than any single measurement or any dead-reckoned prediction alone.

The Kalman filter (Kalman, 1960) is the optimal Bayesian filter for the special case where the motion model is linear, the measurement model is linear, and both the process noise and measurement noise are Gaussian. Under these conditions, the belief is always a Gaussian distribution, fully characterized by its mean (the best estimate) and covariance (the uncertainty). The Kalman filter maintains these two quantities. The predict step advances the mean through the linear motion model and grows the covariance by adding the process noise covariance. The update step computes the Kalman gain — a matrix that balances how much to trust the prediction versus the measurement — then updates the mean and shrinks the covariance. Kalman gain intuition: if the measurement noise is very small (the sensor is accurate), the Kalman gain is large — the update step trusts the measurement and moves the estimate strongly toward it. If the measurement noise is large (the sensor is noisy), the gain is small — the estimate barely moves. The filter automatically and optimally weights sensors by their known reliability. For nonlinear systems (which describes most real robots), the Extended Kalman Filter (EKF) linearizes the motion and measurement models around the current estimate using Jacobians. The Unscented Kalman Filter (UKF) uses a deterministic set of sigma points to capture the distribution's statistics without requiring explicit linearization. Particle filters handle arbitrarily nonlinear, non-Gaussian problems by representing the distribution as a set of weighted samples.

Match each state estimation concept to its precise definition.

Terms

Kalman gain
Prediction step
Update step
Process noise
Measurement noise

Definitions

Advancing the state estimate forward using the motion model; uncertainty grows as process noise is added
A matrix that weights how strongly the update step moves the estimate toward the new measurement, based on relative noise levels
Incorporating a new measurement via Bayes' rule to sharpen the estimate; uncertainty shrinks
Uncertainty in the sensor reading itself, characterized by the sensor's noise covariance matrix
Uncertainty in how accurately the motion model predicts the next state from the control command

Drag terms onto their definitions, or click a term then click a definition to match.

Filter Divergence

A Kalman filter diverges when its internal covariance matrix — the filter's belief about its own uncertainty — becomes inconsistent with actual error. This happens when the assumed noise models are wrong (the real world is noisier than modeled) or when unmodeled dynamics occur (the robot hits a bump the model does not know about). A diverged filter can confidently report a wrong estimate. Real systems must monitor filter consistency using normalized innovation statistics.

A robot's Kalman filter has a very small measurement noise covariance for its GPS sensor (implying high trust in GPS) but in reality the GPS is operating under tree cover with poor signal quality. What failure mode results?

A particle filter represents the state distribution as 500 weighted samples. After several motion steps with no observations, what happens to these samples and why?

Design a Filter for a Robot Scenario

  1. A two-wheeled differential drive robot navigates an indoor hallway. Its sensors are: left wheel encoder, right wheel encoder, and a single front-facing laser rangefinder that measures the distance to the nearest wall ahead.
  2. Step 1: Define the robot's state vector. What quantities does it include, and why are those quantities and not others chosen?
  3. Step 2: Describe the motion model: given current state (x, y, theta) and commanded wheel velocities (v_left, v_right), what is the predicted next state? Identify two physical phenomena that cause real motion to deviate from this model.
  4. Step 3: Describe the measurement model for the rangefinder: given a hypothesized state (x, y, theta) and a known map of the hallway, what distance would we expect the rangefinder to measure? Where does measurement noise come from?
  5. Step 4: Walk through one prediction step and one update step qualitatively. What happens to the uncertainty ellipse in each step?
  6. Step 5: Identify one scenario where this filter would likely diverge or produce a badly wrong estimate. How would you detect this and what would you do?
  7. Write your response as a technical design note, as if you were explaining it to a teammate who will implement the filter.