ProjekinAja. Robotics Stage 2 · Kinematics Lesson 2.2
● Stage 2 · Lesson 2.2

Wheel Odometry: Integration, Drift, and Dead Reckoning

Odometry is always wrong — the question is how wrong, how fast, and whether your estimator accounts for it.

⏱ ~22 min read 📐 State estimation ⚠ Failure-mode critical

🎯 By the end you'll understand

How encoder ticks are integrated into a 2D pose — and why that integration accumulates error. Why odometry drift is proportional to distance traveled and grows faster during turns. What the odometry covariance matrix actually represents, and how setting it dishonestly destroys downstream filter performance. What the zero-velocity update is and when it buys you free accuracy. And the specific failure mode — setting covariance too small — that causes an EKF to trust dead-reckoning over sensor measurements, silently diverging in long corridors.

KEY INSIGHTDead reckoning accumulates — it never self-corrects

A ship's navigator using dead reckoning knows that each hour of sailing doubles the circle of uncertainty on the chart. Odometry is dead reckoning with wheel encoders — it has the same fundamental property: error grows, and it grows fastest when you turn.

Dead reckoning is the practice of estimating current position by starting from a known position and integrating velocity over time. Wheel odometry is the robotics incarnation: count the encoder ticks from each wheel, convert to wheel displacements, apply the differential-drive kinematic model from Lesson 2.1, and integrate the resulting robot velocity into a pose estimate. It is cheap, always available, and completely self-contained. It is also always wrong, and becomes more wrong the longer it runs.

🔑 The load-bearing insight

Odometry errors are not independent between time steps. Each integration step adds a small error to the previous pose, and the next step integrates from that already-wrong pose. This is error accumulation: the total position error at time t is the sum of all per-step errors up to t. For straight-line travel, position error grows roughly linearly with distance. For rotational motion, heading error — even tiny heading error — introduces a growing transverse position error that grows quadratically with distance. This is why roboticists treat the covariance matrix not as a formality but as the primary design parameter of any odometry-based navigation system.

HOW IT WORKSPose integration from encoder ticks

The kinematic model from Lesson 2.1 gives us the robot's body-frame velocity (v, ω) from wheel velocities. Odometry adds one more step: integrating those velocities over time to track the robot's pose (x, y, θ) in the world frame. Here is the full pipeline:

1

Encoder ticks → wheel displacements

Each encoder produces N ticks per wheel revolution (FollowBot uses quadrature encoders at 1000 ticks/rev). At each timestep Δt, read tick counts ΔnL and ΔnR. Convert to linear wheel displacements:

dL = (ΔnL / N) · 2πr     dR = (ΔnR / N) · 2πr

where r is the wheel radius. FollowBot: N = 4000 (1000 PPR × 4× decoding), r = 0.0325 m → 1 count ≈ 0.051 mm of travel. Quantization from rounding to integer counts introduces error at this step — it cannot be eliminated, only modeled.

2

Wheel displacements → body-frame motion

Apply the differential-drive model:

dc = (dR + dL) / 2     Δθ = (dR − dL) / b

where b is the wheel baseline (distance between wheels). dc is the center-point linear displacement; Δθ is the heading change. The baseline b is a calibration parameter — a 1% error in b produces a ~1% error in heading per revolution, which compounds into large position errors on a long, turn-heavy path.

3

Body-frame motion → world-frame pose update (Euler integration)

The simplest integration scheme uses the robot's current heading θ to project body-frame motion into world-frame displacement:

x' = x + dc · cos(θ + Δθ/2)
y' = y + dc · sin(θ + Δθ/2)
θ' = θ + Δθ

This is actually the mid-point (Runge-Kutta 2) integration, which evaluates heading at the midpoint of the turn rather than at the start. Pure Euler integration uses cos(θ) and sin(θ) — it is first-order accurate and larger discretization errors accumulate at higher timesteps. Mid-point integration is second-order accurate and is what nav_msgs/Odometry publishers should use. FollowBot's odometry node uses mid-point integration.

💡 Why mid-point integration matters at coarse timesteps

At 100 Hz (Δt = 10 ms), Euler and mid-point integration produce nearly indistinguishable results for any realistic robot speed. At 10 Hz (Δt = 100 ms), the difference becomes material during turns. If your odometry publisher runs at 10 Hz — common when the driver is a slow serial link — use mid-point or RK4. If your publisher runs at 50+ Hz, Euler is fine, but mid-point is still the correct choice and adds zero computational cost.

true path Euler (θ at step start) mid-point (θ + Δθ/2) start error
Euler integration takes straight-line steps using the heading at the start of each interval. Mid-point integration uses the average heading across the interval, tracking curves more closely. At coarse timesteps, the Euler error accumulates.

CORE CONCEPTWhy drift compounds — and turns make it worse

Let's be precise about the error sources and how they compound:

Error source Mechanism Effect Proportional to
Wheel slipEncoder ticks increment but wheel moves laterally, not forwardOverestimates displacementFloor friction, speed, payload
Encoder quantizationFractional tick ignored; accumulated over many stepsLow-frequency biasWheel radius, encoder resolution
Baseline calibration errorMeasured b ≠ effective kinematic baselineHeading error per revolutionBaseline error · turns
Wheel radius mismatchLeft and right radii differ (manufacturing, tire wear, inflation)Heading drift on straight pathsRadius difference · distance
Discretization errorIntegration timestep too coarseArc approximated by chordsSpeed · Δt² · angular rate

The heading error is the most destructive. Here is why. Suppose heading error has accumulated to angle ε. From this point, every forward motion of distance d adds a transverse position error of d · sin(ε) ≈ d · ε for small ε. That means transverse position error grows linearly with distance from the moment the heading error appears. Heading errors that accumulate over a turn compound with the subsequent straight travel — the product is quadratic total position error. In a corridor (lots of straight travel after the turns), the heading error from turning is what kills you.

📖 Dead reckoning error model

The standard model for differential-drive odometry error (from Borenstein & Feng, 1996, updated in many robotics texts) expresses the standard deviation of position error as proportional to distance traveled: σpos ≈ kd · d, where kd is a robot-specific constant typically in the range 0.01–0.05 (1–5% of distance). Heading error σθ ≈ kθ · |Δθ| is proportional to total turning angle. These constants must be measured, not assumed — set them on your particular floor surface, at your particular robot speed.

This error model directly informs the odometry covariance matrix. If you set the covariance smaller than these empirically measured values, your EKF will believe odometry is more accurate than it is. The consequence — explored in the mistake section and the widget — is catastrophic in long corridors.

SEE ITOdometry drift visualizer — FollowBot on a square path

FollowBot runs repeated square laps (2 m × 2 m). Set the encoder resolution, wheel slip probability, and integration timestep. Watch the estimated pose diverge from ground truth. Then set the odometry covariance and observe how a downstream EKF weights this source relative to a sensor measurement. The worst choice is not the noisiest — it is the one where you lie about the noise.

⚙ Interactive · Odometry Drift Visualizer

Tune the three parameters, then run the simulation. The key question: when does the EKF stop trusting odometry?

—
—
—
—
—
—
Odometry covariance declaration (what you tell the EKF)
—
—
σ_x
—
σ_y
—
σ_θ
—
—
Final position error
—
Heading error at end
—
EKF odometry weight

Select parameters and run the simulation to observe drift accumulation.

The critical asymmetry in the covariance tuner: if you report higher covariance than real (honest or conservative), the EKF down-weights odometry and relies more on sensor measurements — this is safe, though slightly suboptimal. If you report lower covariance than real (optimistic lie), the EKF trusts odometry more than it deserves, ignores sensor corrections, and the state estimate diverges silently. This is the most common EKF misconfiguration in field robotics.

CORE CONCEPTThe odometry covariance matrix — what it means and how to set it

The ROS 2 nav_msgs/Odometry message contains a 6×6 pose covariance matrix. For a 2D differential-drive robot, only the 3×3 subblock for (x, y, θ) is meaningful — the out-of-plane degrees of freedom are either zero or unconstrained. Here is what the diagonal terms represent:

Term Physical meaning Typical starting value How it grows
cov[0,0] (σ²x)Variance in x position (forward/back)0.001 m²Linear with distance traveled
cov[1,1] (σ²y)Variance in y position (lateral)0.001 m²Linear with distance, quadratic with turns
cov[5,5] (σ²θ)Variance in yaw (heading)0.0001 rad²Linear with total turning angle

The off-diagonal terms encode correlations. For odometry, the most important correlation is between y-position error and heading error — a heading error ε that has persisted for distance d creates a correlated y-error of roughly d·ε. In ROS 2's robot_localization EKF node, these correlations matter because the filter uses the full covariance matrix in its update step, not just the diagonal.

There is no universal "correct" value. The right approach is to measure it empirically on your specific robot on your specific floor surface:

1

Drive a known path repeatedly

Program FollowBot to drive a 5 m straight line using odometry alone. Measure the actual final position (with a tape measure or motion capture). Do this 20–30 times. The sample variance of the position errors gives you σ²x and σ²y for that path length on that surface.

2

Measure heading error

Drive full rotations in place (360°) using odometry. Measure the actual heading change (again, with an external reference). The variance of the heading error gives σ²θ per radian of turn.

3

Scale to per-meter and per-radian rates

Divide the measured variance by the path length (for position) or by the total turn angle (for heading) to get per-unit rates. Multiply by the expected timestep distances to get per-timestep covariance increments. These are the values you pass to robot_localization's odom0_config matrix.

4

Validate with filter consistency (NEES)

Run the EKF with a ground-truth reference (motion capture, AprilTag map, or AMCL with a precise map). Compute the Normalized Estimation Error Squared (NEES): e^T P^{-1} e where e is the error vector and P is the filter covariance. NEES should be chi-squared distributed with degrees-of-freedom equal to the state dimension. If NEES is consistently greater than the state dimension n (e.g., > 6 for a 6D state vector), your covariance is too small (optimistic). If it is consistently less than n, it is too large (pessimistic). The goal is NEES ≈ n — an honest, calibrated filter.

🔑 Conservative beats optimistic, always

If you must choose between a covariance that is slightly too large and one that is slightly too small, always choose too large. An overconfident filter (small covariance, lies about accuracy) rejects legitimate sensor corrections and can diverge silently. An underconfident filter (large covariance, acknowledges uncertainty) accepts sensor corrections freely, which is conservative but stable. In practice, real sensor measurements almost always dominate over odometry once the robot has traveled more than a few meters — the EKF naturally transitions from odometry-heavy early in a trajectory to sensor-heavy as odometry covariance grows. This only works correctly if the covariance was set honestly in the first place.

IN PRACTICEThe zero-velocity update — free accuracy while stationary

A zero-velocity update (ZUPT) is the simplest odometry correction available, and it costs nothing. The principle: when the robot is stationary, its true velocity is exactly zero. This is a direct, high-confidence measurement of the velocity state. Injecting this as an EKF measurement update resets velocity drift and, through the covariance propagation, can also constrain heading drift.

In ROS 2, implementing a ZUPT is straightforward: monitor the commanded velocity (/cmd_vel) and both encoder tick rates. If all three indicate zero (or very small) values for more than a threshold time (typically 0.5–1 s), publish a zero-velocity measurement with tight covariance:

zupt_publisher.pyrclpy · zero-velocity update
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import TwistWithCovarianceStamped

class ZuptPublisher(Node):
    # Publishes zero-velocity measurement when robot is stationary.
    # robot_localization's EKF fuses this to constrain velocity drift.
    def __init__(self):
        super().__init__('zupt_publisher')
        self.pub = self.create_publisher(
            TwistWithCovarianceStamped, '/zupt_velocity', 10
        )
        self.create_timer(0.1, self.cb)   # 10 Hz check
        self.stationary_ticks = 0

    def cb(self):
        # In production: subscribe to /cmd_vel + encoder rates.
        # Here we illustrate the zero-velocity message structure.
        if self._robot_is_stationary():
            msg = TwistWithCovarianceStamped()
            msg.header.stamp = self.get_clock().now().to_msg()
            msg.header.frame_id = 'base_link'
            # All velocity components are zero
            # Tight covariance: we are very confident we are stopped
            msg.twist.covariance[0]  = 1e-6  # σ²_vx
            msg.twist.covariance[7]  = 1e-6  # σ²_vy
            msg.twist.covariance[35] = 1e-6  # σ²_ωz
            self.pub.publish(msg)

    def _robot_is_stationary(self) -> bool:
        # Implement: check encoder tick rates < threshold
        # AND cmd_vel.linear.x ≈ 0 AND cmd_vel.angular.z ≈ 0
        # for at least 0.5 s (5 ticks at 10 Hz)
        return False  # stub — fill in

Add the ZUPT topic to robot_localization's config as a twist1 source with the twist1_config enabling only velocity dimensions. The filter handles the rest — when it receives zero velocity with tight covariance, it will treat this as a high-confidence measurement and pull the velocity estimate toward zero, also slightly improving position confidence through the cross-covariance terms.

💡 ZUPT is especially valuable for FollowBot

FollowBot frequently stops to wait for a person who has paused (sitting, using an elevator button, etc.). These stationary intervals are exactly when a ZUPT fires. The person-following behavior already knows when the robot is stopped — it is in the WAIT state of the behavior tree. Wiring a ZUPT publisher to the behavior tree's WAIT state output is a five-line change that measurably reduces heading drift over a long following session. The best free lunch in mobile robot navigation.

FOLLOWBOTImplementing the odometry node

The Stage 2 milestone requires FollowBot's odometry integration producing /odom. Building from the differential-drive kinematic model in Lesson 2.1, here is the complete odometry node that computes pose from encoder ticks and publishes the ROS 2 nav_msgs/Odometry message with honest covariance:

followbot_odom.pyrclpy · /odom publisher with honest covariance
import rclpy, math
from rclpy.node import Node
from nav_msgs.msg import Odometry
from geometry_msgs.msg import TransformStamped
import tf2_ros

# FollowBot physical parameters
WHEEL_RADIUS   = 0.0325   # m
WHEEL_BASELINE = 0.3000   # m  (calibrated, not nominal)
TICKS_PER_REV  = 4000     # 1000 PPR × 4× quadrature decoding
DIST_PER_TICK  = (math.tau * WHEEL_RADIUS) / TICKS_PER_REV  # ~0.051 mm

# Empirically measured covariance rates (carpet, indoor, 0.4 m/s)
K_D   = 0.025   # position noise coefficient (per metre)
K_TH  = 0.030   # heading noise coefficient (per radian of turn)

class FollowBotOdom(Node):
    def __init__(self):
        super().__init__('followbot_odom')
        self.pub = self.create_publisher(Odometry, '/odom', 50)
        self.tf_br = tf2_ros.TransformBroadcaster(self)
        # Pose state
        self.x = self.y = self.theta = 0.0
        # Cumulative covariance (grows with travel)
        self.sx2 = self.sy2 = 1e-4
        self.sth2 = 1e-5
        # Previous tick counts (initialised by driver on first message)
        self.prev_l = self.prev_r = None
        # Subscribe to raw encoder ticks from hardware driver
        self.create_subscription(  # msg: Int64MultiArray [ticks_L, ticks_R]
            __import__('std_msgs.msg', fromlist=['Int64MultiArray'])
                .Int64MultiArray,
            '/encoder_ticks', self.tick_cb, 100)

    def tick_cb(self, msg):
        tl, tr = msg.data[0], msg.data[1]
        if self.prev_l is None:
            self.prev_l, self.prev_r = tl, tr; return
        # Step 1: tick deltas → wheel displacements
        dl = (tl - self.prev_l) * DIST_PER_TICK
        dr = (tr - self.prev_r) * DIST_PER_TICK
        self.prev_l, self.prev_r = tl, tr
        # Step 2: body-frame motion
        dc   = (dl + dr) / 2.0
        dth  = (dr - dl) / WHEEL_BASELINE
        # Step 3: mid-point integration → world-frame pose
        mid  = self.theta + dth / 2.0
        self.x     += dc * math.cos(mid)
        self.y     += dc * math.sin(mid)
        self.theta += dth
        self.theta  = math.atan2(math.sin(self.theta),
                                   math.cos(self.theta))  # wrap to [-π,π]
        # Step 4: grow covariance honestly
        self.sx2  += K_D * abs(dc)
        self.sy2  += K_D * abs(dc)
        self.sth2 += K_TH * abs(dth)
        self._publish()

    def _publish(self):
        now = self.get_clock().now().to_msg()
        odom = Odometry()
        odom.header.stamp = now
        odom.header.frame_id = 'odom'
        odom.child_frame_id  = 'base_link'
        odom.pose.pose.position.x = self.x
        odom.pose.pose.position.y = self.y
        # quaternion from yaw
        odom.pose.pose.orientation.z = math.sin(self.theta / 2)
        odom.pose.pose.orientation.w = math.cos(self.theta / 2)
        # 6×6 covariance (row-major); only x, y, yaw diagonal filled
        odom.pose.covariance[0]  = self.sx2
        odom.pose.covariance[7]  = self.sy2
        odom.pose.covariance[35] = self.sth2
        self.pub.publish(odom)
        # Broadcast odom → base_link TF (required by Nav2 and RViz)
        tf = TransformStamped()
        tf.header.stamp = now; tf.header.frame_id = 'odom'
        tf.child_frame_id = 'base_link'
        tf.transform.translation.x = self.x
        tf.transform.translation.y = self.y
        tf.transform.rotation = odom.pose.pose.orientation
        self.tf_br.sendTransform(tf)

Three design choices above are non-obvious and worth examining:

  1. Growing covariance rather than fixed covariance. The covariance increases every step proportional to motion (K_D * abs(dc)). This reflects reality: uncertainty grows with travel. A fixed covariance implicitly assumes odometry is equally reliable at all distances — a lie that the EKF will exploit incorrectly.
  2. Heading wrap with atan2. Without the wrap, theta will drift past ±π and the trigonometry in the next step will use a wrong angle. This is a silent bug that only appears after many full turns.
  3. Publishing the TF transform. Nav2 requires the odom→base_link transform to exist in the TF tree. A node that publishes /odom but not the corresponding TF will cause cryptic "could not find transform" errors deep in the navigation stack.
🔑 Stage 2 milestone status

With this node running, FollowBot has: a differential-drive kinematic model (Lesson 2.1) → odometry integration producing /odom (this lesson) → arm FK and Jacobian (Lessons 2.3–2.5). The odometry node feeds into robot_localization's EKF (Stage 4), which fuses it with IMU and LIDAR scan matching to produce a globally consistent pose. The covariance values set here in K_D and K_TH will be the primary tuning parameters for that EKF in Stage 4 — they must be honest.

WEAKNESSWhere odometry bites — three real failure modes

✗ Covariance too small → EKF diverges silently in corridors

This is the canonical odometry failure. Set sx2 = 1e-6 instead of the empirically measured 0.001–0.01, and the EKF's information matrix weights odometry so heavily that scan-matching or AMCL corrections are effectively rejected as outliers — they fall outside the filter's innovation gate. The robot navigates confidently down a long corridor, accumulating 0.5 m of real position error while the filter reports 0.01 m uncertainty. At the corridor's end, when the robot turns and finally sees a distinctive feature, the correction is so large it exceeds the filter's gating threshold — it may be discarded entirely as a spurious measurement. The robot is now lost and does not know it. The fix requires a global localization recovery — and in a high-stakes deployment, that recovery may fail entirely. Always set covariance from measured data, and add 20% headroom.

✗ Encoding slip as zero-mean noise underestimates systematic error

Wheel slip does not produce zero-mean noise — it produces a systematic bias. When FollowBot accelerates hard, both wheels slip briefly, producing encoder ticks that overestimate forward travel. This overestimate always has the same sign (forward), so it is a bias, not noise. Modeling it as Gaussian noise (mean zero) in the covariance matrix is technically wrong: a biased measurement is not corrected by a larger variance, it is corrected by a better motion model or a tire model. In practice, the correct mitigation for FollowBot is to impose acceleration limits in the velocity controller (done in Stage 3) and to measure slip-induced bias on your specific floor as an additive correction to DIST_PER_TICK. If you skip this and only tune the covariance, the EKF will have a persistent forward-bias it cannot remove without an absolute position measurement.

✗ Publishing TF and odometry from different clocks

A subtle but brutal failure: the /odom message and the odom→base_link TF transform must carry the same timestamp. If you publish the odometry message at time t and the TF at time t + Δ (because the TF is published in a separate timer callback running at a different rate), Nav2 and RViz will attempt to look up the transform at a time that does not exist in the TF buffer and will throw "extrapolation into the past" errors — or silently interpolate from the wrong transform. Always publish the message and the TF with the same timestamp, generated by a single clock call at the top of the callback.

KEY INSIGHTHow this connects

  • 2.1 · Differential Drive Kinematics: FollowBot's Motion Model — odometry is built directly on the differential-drive kinematic model from 2.1. The forward model (wheel velocities → robot velocity) and the tick→displacement conversion both come from there. Without a calibrated baseline and wheel radius, odometry covariance cannot be set correctly.
  • 2.3 · Forward Kinematics and Denavit-Hartenberg Parameters — next up: the arm side of FollowBot's kinematics. Where wheel odometry estimates the base's pose from joint angles (wheel ticks), FK estimates the end-effector's pose from arm joint angles. The mathematical structure is different (screw theory vs. integration) but the core challenge is the same: accumulation of uncertainty through a kinematic chain.

Odometry is Stage 2's first state estimation problem. The full treatment — fusing odometry with IMU and LIDAR via the EKF — is Stage 4. But you cannot do Stage 4 correctly without understanding what odometry is actually producing and what its covariance honestly represents. The K_D and K_TH constants you calibrate now will be load-bearing inputs to the EKF in Stage 4. Bad values here propagate directly into a bad filter there.

GLOSSARYKey terms

Dead reckoning
Estimating current position from a known starting position by integrating measured velocity over time. Wheel odometry is dead reckoning using encoder ticks. Error accumulates and is never self-correcting without an absolute position reference.
Encoder resolution (counts/rev)
The number of encoder counts per complete wheel revolution after quadrature decoding. Higher resolution reduces quantization error per count but increases interrupt load on the microcontroller. FollowBot uses 1000 PPR encoders with 4× decoding → 4000 counts/rev, giving ~0.051 mm per count.
Euler integration
First-order integration that uses the state (e.g., heading) at the beginning of each timestep to project motion. Accumulates discretization error proportional to Δt². Acceptable at high rates (≥50 Hz); replaced by mid-point integration at lower rates.
Mid-point integration
Second-order Runge-Kutta integration that evaluates heading at the midpoint of each timestep (θ + Δθ/2). Better approximation of the true arc trajectory. The standard for ROS 2 odometry publishers, at negligible additional cost.
Odometry covariance matrix
A symmetric positive definite matrix quantifying the uncertainty in the odometry pose estimate. In ROS 2, this is the 6×6 pose.covariance field in nav_msgs/Odometry. Setting it too small causes EKF filter divergence; setting it large (conservative) is safe.
Zero-velocity update (ZUPT)
An EKF measurement update that injects a zero-velocity observation with tight covariance when the robot is confirmed stationary. Constrains velocity drift and, through cross-covariance terms, slightly reduces heading uncertainty. Free and highly effective for robots that stop frequently.
NEES (Normalized Estimation Error Squared)
A filter consistency metric: e^T P^{-1} e where e is the estimation error and P is the filter covariance. Expected value equals the state dimension n for a consistent filter. NEES > n indicates overconfidence (covariance too small); NEES < n indicates underconfidence.
Wheel slip
Occurs when the wheel rotates but the contact point translates laterally rather than rolling forward. Produces encoder ticks that overestimate forward displacement. Creates a systematic bias in odometry (not zero-mean noise). Mitigated by acceleration limits and floor-specific calibration.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1Why does a small heading error cause larger position error than the same magnitude of position error introduced directly?›

A direct position error of size ε is fixed — it does not grow unless another error is added. A heading error of size ε generates a transverse position error that grows linearly with subsequent travel distance: for every metre traveled after the heading error appears, the transverse position error grows by approximately ε metres (for small ε). Over a 20 m corridor with a 2° (0.035 rad) heading error, the transverse error reaches 0.7 m by the corridor's end — far larger than any single-step position quantization error. This is why calibrating the effective wheel baseline (which directly determines heading error per turn) is the highest-priority odometry calibration task, and why turning in long-corridor environments dramatically accelerates position drift.

2What is the concrete consequence of setting odometry covariance too small in an EKF that also receives LIDAR scan-matching measurements?›

A too-small odometry covariance tells the EKF that odometry is very accurate, so the filter assigns odometry high weight in the prediction step. When a LIDAR scan-matching measurement arrives suggesting a different pose, the Kalman gain (which balances prediction confidence against measurement confidence) weights the scan-matching result very low — it appears as a large, suspicious innovation relative to the filter's over-tight prediction uncertainty. If the innovation exceeds the filter's gating threshold (typically set at 3σ), the measurement is discarded as an outlier entirely. The robot then navigates on dead-reckoned odometry alone, accumulating real error while reporting false confidence. The failure is silent: the filter's reported uncertainty remains small because odometry is being trusted. The first symptom is often the robot crashing into a wall it believed it had cleared by 0.4 m.

3Why is mid-point integration more accurate than Euler integration, and at what update rate does the difference become negligible for a typical mobile robot?›

Euler integration approximates a curved arc (the robot's actual path during a turn) with a straight-line segment using the heading at the start of the timestep. The arc and the chord diverge by an amount proportional to the square of the timestep duration and to the angular rate — a second-order error. Mid-point integration uses the heading at the middle of the interval, which is a better approximation of the average heading during the arc. It reduces the integration error from O(Δt²) to O(Δt³). For a robot turning at 0.5 rad/s: at Δt = 100 ms (10 Hz), Euler introduces roughly 2.5 mm of chord-arc deviation per step; at Δt = 10 ms (100 Hz), that drops to ~0.025 mm — negligible. The practical threshold is around 50 Hz: above that, Euler and mid-point integration are indistinguishable for any realistic mobile robot speed. Below 50 Hz — common for serial-link motor drivers — use mid-point integration.

4What does a ZUPT actually do mathematically in the EKF, and why is it particularly valuable for a person-following robot like FollowBot?›

A ZUPT is a measurement update: the observation model is z = [0, 0, 0]^T (zero linear and angular velocity) with a tight covariance matrix Q_zupt. The EKF computes a Kalman gain that heavily weights this measurement (because Q_zupt is small). The update pulls the estimated velocity toward zero and reduces velocity covariance. Through the cross-covariance between velocity and pose in the joint state vector, this update also slightly reduces heading uncertainty. For FollowBot specifically: the robot frequently stops during the person-following mission — at doorways, elevators, when the person pauses. Every stop is a free, high-confidence zero-velocity observation. Without ZUPT, these stationary periods contribute no information. With ZUPT, every pause resets velocity drift and provides a heading "anchor." Over a 10-minute following session with many stops, ZUPT measurably reduces the cumulative heading error compared to odometry alone, with zero additional sensing hardware.

Next: arm kinematics — DH parameters transform joint angles into end-effector pose →