![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Phase-1 configuration: P-NUCLEO-WB55 (NUCLEO-WB55RG) + X-NUCLEO-IKS4A1 in Mode 3 (LSM6DSV16X is the sensor-hub master, LIS2MDL sits behind it). More...
Go to the source code of this file.
Macros | |
| #define | DEG2RAD_F 0.017453292519943295f |
| #define | APP_IMU_ODR IMU_ODR_960HZ |
| #define | APP_IMU_WATERMARK 4u |
| FIFO words: 2 gyro + 2 acc -> IRQ at 960 Hz. | |
| #define | APP_GY_LPF1_BW LSM6DSV16X_GY_LIGHT |
| gyro anti-alias filter: to be tuned | |
| #define | APP_XL_LPF2_ENABLE 1 |
| #define | APP_XL_LPF2_BW LSM6DSV16X_XL_STRONG |
| #define | APP_MAG_FAST 1 |
| LIS2MDL 100 Hz, hub 120 Hz: halves the age of mag data. | |
| #define | APP_STEP_HZ 960u |
| propagation + rate loop | |
| #define | APP_STEPS_PER_ACC 4u |
| -> 240 Hz acc update + attitude loop | |
| #define | APP_CALIB_SAMPLES 100u |
| mag samples at ~50 Hz -> ~2 s standing still | |
| #define | APP_CALIB_GYRO_STILL (5.0f * DEG2RAD_F) |
| #define | IEKF_SIGMA_GYRO (0.5f * DEG2RAD_F) |
| #define | IEKF_SIGMA_BIAS 1e-4f |
| #define | IEKF_SIGMA_VEC_MIN 0.01f |
| #define | IEKF_ACC_TOL 0.08f |
| #define | IEKF_MAG_TOL 0.08f |
| #define | IEKF_P0_ATT ((2.0f * DEG2RAD_F) * (2.0f * DEG2RAD_F)) |
| #define | IEKF_P0_BIAS ((0.2f * DEG2RAD_F) * (0.2f * DEG2RAD_F)) |
| #define | IEKF_ESTIMATE_BIAS 1 |
| #define | IEKF_ADAPTIVE 1 |
| #define | IEKF_TILT_COMP_MAG 1 |
| #define | IEKF_ACC_NIS_GATE 4.0f |
| #define | IEKF_MAG_NIS_GATE 0.0f |
| not recommended, see iekf.h | |
| #define | IEKF_INFL_TAU_S 0.5f |
| #define | IEKF_DIP_TOL (5.0f * DEG2RAD_F) |
| #define | IEKF_DECOUPLE 0 |
| tried: does not help, see 03 - Docs/theory/iekf-embedded.md | |
| #define | IEKF_RESET_JACOBIAN 1 |
| #define | IEKF_TANGENT_INNOV 1 |
| #define | IEKF_INFL_MAX 100.0f |
| #define | IEKF_LOCKOUT_S 0.5f |
| #define | IEKF_LOCKOUT_BUMP ((10.0f * DEG2RAD_F) * (10.0f * DEG2RAD_F)) |
| #define | IEKF_GRACE_S 0.25f |
| #define | IEKF_PERSIST_TAU_S 1.0f |
| #define | IEKF_PERSIST_RATIO 0.6f |
| #define | IEKF_PERSIST_MIN 0.02f |
| #define | APP_PROFILE_PREVIOUS 0 |
| #define | APP_STILL_ACC_TOL 0.02f |
| #define | APP_STILL_GYRO_THR (3.0f * DEG2RAD_F) |
| #define | APP_STILL_TIME_S 0.3f |
| #define | APP_COMPARE_ORIGINAL 0 |
| #define | MAG_AXIS_MAP { 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f } |
| #define | MAG_HARD_IRON { 31.61f, 16.44f, -26.23f } |
| uT, body frame | |
| #define | APP_TLM_DECIMATION 1u |
| 1 = every acc update (240 Hz), ~18.5 kB/s | |
| #define | APP_TLM_DECIM_REPLAY |
| #define | APP_TLM_TX_TIMEOUT_MS 20u |
| max wait for the UART DMA before dropping | |
| #define | APP_INIT_EVERY_N 480u |
| repeat INIT ~once per second (2 frames per window) | |
| #define | APP_TLM_REPLAY |
| #define | APP_TLM_BLE |
| #define | APP_BLE_STATE_DECIM |
| #define | APP_BLE_FLUSH_MS |
| #define | APP_BLE_CONN_INT_MIN 12u |
| x1.25 ms = 15 ms (iOS minimum) | |
| #define | APP_BLE_CONN_INT_MAX 24u |
| x1.25 ms = 30 ms (iOS: max >= min + 15 ms) | |
| #define | APP_BLE_SUPERV_TIMEOUT 400u |
| x10 ms = 4 s | |
| #define | APP_HW_REV 'N' |
| CAPS hwRev: 'N' = NUCLEO-WB55 + IKS4A1 bench, 'A' = ACwing FC rev A. | |
| #define | APP_FLOW_SIGN_X (1.0f) |
| #define | APP_FLOW_SIGN_Y (1.0f) |
| #define | APP_FLOW_MIN_H 0.08f |
| #define | APP_BATT_ADC 0 |
| #define | APP_BATT_VBAT_CH 1u |
| #define | APP_BATT_VBAT_PORT GPIOC |
| #define | APP_BATT_VBAT_PIN (1u << 0) |
| #define | APP_BATT_CUR_CH 2u |
| #define | APP_BATT_CUR_PORT GPIOC |
| #define | APP_BATT_CUR_PIN (1u << 1) |
| #define | APP_BATT_CURRENT 1 |
| a current sensor is wired (CAPS CURRENT) | |
| #define | APP_BATT_SENS_V_A 0.1f |
| ACwing ESC 1S: TSC213 + 2 mOhm = 0.1 V/A | |
| #define | APP_LOG_FLASH 1 |
| #define | APP_LOG_RAM_KB 48u |
| RAM log on the bench: ~14 s at ~3.4 kB/s | |
| #define | APP_USB_CDC 1 |
| NUCLEO-WB55: USB_USER connector (CN1) | |
| #define | APP_USB_TLM 1 |
Phase-1 configuration: P-NUCLEO-WB55 (NUCLEO-WB55RG) + X-NUCLEO-IKS4A1 in Mode 3 (LSM6DSV16X is the sensor-hub master, LIS2MDL sits behind it).
Every tunable parameter of the application lives here.
Definition in file app_config.h.
| #define DEG2RAD_F 0.017453292519943295f |
Definition at line 10 of file app_config.h.
| #define APP_IMU_ODR IMU_ODR_960HZ |
Definition at line 16 of file app_config.h.
| #define APP_IMU_WATERMARK 4u |
FIFO words: 2 gyro + 2 acc -> IRQ at 960 Hz.
Definition at line 17 of file app_config.h.
| #define APP_GY_LPF1_BW LSM6DSV16X_GY_LIGHT |
gyro anti-alias filter: to be tuned
Definition at line 18 of file app_config.h.
| #define APP_XL_LPF2_ENABLE 1 |
Definition at line 19 of file app_config.h.
| #define APP_XL_LPF2_BW LSM6DSV16X_XL_STRONG |
Definition at line 20 of file app_config.h.
| #define APP_MAG_FAST 1 |
LIS2MDL 100 Hz, hub 120 Hz: halves the age of mag data.
Definition at line 21 of file app_config.h.
| #define APP_STEP_HZ 960u |
propagation + rate loop
Definition at line 23 of file app_config.h.
| #define APP_STEPS_PER_ACC 4u |
-> 240 Hz acc update + attitude loop
Definition at line 24 of file app_config.h.
| #define APP_CALIB_SAMPLES 100u |
mag samples at ~50 Hz -> ~2 s standing still
Definition at line 26 of file app_config.h.
| #define APP_CALIB_GYRO_STILL (5.0f * DEG2RAD_F) |
Definition at line 27 of file app_config.h.
| #define IEKF_SIGMA_GYRO (0.5f * DEG2RAD_F) |
Definition at line 38 of file app_config.h.
| #define IEKF_SIGMA_BIAS 1e-4f |
Definition at line 39 of file app_config.h.
| #define IEKF_SIGMA_VEC_MIN 0.01f |
Definition at line 40 of file app_config.h.
| #define IEKF_ACC_TOL 0.08f |
Definition at line 41 of file app_config.h.
| #define IEKF_MAG_TOL 0.08f |
Definition at line 42 of file app_config.h.
Definition at line 43 of file app_config.h.
Definition at line 44 of file app_config.h.
| #define IEKF_ESTIMATE_BIAS 1 |
Definition at line 45 of file app_config.h.
| #define IEKF_ADAPTIVE 1 |
Definition at line 46 of file app_config.h.
| #define IEKF_TILT_COMP_MAG 1 |
Definition at line 47 of file app_config.h.
| #define IEKF_ACC_NIS_GATE 4.0f |
Definition at line 57 of file app_config.h.
| #define IEKF_MAG_NIS_GATE 0.0f |
not recommended, see iekf.h
Definition at line 58 of file app_config.h.
| #define IEKF_INFL_TAU_S 0.5f |
Definition at line 59 of file app_config.h.
| #define IEKF_DIP_TOL (5.0f * DEG2RAD_F) |
Definition at line 60 of file app_config.h.
| #define IEKF_DECOUPLE 0 |
tried: does not help, see 03 - Docs/theory/iekf-embedded.md
Definition at line 61 of file app_config.h.
| #define IEKF_RESET_JACOBIAN 1 |
Definition at line 66 of file app_config.h.
| #define IEKF_TANGENT_INNOV 1 |
Definition at line 70 of file app_config.h.
| #define IEKF_INFL_MAX 100.0f |
Definition at line 71 of file app_config.h.
| #define IEKF_LOCKOUT_S 0.5f |
Definition at line 72 of file app_config.h.
Definition at line 73 of file app_config.h.
| #define IEKF_GRACE_S 0.25f |
Definition at line 74 of file app_config.h.
| #define IEKF_PERSIST_TAU_S 1.0f |
Definition at line 75 of file app_config.h.
| #define IEKF_PERSIST_RATIO 0.6f |
Definition at line 76 of file app_config.h.
| #define IEKF_PERSIST_MIN 0.02f |
Definition at line 77 of file app_config.h.
| #define APP_PROFILE_PREVIOUS 0 |
Definition at line 82 of file app_config.h.
| #define APP_STILL_ACC_TOL 0.02f |
Definition at line 91 of file app_config.h.
| #define APP_STILL_GYRO_THR (3.0f * DEG2RAD_F) |
Definition at line 92 of file app_config.h.
| #define APP_STILL_TIME_S 0.3f |
Definition at line 93 of file app_config.h.
| #define APP_COMPARE_ORIGINAL 0 |
Definition at line 102 of file app_config.h.
| #define MAG_AXIS_MAP { 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f } |
Definition at line 109 of file app_config.h.
| #define MAG_HARD_IRON { 31.61f, 16.44f, -26.23f } |
uT, body frame
Definition at line 110 of file app_config.h.
| #define APP_TLM_DECIMATION 1u |
1 = every acc update (240 Hz), ~18.5 kB/s
Definition at line 112 of file app_config.h.
| #define APP_TLM_DECIM_REPLAY |
Definition at line 113 of file app_config.h.
| #define APP_TLM_TX_TIMEOUT_MS 20u |
max wait for the UART DMA before dropping
Definition at line 114 of file app_config.h.
| #define APP_INIT_EVERY_N 480u |
repeat INIT ~once per second (2 frames per window)
Definition at line 115 of file app_config.h.
| #define APP_TLM_REPLAY |
Definition at line 116 of file app_config.h.
| #define APP_TLM_BLE |
Definition at line 121 of file app_config.h.
| #define APP_BLE_STATE_DECIM |
Definition at line 122 of file app_config.h.
| #define APP_BLE_FLUSH_MS |
Definition at line 123 of file app_config.h.
| #define APP_BLE_CONN_INT_MIN 12u |
x1.25 ms = 15 ms (iOS minimum)
Definition at line 124 of file app_config.h.
| #define APP_BLE_CONN_INT_MAX 24u |
x1.25 ms = 30 ms (iOS: max >= min + 15 ms)
Definition at line 125 of file app_config.h.
| #define APP_BLE_SUPERV_TIMEOUT 400u |
x10 ms = 4 s
Definition at line 126 of file app_config.h.
| #define APP_HW_REV 'N' |
CAPS hwRev: 'N' = NUCLEO-WB55 + IKS4A1 bench, 'A' = ACwing FC rev A.
Definition at line 128 of file app_config.h.
| #define APP_FLOW_SIGN_X (1.0f) |
Definition at line 131 of file app_config.h.
| #define APP_FLOW_SIGN_Y (1.0f) |
Definition at line 132 of file app_config.h.
| #define APP_FLOW_MIN_H 0.08f |
Definition at line 136 of file app_config.h.
| #define APP_BATT_ADC 0 |
Definition at line 153 of file app_config.h.
| #define APP_BATT_VBAT_CH 1u |
Definition at line 154 of file app_config.h.
| #define APP_BATT_VBAT_PORT GPIOC |
Definition at line 155 of file app_config.h.
| #define APP_BATT_VBAT_PIN (1u << 0) |
Definition at line 156 of file app_config.h.
| #define APP_BATT_CUR_CH 2u |
Definition at line 157 of file app_config.h.
| #define APP_BATT_CUR_PORT GPIOC |
Definition at line 158 of file app_config.h.
| #define APP_BATT_CUR_PIN (1u << 1) |
Definition at line 159 of file app_config.h.
| #define APP_BATT_CURRENT 1 |
a current sensor is wired (CAPS CURRENT)
Definition at line 161 of file app_config.h.
| #define APP_BATT_SENS_V_A 0.1f |
ACwing ESC 1S: TSC213 + 2 mOhm = 0.1 V/A
Definition at line 162 of file app_config.h.
| #define APP_LOG_FLASH 1 |
Definition at line 169 of file app_config.h.
| #define APP_LOG_RAM_KB 48u |
RAM log on the bench: ~14 s at ~3.4 kB/s
Definition at line 171 of file app_config.h.
| #define APP_USB_CDC 1 |
NUCLEO-WB55: USB_USER connector (CN1)
Definition at line 174 of file app_config.h.
| #define APP_USB_TLM 1 |
Definition at line 180 of file app_config.h.