Skip to content

Sensor Fusion Expert

Sensor fusion is the key technology for improving drone state estimation accuracy. In this project, you will learn how to develop multi-sensor data fusion systems.

  • Kalman Filter (KF) principles
  • Extended Kalman Filter (EKF)
  • Unscented Kalman Filter (UKF)
  • Multi-sensor fusion
ItemQuantityNotes
Fully Assembled Drone1With MPU6050, BMP280, VL53L0X sensors
Computer1With VS Code + ESP-IDF environment
USB Cable1For programming

The goal of sensor fusion is to combine information from multiple sensors to obtain more accurate state estimation.

Common sensor fusion algorithms:

  • Kalman Filter (KF)
  • Extended Kalman Filter (EKF)
  • Unscented Kalman Filter (UKF)
  • Particle Filter (PF)

Select sensor fusion algorithm suitable for drones, such as EKF (for nonlinear systems).

Design state vector and observation vector, establish system model.

Create a new estimator file in components/core/crazyflie/modules/src/estimator:

estimator_ekf.c
typedef struct {
float x[12]; // State vector
float P[12][12]; // Covariance matrix
float Q[12][12]; // Process noise covariance
float R[6][6]; // Measurement noise covariance
} EKF_State;
void ekf_predict(EKF_State *ekf, float dt) {
// Prediction step
// x = f(x, u)
// P = F * P * F' + Q
}
void ekf_update(EKF_State *ekf, float *measurement) {
// Update step
// K = P * H' * (H * P * H' + R)^-1
// x = x + K * (z - h(x))
// P = (I - K * H) * P
}
void ekf_fuse_sensors(EKF_State *ekf,
MPU6050_Data *imu,
BMP280_Data *baro,
VL53L0X_Data *tof) {
// Fuse IMU data
ekf_predict(ekf, 0.01);
// Fuse barometer data
float z_measurement[1] = {baro->altitude};
ekf_update(ekf, z_measurement);
// Fuse TOF data
float tof_measurement[1] = {tof->distance};
ekf_update(ekf, tof_measurement);
}
  1. Compile and flash the code
  2. Flight test, compare state estimation accuracy between new estimator and original estimator
  • Check noise covariance matrices Q and R
  • Confirm sensor data quality
  • Optimize algorithm calculation efficiency
  • Reduce state vector dimension

Congratulations! You have mastered the core technology of sensor fusion, which is the key to drone state estimation!

In the next project, you will learn how to use camera optical flow data for indoor positioning.