![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Multi-rate estimation pipeline, WITHOUT any HAL or RTOS dependency. More...
#include <stdint.h>#include <stddef.h>#include "iekf.h"#include "accwin.h"#include "calib.h"#include "imu_lsm6dsv16x.h"Go to the source code of this file.
Data Structures | |
| struct | est_config_t |
| struct | est_trace_t |
| struct | est_t |
Macros | |
| #define | EST_F_RUNNING 0x01u |
| #define | EST_F_MAG_NEW 0x02u |
| #define | EST_F_ACC_GATED 0x04u |
| #define | EST_F_MAG_GATED 0x08u |
| #define | EST_F_STILL 0x20u |
| stillness detector active | |
| #define | EST_TRACE_MAX 140u |
| #define | EST_OP_PROP 0x50u |
| 'P' | |
| #define | EST_OP_ACC 0x41u |
| 'A' | |
| #define | EST_OP_MAG 0x4Du |
| 'M' | |
Typedefs | |
| typedef void(* | est_cb_t) (const est_t *e, void *user) |
Functions | |
| void | est_init (est_t *e, const est_config_t *cfg, est_cb_t on_state, est_cb_t on_init, void *user) |
| void | est_process (est_t *e, const imu_event_t *ev, size_t n, float dt_sample) |
| dt_sample: IMU sample period measured by the MCU (s) | |
Multi-rate estimation pipeline, WITHOUT any HAL or RTOS dependency.
It receives the FIFO events in the order the sensor wrote them (gyro, acc, mag) and decides by itself what to do and when:
gyro (ODR) : accumulate dtheta; every gyro_per_step samples -> step step (960 Hz) : IEKF propagation, accwin_rotate, ctrl_rate_step() every steps_per_acc: rotated acc mean -> acc update, ctrl_attitude_step(), steps (240 Hz) telemetry callback mag (~50-100 Hz) : mag update (sample already de-duplicated by the driver)
Before starting it runs the static calibration (calib.c): sigmaAcc/sigmaMag are estimated on the windowed acc mean, i.e. exactly on the quantity that later enters the update.
Being pure, the same pipeline runs in the firmware and in the PC test.
Definition in file est_pipeline.h.
| #define EST_F_RUNNING 0x01u |
Definition at line 30 of file est_pipeline.h.
| #define EST_F_MAG_NEW 0x02u |
Definition at line 31 of file est_pipeline.h.
| #define EST_F_ACC_GATED 0x04u |
Definition at line 32 of file est_pipeline.h.
| #define EST_F_MAG_GATED 0x08u |
Definition at line 33 of file est_pipeline.h.
| #define EST_F_STILL 0x20u |
stillness detector active
Definition at line 34 of file est_pipeline.h.
| #define EST_TRACE_MAX 140u |
Definition at line 70 of file est_pipeline.h.
| #define EST_OP_PROP 0x50u |
'P'
Definition at line 71 of file est_pipeline.h.
| #define EST_OP_ACC 0x41u |
'A'
Definition at line 72 of file est_pipeline.h.
| #define EST_OP_MAG 0x4Du |
'M'
Definition at line 73 of file est_pipeline.h.
| typedef void(* est_cb_t) (const est_t *e, void *user) |
Definition at line 82 of file est_pipeline.h.
| void est_init | ( | est_t * | e, |
| const est_config_t * | cfg, | ||
| est_cb_t | on_state, | ||
| est_cb_t | on_init, | ||
| void * | user | ||
| ) |
Definition at line 23 of file est_pipeline.c.
References accwin_reset(), calib_reset(), on_init(), and on_state().
Referenced by ImuTask(), and take_calibrations().
| void est_process | ( | est_t * | e, |
| const imu_event_t * | ev, | ||
| size_t | n, | ||
| float | dt_sample | ||
| ) |
dt_sample: IMU sample period measured by the MCU (s)
Definition at line 155 of file est_pipeline.c.
References accwin_add(), IMU_EV_ACC, IMU_EV_GYRO, IMU_EV_MAG, n, on_acc_window(), on_mag(), on_step(), and imu_event_t::v.
Referenced by ImuTask().