NOTE / 7/1/2020
IMU & GPS Localization: Quaternion Kinematics for ESKF, Part 3
I recently finished reading Quaternion Kinematics for the Error-State Kalman Filter and implemented an IMU+GPS integrated localization system using its method.
1. Principles
1.1 Coordinate frames
The global frame is East-North-Up (ENU): X points east, Y points north, and Z points upward. Its origin is the initial position. There is an extrinsic transformation from GPS to IMU, namely the GPS position in the IMU frame, ; this is the lever-arm value.
1.2 Error state
The filter maintains five state groups—position, velocity, orientation, accelerometer bias, and gyroscope bias—for a total of 15 dimensions:
Gravity direction is not included in the state because the ENU frame is used directly; gravity is set along negative Z.
As described in the book, the IMU performs EKF prediction. Both the nominal state and the error-state covariance are propagated (see pp. 58–59):
1.3 ESKF GPS update
GPS provides position measurements. GPS normally reports WGS84 coordinates, while the state is expressed in ENU. Following the approach in VINS-Fusion, I use GeographicLib to convert GPS measurements to the ENU Cartesian frame, . The GPS position observation equation is then:
The Jacobian with respect to the error state is:
The remaining step is the standard ESKF update (see p. 61 of the book).
1.4 Initialization
Initial position is zero. Roll and pitch are determined from the gravity direction measured by the accelerometer; biases start at zero.
2. Implementation
See GitHub:
3. Data
Recommended sequence:

4. References
- Quaternion Kinematics for the Error-State Kalman Filter.
- Woosik Lee, Intermittent GPS-aided VIO: Online Initialization and Calibration.
- A General Optimization-based Framework for Global Pose Estimation with Multiple Sensors.
- A General Optimization-based Framework for Local Odometry Estimation with Multiple Sensors.