ProjekinAja. Robotics Stage 4 · State Estimation Lesson 4.4
● Stage 4 · Lesson 4.4

Kalman Filter Tuning: Q, R, and the Art of Honest Uncertainty

Q is not process noise — it is your honest admission of how much you do not know about your model; getting it wrong in either direction destroys the filter.

⏱ ~22 min read 🎛 Interactive widget 🔬 NEES consistency test

🎯 By the end you'll understand

Why Q encodes modelling humility, not sensor noise. How to set R from datasheets and calibration experiments. The iterative tuning workflow for both matrices. What NEES (Normalized Estimation Error Squared) measures and why a smooth-looking filter can still be dangerously wrong. How to detect inconsistency before it causes a field failure on FollowBot.

KEY INSIGHTA filter that looks good can still be lying to you

The filter's job is not to produce a smooth trajectory — it is to produce an honest posterior. Smoothness is a side effect of good tuning. It is also the calling card of a filter that is far too confident about a model that is far too simple.

Most engineers tune a Kalman filter by eye: fiddle with Q and R until the estimated trajectory looks smooth and tracks the data. The filter passes the visual test. It ships. Then, in a real environment with unmodelled dynamics, the filter's covariance collapses to near zero while the true error grows — the robot thinks it knows exactly where it is, and it is wrong by half a meter. Nobody catches this because the output still looks smooth.

🔑 The fundamental tuning principle

A well-tuned Kalman filter is not one whose output looks smooth. It is one whose stated uncertainty (the covariance P) is consistent with its actual error. When the filter says "my position error is ±0.1 m (1σ)," roughly 68% of the time the true error should be within 0.1 m — no more, no less. The Normalized Estimation Error Squared (NEES) test formalizes this. Tuning by eye cannot catch inconsistency. NEES testing can. That is the entire lesson.

CORE CONCEPTWhat Q actually means — and why "process noise" is misleading

The textbook name "process noise covariance" suggests Q describes random perturbations in the physical process — a gust of wind, a motor twitch, a bump in the floor. That is part of what Q captures, but the more important part is something you have direct control over: the gap between your model and reality.

Recall from Lesson 4.3 that the Kalman filter's prediction step propagates the state forward using a motion model. For FollowBot's 1D velocity tracking this looks like:

Prediction step x̂⁻ₖ = F · x̂ₖ₋₁ P⁻ₖ = F · Pₖ₋₁ · Fᵀ + Q F = state transition matrix (your model of how the state evolves) Q = how much you distrust that model — uncertainty injected each timestep this is your humility term not a sensor spec
The prediction step. F encodes your deterministic model; Q admits what F gets wrong. Tuning Q is tuning your honesty about F's limitations.

What is actually inside Q's uncertainty budget? At least three distinct contributors:

1

Unmodelled dynamics

FollowBot's constant-velocity motion model assumes velocity does not change between timesteps. It does. People accelerate and decelerate; floors have friction heterogeneity; tyre slip is real. None of this is in F. Q must absorb this model gap, or the filter will underestimate how much the true state can deviate from the predicted one.

2

Unmodelled disturbances

A bump in the floor produces a rotational impulse that the model does not account for. An elevator induces brief z-axis motion in an otherwise 2D model. These are genuine physical noise sources, but they are often larger and more structured than "white Gaussian noise," which is the technical assumption KF makes. Q must cover the gap.

3

Discretization error

The continuous-time motion equations are discretized at rate Δt. The higher-order terms dropped in this discretization accumulate as model error. For a first-order ZOH discretization of a constant-velocity model, the exact process noise from this source can be computed analytically (the van Loan method), but most practitioners round up generously in Q because other error sources dominate anyway.

💡 Q too small vs. Q too large: asymmetric consequences

Q too small: the filter trusts its model too much. The covariance P collapses. New measurements are downweighted (the Kalman gain K shrinks). The filter becomes overconfident and slow to correct real deviations. This is the dangerous failure — the robot thinks it knows where it is when it does not. Q too large: the filter distrusts its model excessively. P stays inflated. The filter chases every measurement, including noise. The output is jittery and you lose the filter's smoothing benefit. This is annoying but it is not dangerous — the uncertainty is honestly stated. When in doubt, err toward Q too large rather than Q too small.

CORE CONCEPTCalibrating R from sensor reality

R, the measurement noise covariance, has a cleaner theoretical status than Q: it truly does describe sensor noise, and it is in principle measurable. In practice, the measurement is never as clean as the datasheet implies.

The measurement update step uses R to weight new observations against the prediction:

Update step Kₖ = P⁻ₖ · Hᵀ · (H · P⁻ₖ · Hᵀ + R)⁻¹ x̂ₖ = x̂⁻ₖ + Kₖ · (zₖ − H · x̂⁻ₖ) Pₖ = (I − Kₖ · H) · P⁻ₖ Large R → small K → filter trusts prediction more than measurement (lag). Small R → large K → filter trusts measurement (jitter).
The Kalman gain K trades off prediction against measurement. R controls how much weight the filter gives to new data. Setting R too small makes the filter latch onto noisy measurements.

Three sources for R:

Source How to obtain When to trust it Gotcha
Sensor datasheet Manufacturer spec: "position accuracy ±0.03 m RMS" Good first estimate; square it to get variance Measured under ideal conditions — actual noise on a moving platform is often 2–5× higher
Static calibration Hold robot still, record N measurements, compute variance of residuals Accurate for static noise floor; fast to do Misses dynamic noise: vibration, motion-induced bias, thermal drift at operating temperature
In-motion calibration Drive a known trajectory; compare filter innovations to predicted innovation covariance Gold standard; captures real operating noise Requires ground truth or a trusted reference sensor; iterative; complex
⚠ R too small is the "overly credulous filter"

Set R to 1/10 of the true sensor noise and the filter will treat every sensor reading as nearly ground truth. On FollowBot, an IMU spike during a wheel-slip event will be folded into the pose estimate as if it were real. The pose will jump, the downstream planner will react, and the robot will veer. The visual symptom — jerky motion — is obvious. But the underlying cause (R misconfiguration) is frequently misdiagnosed as a sensor hardware problem. Check R before replacing hardware.

HOW IT WORKSThe iterative tuning workflow

A practical workflow for tuning (Q, R) systematically, from first principles to field-validated:

1

Set R first, from measurement

R can be estimated from data without running the filter. Record sensor readings while holding the robot stationary. Compute the variance of each measurement channel. Multiply by 1.5–2× as a safety factor for dynamic operation. This is your initial R. It is independent of Q, so set it first.

2

Set Q using the van Loan method or empirical bracketing

For a constant-velocity model at timestep Δt, process noise in position σ_pos can be related to acceleration uncertainty σ_a as σ_pos² ≈ (Δt²/2)² · σ_a². Estimate σ_a from the worst-case unmodelled acceleration. This gives a principled starting point. Then bracket: try Q×0.1 and Q×10 and observe how the filter responds to a step input.

3

Record innovation sequences

The innovation νₖ = zₖ − H·x̂⁻ₖ is the difference between what you measured and what you predicted. A well-tuned filter should have innovations that are white (zero-mean, uncorrelated in time) with covariance S = H·P⁻·Hᵀ + R. Whiteness is testable with autocorrelation. If innovations are correlated, Q is too small (the filter is missing systematic state changes). If innovations are too large, R is too small or Q is too large.

4

Compute NEES and validate

Run the filter on a trajectory with known ground truth. Compute NEES at each timestep. A consistent filter should have mean NEES ≈ n (where n is the state dimension). NEES >> n means the filter is overconfident (Q too small or R too small). NEES << n means the filter is underconfident (Q too large). Adjust Q and R until NEES settles near n across the full operating envelope.

5

Test under sensor dropout

Simulate losing one sensor for 2–5 seconds. The filter should fall back to prediction-only, covariance should grow (uncertainty increasing honestly), and when the sensor returns, the filter should re-acquire without diverging. A Q-undertuned filter will fail this test: covariance will not grow during dropout, and the returning measurement will be rejected as an outlier (innovation gating fails).

SEE ITQ/R tuner — 1D position tracking, NEES live

FollowBot is tracking a moving target in 1D. This widget uses a simpler 1-state (position-only) KF to isolate Q and R tuning. Velocity dynamics are replaced by a known constant v_true, which lets us study the noise parameters without the 2×2 covariance complexity of Lesson 4.3. The true trajectory is a simulated constant-velocity run with random acceleration disturbances (your model assumes constant velocity — that gap is exactly what Q must cover). Set Q and R, then observe the filter response and NEES. Can you find a setting that looks smooth but is inconsistent?

⚙ Interactive · Kalman Q/R Tuner with NEES

Adjust Q (process noise) and R (measurement noise). Watch how the estimated trajectory, covariance band, and NEES change. The alarm fires when NEES >> n (the state dimension; n=1 here), signalling an inconsistent filter. Toggle covariance inflation as a robustness fix. The disturbances use a deterministic pseudo-random sequence that approximates uniform noise; real IMU noise is Gaussian and has heavier tails.

—
10−2 (log scale)
—
100 (log scale)
Covariance inflation
Multiplies P by α each step — a robustness patch for unmodelled dynamics
—
Q value
—
R value
—
Mean NEES
—
RMS error (m)
⚠ NEES >> 1 — Filter is INCONSISTENT. The covariance understates true error. A smooth trajectory can still be lying to you.
⚠ NEES << 1 — Filter is OVERCONSERVATIVE. Covariance is inflated; gains are too low; filter is over-smoothing.
Trajectory — 80 timesteps, Δt = 0.1 s
Ground truth KF estimate Measurements (noisy) ±2σ covariance band
NEES over time — should be near 1.0 for a consistent 1D filter

Q too small (e.g. 10⁻⁴)

Covariance P collapses. Kalman gain K → 0. Filter ignores measurements. Estimate lags the truth. NEES >> 1. Looks smooth visually — but covariance band is far too narrow.

Q too large (e.g. 10⁰)

Covariance stays large. Gain K → 1. Filter chases every measurement including noise. Estimate is jittery. NEES near or below 1. Honest but noisy.

R too small (e.g. 10⁻²)

Filter overtrusts measurements. Estimate is noisy and jumpy. Spikes propagate directly into the state. NEES volatile. Dangerous when measurements contain outliers.

R too large (e.g. 10²)

Filter nearly ignores measurements. Estimate tracks the model prediction only — drifts with model error. NEES grows. In 1D pure lag; in 2D the robot drives confidently in the wrong direction.

The critical observation: with Q = 10⁻⁴ and R = 10⁰ (default-ish settings copied from a textbook example), the estimated trajectory looks smooth and professional. NEES is consistently above 3. The filter is inconsistent — it is understating its own uncertainty — but visually you would never know. This is how dangerous misconfiguration hides in production systems.

DEFINITIONNEES: formalizing filter consistency

The Normalized Estimation Error Squared is the standard engineering test for KF consistency. Given a filter running on a system where you have access to ground truth (a bag file with mocap, a simulation, or a precisely known test trajectory):

NEES definition (scalar / 1D case) ε̃ₖ = ẽₖᵀ · Pₖ⁻¹ · ẽₖ where ẽₖ = x̂ₖ − xₖ (estimation error at step k) Pₖ = filter covariance at step k NEES ≈ 1 Consistent — covariance matches error NEES >> 1 Overconfident — P understates error NEES << 1 Conservative — P overstates error
NEES formula and its three regimes. For an n-dimensional state vector, NEES follows a chi-squared distribution with n degrees of freedom. The expected value is n — for a 1D filter, NEES = 1. For FollowBot's 5D EKF, the expected NEES is 5.

In a filter running at 100 Hz over 60 seconds, you have 6,000 NEES samples. You do not inspect them one by one — you use the time-averaged NEES and compare it to the chi-squared confidence interval. The standard practice (from Bar-Shalom's textbook on estimation) is to flag the filter as inconsistent if the mean NEES falls outside the 95% confidence interval of chi-squared(n)/N. For most practical robotics purposes, "NEES > 2n or NEES < n/2" is a simple red-flag rule.

🔑 NEES needs ground truth — and that is the catch

Computing NEES requires knowing the true state xₖ, which you normally do not have in deployment. The correct workflow: validate the filter during development using a simulation or mocap lab where ground truth is available. Fix Q and R until NEES is consistent across your full operating envelope. Then freeze Q and R and ship. Do not tune Q and R in the field without ground truth — you are just tuning by eye again, which is what this test was designed to replace. In the simulation-to-real gap for FollowBot, this means explicitly testing the filter in Gazebo (where ground truth is cheap) before trusting it on hardware.

The sister metric, NIS (Normalized Innovation Squared), does not require ground truth — it only needs the innovation and the predicted innovation covariance, both of which the filter computes internally. NIS should also be ≈ 1 for a consistent filter. NIS can be computed in deployment, making it useful for online monitoring. When NIS spikes persistently, the filter is out of consistency — possible causes include sensor failure, a new environment type (e.g. suddenly driving on soft carpet when Q was calibrated on hard tile), or actuator failure.

nees_check.pyPython · filter consistency validation
import numpy as np

def compute_nees(x_est: np.ndarray, P_est: np.ndarray,
                  x_true: np.ndarray) -> float:
    """NEES for a single timestep.
    x_est: (n,) estimate; P_est: (n,n) covariance; x_true: (n,) ground truth.
    Returns scalar NEES. Expected value = n for a consistent filter."""
    e = x_est - x_true                           # estimation error
    try:
        P_inv = np.linalg.inv(P_est)
    except np.linalg.LinAlgError:
        return float('nan')
    return float(e @ P_inv @ e)

def nees_consistency_check(nees_series: np.ndarray,
                             n_states: int,
                             alpha: float = 0.05) -> dict:
    """Check filter consistency via time-averaged NEES.
    nees_series: array of scalar NEES values over time.
    n_states: state dimension (expected NEES = n_states for consistent filter).
    alpha: significance level for chi-squared bounds.
    Returns dict with mean_nees, is_consistent, and 95% bounds."""
    from scipy.stats import chi2
    N = len(nees_series)
    mean_nees = float(np.nanmean(nees_series))
    # chi-squared confidence interval for mean NEES (sum of N chi2(n) ÷ N)
    lo = chi2.ppf(alpha / 2,  df=N * n_states) / N
    hi = chi2.ppf(1 - alpha / 2, df=N * n_states) / N
    return {
        'mean_nees':      mean_nees,
        'expected':        n_states,
        'bounds_95':       (lo, hi),
        'is_consistent':   lo <= mean_nees <= hi,
        'verdict': ('consistent' if lo <= mean_nees <= hi
                    else ('overconfident' if mean_nees > hi else 'conservative'))
    }

FOLLOWBOTTuning the EKF on FollowBot: the full pipeline

FollowBot's EKF state vector is [x, y, θ, v, ω] — five dimensions. This means the expected NEES is 5. The filter fuses wheel odometry (odom topic), IMU (imu/data), and LIDAR scan-matching (a /scan_match_pose estimate). Each sensor has its own R matrix, and the 5×5 Q must cover all unmodelled dynamics in the 2D plane.

🔑 Stage 4 milestone

Full EKF operational on FollowBot: state vector [x, y, θ, v, ω], fusing wheel odometry + IMU + LIDAR scan-matching updates. Filter consistency validated with NEES test on recorded bag data. Robot localizes in a known map with position error below 0.1 m RMS. Sensor dropout behavior characterized and documented.

Here is the recommended order of operations for FollowBot's EKF tuning:

1

Calibrate R for each sensor independently

Record the robot stationary for 60 seconds. Compute the variance of the odometry velocity signal (R_odom for v and ω channels), the IMU angular rate and linear acceleration (R_imu), and the scan-match pose output (R_scan for x, y, θ). These static-condition variances are your R diagonal entries. Double them as a working default to account for dynamic noise.

2

Set Q using van Loan initialization

For FollowBot at Δt = 0.02 s (50 Hz EKF), estimate worst-case acceleration: linear ~0.5 m/s², angular ~1.0 rad/s². Q_pos ≈ (0.5 × Δt²)² × σ_a² ≈ 1×10⁻⁷ for position states. Q_vel ≈ (Δt × σ_a)² ≈ 1×10⁻⁴ for velocity states. Q_theta is set independently based on observed gyro drift: typically ~5×10⁻⁶ rad²/step for a MEMS IMU. These are starting points, not final values.

3

Run NEES validation in Gazebo

In simulation, ground truth is free from the /ground_truth topic. Drive FollowBot through a figure-8 pattern (exercises all dimensions of the state). Record a bag file. Post-process: compute NEES at each timestep, plot mean NEES, check against chi-squared(5) 95% bounds. Iterate Q until NEES is consistent. Typical iteration count: 5–15 rounds.

4

Validate sensor dropout robustness

Disconnect the scan-match topic (simulate LIDAR failure) for 3 seconds mid-run. The EKF should fall back to odometry + IMU fusion; covariance in x, y, θ should grow at the rate dictated by Q; when scan-match returns, the filter should re-acquire with ≤2× the normal NEES transient. If the filter rejects the returning scan-match measurement (innovation exceeds the gating threshold because covariance grew too slowly — i.e. Q too small during dropout), Q must be increased for the θ, x, y rows.

5

Monitor NIS in deployment

On hardware, ground truth is unavailable. Log the NIS for each sensor update. If mean NIS for any sensor drifts above 2×n_meas (where n_meas is the measurement dimension for that sensor), the filter is losing consistency in deployment — possible causes: floor surface changed (increase Q), sensor mounting shifted (recalibrate R), or a new environmental condition (time to collect new calibration data).

The code for computing NIS inside a rclpy EKF node looks like this — call it in the update step after computing the Kalman gain:

ekf_node.py (excerpt)rclpy · NIS online monitoring
def _update(self, z: np.ndarray, H: np.ndarray, R: np.ndarray):
    # innovation + innovation covariance
    nu = z - H @ self.x_hat              # innovation vector
    S  = H @ self.P @ H.T + R           # innovation covariance

    # Normalized Innovation Squared — monitor online
    try:
        nis = float(nu @ np.linalg.inv(S) @ nu)
    except np.linalg.LinAlgError:
        nis = float('nan')

    expected_nis = z.shape[0]           # = measurement dimension
    if nis > 3.0 * expected_nis:
        self.get_logger().warn(
            ff'NIS={nis:.2f} (expected≈{expected_nis}) — filter may be inconsistent'
        )

    # Kalman gain + state update (standard)
    K = self.P @ H.T @ np.linalg.inv(S)
    self.x_hat = self.x_hat + K @ nu
    self.P     = (np.eye(len(self.x_hat)) - K @ H) @ self.P

WEAKNESSWhere Kalman tuning reliably bites

✗ Tuning by visual smoothness — the most common mistake

The output of an overconfident filter looks smooth. That is the problem. If you tune Q and R by looking at the estimated trajectory and deciding it "looks about right," you are selecting for smoothness, not correctness. A filter with Q = 10⁻⁸ (far too small) will produce a beautiful, steady estimated pose in a benign environment. The moment the robot encounters an unmodelled floor bump, a sharp turn, or a sensor spike, the covariance is so collapsed that the filter cannot respond. The estimate diverges while the robot's stated confidence remains high. Tune with NEES, not eyes.

✗ Copying Q and R from a different robot or a tutorial

Q and R are not universal constants. They depend on the sensor hardware, the motor characteristics, the floor surface, the operating speed, the timestep, and the model structure. A Q matrix from a ground-vehicle tutorial will be wrong by orders of magnitude if applied to an aerial vehicle, a different floor type, or even a different operating speed profile. Every robot and operating condition requires its own calibration pass. "It worked in the tutorial" is not a validity argument.

✗ Forgetting that Q and R interact — the banana-shaped confidence region

Q and R are not independent tuning knobs. The Kalman gain K = P⁻Hᵀ(HP⁻Hᵀ + R)⁻¹ makes the steady-state filter behavior depend on the ratio Q/R, not on Q or R individually. A consistent filter can be achieved with (Q=0.01, R=1.0) and with (Q=1.0, R=100), if the ratio is similar. What differs is the filter's transient response and its bandwidth. High Q/R → fast, jittery filter that reacts quickly to state changes. Low Q/R → slow, smooth filter that may lag dynamic events. Both may pass NEES. Choose based on the temporal dynamics of your application: a slow-moving target needs low Q/R; a fast-moving or dynamic system needs high Q/R.

KEY INSIGHTHow this connects

The discipline of NEES testing is not specific to the Kalman filter — it applies to any filter that maintains a covariance estimate (EKF, UKF, particle filter weights). When you build the particle filter in Lesson 4.7, the same consistency question applies: are the particles spread in proportion to the actual uncertainty? The formal test differs (effective sample size rather than NEES) but the intuition is identical: a filter that understates uncertainty is dangerous regardless of what algorithm produces it.

GLOSSARYKey terms introduced

Process noise covariance (Q)
The matrix added to the propagated covariance at each prediction step. It encodes both physical disturbances and the uncertainty introduced by model simplification. Q too small produces overconfident, slow-to-react filters; Q too large produces jittery filters with unnecessarily wide covariance bands.
Measurement noise covariance (R)
The covariance matrix describing sensor measurement noise. Set from static calibration experiments, sensor datasheets (with safety factors), or in-motion calibration against a reference sensor. R directly controls the Kalman gain: large R → small gain → filter trusts prediction; small R → large gain → filter trusts measurement.
NEES (Normalized Estimation Error Squared)
The quantity ε̃ₖ = ẽₖᵀPₖ⁻¹ẽₖ, where ẽₖ is the estimation error and Pₖ is the filter covariance. For a consistent n-dimensional filter, mean NEES ≈ n. NEES >> n indicates overconfidence (P understates error); NEES << n indicates over-conservatism. Requires ground truth to compute.
NIS (Normalized Innovation Squared)
Like NEES but computed from the filter's own innovation νₖ and innovation covariance S: NIS = νₖᵀSₖ⁻¹νₖ. Does not require ground truth; can be computed in deployment. A consistent filter has mean NIS ≈ measurement dimension. Used for online monitoring of filter health.
Filter consistency
The property that a filter's stated covariance P matches its actual estimation error statistics. A consistent filter is neither overconfident nor over-conservative. NEES and NIS are the standard tests for consistency.
Innovation whiteness
The property that the filter's innovations (prediction residuals) are uncorrelated in time and zero-mean. White innovations indicate the filter is correctly absorbing all predictable information. Correlated innovations indicate the model or Q is missing systematic dynamics.
Covariance inflation
A pragmatic robustness fix: multiply the covariance P by a factor α > 1 at each timestep, ensuring P does not collapse to near-zero. Compensates for Q underestimation or unmodelled environment changes. A practical patch — the correct fix is to tune Q properly, but inflation prevents catastrophic filter divergence in field deployment.
Van Loan method
An analytical method for computing the discrete-time process noise covariance Q from the continuous-time noise spectral density. Gives a principled starting point for Q based on the physical noise sources and the discretization timestep, without requiring empirical trial-and-error from scratch.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1Why is "process noise covariance" a misleading name for Q, and what does Q actually encode?›

The name suggests Q describes physical disturbances — vibrations, gusts, bumps. Those are real, but they are typically a small fraction of what Q must cover. The larger contributor is modelling gap: the error introduced when a simplified model (e.g. constant velocity) approximates a more complex real system (e.g. a differential-drive robot with slip, tire dynamics, and floor heterogeneity). Q also absorbs discretization error from the ZOH approximation. Calling it "process noise" tempts engineers to estimate Q from physical noise measurements, which systematically underestimates it. A better mental model: Q is your honest admission of how much your model can be wrong per timestep. If you trust your model completely, Q → 0 and the filter becomes overconfident. Q must grow every time you simplify the model.

2FollowBot's EKF looks great visually — smooth trajectory, small covariance band. Why might this still be dangerous, and what test would you run to check?›

A smooth trajectory with a small covariance band is exactly what an overconfident filter produces. If Q is too small, the covariance P collapses and the Kalman gain drops near zero. The filter ignores new measurements and propagates its prior forward smoothly — the estimate looks great in benign conditions. When an unmodelled event occurs (floor bump, sharp turn, person accelerates suddenly), the filter's low gain prevents it from correcting, and the true error grows while P remains small. The robot believes it knows its position with ±2 cm accuracy when the true error is 30 cm. The test is NEES: run the filter in simulation or mocap, compute ẽₖᵀPₖ⁻¹ẽₖ at each step, and check that mean NEES ≈ 5 (for the 5D EKF). If mean NEES >> 5, the filter is inconsistent regardless of how it looks visually.

3How does setting R too small differ in failure mode from Q too small? Give the symptom signature of each.›

R too small makes the filter overtrust measurements. The Kalman gain K approaches 1, meaning the estimate is essentially set to the latest measurement. The observable symptom is jitter — the estimate jumps with every noisy reading. During a sensor spike (IMU bump, encoder glitch), the state estimate spikes too. The failure is noisy and usually visible immediately. Recovery is fast once the noise subsides. Q too small makes the filter overtrust the model. The gain K collapses toward 0, measurements are largely ignored, and the estimate tracks the model prediction smoothly. The observable symptom is lag: the estimate fails to follow rapid state changes. The failure is silent and insidious — the filter looks fine until a dynamic event (person sprints, robot turns hard) exposes the gap between estimate and reality. NEES is high for Q-small failures but may not spike visually until the divergence becomes large. Q-small is the more dangerous failure mode because it hides better.

4Why can you use NIS for online monitoring in deployment, but not NEES? What would a persistent NIS spike on the scan-match update tell you to investigate?›

NEES requires the true state xₖ to compute the estimation error ẽₖ = x̂ₖ − xₖ. In deployment, ground truth is unavailable. NIS = νₖᵀSₖ⁻¹νₖ uses only the filter's own innovation νₖ = zₖ − Hx̂⁻ₖ and the predicted innovation covariance Sₖ = HP⁻Hᵀ + R — both of which the filter computes internally. A consistent filter has mean NIS ≈ measurement dimension. A persistent NIS spike on the scan-match update (the LIDAR pose correction) specifically suggests: (1) the scan-match sensor's measurement noise R is underestimated for current conditions (e.g. a featureless corridor is generating noisier scan matches than calibrated), (2) the robot is in a part of the map where the map is stale or the environment has changed (furniture moved), or (3) Q is too small for the θ/x/y states — the filter's predicted covariance P⁻ is too narrow, making S too small and inflating NIS. Investigate in that order: check environment first, recalibrate R_scan, then adjust Q.

Next: the Extended Kalman Filter — handling nonlinear motion and observation models →