HomeEKF Localizer
Core Modules

EKF Localizer

EKF Localizer

EKF Localizer is the core fusion node of the localization system. It receives low-frequency absolute poses from localization sources like NDT and high-frequency relative motion from Gyro Odometer, outputting smooth, high-frequency (50 Hz) kinematic states through Extended Kalman Filtering.

EKF Fusion Visualization

EKF Multi-sensor Fusion Diagram

State Vector & Motion Model

Info

State vector x = [x, y, yaw, yaw_bias, v_x, w_z]ᵀ — 6-dimensional state including position, heading, heading bias, longitudinal velocity, and yaw rate.

Prediction Model
text
x(k+1) = x(k) + v_x(k) * cos(yaw(k)) * dt
y(k+1) = y(k) + v_x(k) * sin(yaw(k)) * dt
yaw(k+1) = yaw(k) + w_z(k) * dt
yaw_bias(k+1) = yaw_bias(k)
v_x(k+1) = v_x(k)
w_z(k+1) = w_z(k)

Algorithm Flow

100%

No

Yes

Yes

Reject

Accept

No

Yes

Reject

Accept

No

Timer Tick
(50 Hz)

Node Active?
Initial Pose Set?

Wait for
Initialization

Predict Step
x̂ = f(x̂, dt)
P = F·P·Fᵀ + Q

Pose Queue
Non-empty?

Delay Compensation:
Find Historical State

Mahalanobis Gate
d² < pose_gate_dist?

Log Outlier
Skip Update

Smooth Update
(pose_smoothing_steps)

x̂ = x̂ + K·(z - H·x̂)
P = (I - K·H)·P

Process Twist Queue

Twist Available?

Mahalanobis Gate
d² < twist_gate_dist?

Log Outlier

Twist Update
x̂ = x̂ + K·(z - H·x̂)

Publish Results

ekf_pose_with_covariance
ekf_twist_with_covariance
TF: map → base_link
Diagnostics

EKF Localizer Predict-Update Cycle

Key Mechanisms

Warning

Mahalanobis Gating: Computes the Mahalanobis distance of the innovation vector d² = yᵀ S⁻¹ y. Measurements exceeding the threshold are rejected. This is critical for preventing pose jumps caused by NDT mismatches in repetitive scenarios.

Delay Compensation uses a fixed-lag smoothing approach. The EKF maintains a historical state queue (default 50 steps). When a measurement with a past timestamp is received, it is applied to the corresponding historical state, then the state is recomputed to the current time.

Smooth Update divides a single measurement into multiple small steps for gradual fusion, preventing state jumps from low-frequency measurements.

ROS 2 Interfaces

DirectionTopicMessage TypeDescription
Submeasured_pose_with_covariancePoseWithCovarianceStampedAbsolute pose from NDT etc.
Submeasured_twist_with_covarianceTwistWithCovarianceStampedTwist from Gyro Odometer
SubinitialposePoseWithCovarianceStampedInitial pose
Pubekf_odomOdometryFused odometry
Pubekf_posePoseStampedFused pose
Pubekf_pose_with_covariancePoseWithCovarianceStampedFused pose (with covariance)
Pubekf_twistTwistStampedFused velocity
Pubekf_twist_with_covarianceTwistWithCovarianceStampedFused velocity (with covariance)
TFmap → base_linkCoordinate transform

Key Parameters

ParameterDefaultDescription
predict_frequency50.0 HzPrediction frequency
extend_state_step50Delay compensation history steps
enable_yaw_bias_estimationtrueEnable heading bias estimation
pose_smoothing_steps5Pose smoothing steps
twist_smoothing_steps2Twist smoothing steps
pose_gate_dist49.5Pose Mahalanobis distance gate
twist_gate_dist46.1Twist Mahalanobis distance gate
proc_stddev_vx_c10.0Longitudinal acceleration process noise
proc_stddev_wz_c5.0Angular acceleration process noise
proc_stddev_yaw_c0.005Heading process noise