From 02404cc21d8bd333e2def6c0ed578cd267b419f3 Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Sat, 31 Aug 2024 19:33:34 -0400 Subject: [PATCH] Update Mahony_AHRS.h --- bbn_wave_freq_m5atomS3/Mahony_AHRS.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bbn_wave_freq_m5atomS3/Mahony_AHRS.h b/bbn_wave_freq_m5atomS3/Mahony_AHRS.h index 72ea1d8..b5a9b99 100644 --- a/bbn_wave_freq_m5atomS3/Mahony_AHRS.h +++ b/bbn_wave_freq_m5atomS3/Mahony_AHRS.h @@ -32,6 +32,11 @@ void mahony_AHRS_update(Mahony_AHRS_Vars* m, float *pitch, float *roll, float *yaw, float delta_t_sec); float invSqrt(float x); +/* + The gain is the Kp term in a PID controller, tune it as you would any PID controller (missing the I and D terms). + If Kp is too low, the filter will respond slowly to changes in sensor orientation. + If too high, the filter output will oscillate. +*/ void mahony_AHRS_init(Mahony_AHRS_Vars* m, float twoKp, float twoKi) { m->twoKp = twoKp; m->twoKi = twoKi;