ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
fc_shared.h
Go to the documentation of this file.
1
11#ifndef FC_SHARED_H
12#define FC_SHARED_H
13
14#include <stdint.h>
15#include "calib_mgr.h"
16
17typedef struct {
18 uint8_t imu_ok, running, acc_gated, mag_gated;
19 float q[4];
22 float vib_mg;
23 uint16_t acc_clip;
24 float loop_hz, jitter_us, cpu_pct, imu_temp_c;
26 uint8_t alt_valid, tof_valid, tof_ground;
27 float h, vz, tof_h;
28 uint16_t tof_mm;
29 uint8_t flow_q;
30 uint8_t flow_ok;
31 uint8_t flow_usable;
32 float vel_body[2];
33 uint32_t baro_pa;
34 uint16_t sensors;
35} fsh_est_t;
36
37void fsh_est_write(const fsh_est_t *s);
38void fsh_est_read(fsh_est_t *out);
41extern volatile uint8_t g_fsh_cal_want;
42int fsh_cal_push(const cal_sample_t *s);
44
46typedef struct { uint8_t type; cal_set_t set; } fsh_apply_t;
47int fsh_apply_post(uint8_t type, const cal_set_t *set);
49
50void fsh_reset(void);
51
52#endif /* FC_SHARED_H */
static batt_state_t s
Definition battery.c:21
Sensor calibrations of protocol v2 (HANDOVER_FW.md ยง10).
int fsh_cal_push(const cal_sample_t *s)
Definition fc_shared.c:44
void fsh_reset(void)
Definition fc_shared.c:15
int fsh_apply_take(fsh_apply_t *a)
Definition fc_shared.c:55
volatile uint8_t g_fsh_cal_want
calibration samples (ImuTask -> AppTask)
Definition fc_shared.c:7
int fsh_apply_post(uint8_t type, const cal_set_t *set)
Definition fc_shared.c:47
void fsh_est_write(const fsh_est_t *s)
ImuTask.
Definition fc_shared.c:23
int fsh_cal_pop(cal_sample_t *s)
Definition fc_shared.c:45
void fsh_est_read(fsh_est_t *out)
AppTask: keeps *out on a race.
Definition fc_shared.c:32
uint8_t set
Definition log_task.c:39
calibration to apply (AppTask -> ImuTask)
Definition fc_shared.h:46
cal_set_t set
Definition fc_shared.h:46
uint8_t alt_valid
vertical / navigation
Definition fc_shared.h:26
float cpu_pct
Definition fc_shared.h:24
uint8_t flow_ok
bridge alive, PMW3901 OK
Definition fc_shared.h:30
uint16_t tof_mm
raw, 0xFFFF n/a
Definition fc_shared.h:28
uint8_t flow_q
0..100, 0xFF n/a
Definition fc_shared.h:29
uint16_t sensors
IMU / MAG_FC / BARO found by the IMU init.
Definition fc_shared.h:34
float mag_interf_pct
Definition fc_shared.h:21
float vib_mg
RMS of |a| - 1 g over ~1 s
Definition fc_shared.h:22
float h
Definition fc_shared.h:27
uint8_t acc_gated
Definition fc_shared.h:18
float att_unc_deg
1 sigma, largest axis
Definition fc_shared.h:20
uint16_t acc_clip
samples near full scale since arm
Definition fc_shared.h:23
uint8_t flow_usable
above the PMW3901 minimum height (80 mm)
Definition fc_shared.h:31
uint32_t baro_pa
0 n/a
Definition fc_shared.h:33