Mayitzin / ahrs

Attitude and Heading Reference Systems in Python

Home Page:https://ahrs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] default madgwick gain when using magnetometer is only set if mag data is passed on init

ManuelPalermo opened this issue · comments

If "mag" data is not passed on init (mag=None) the gain is initialized with the default imu value and used when calling updateMARG function:

self.gain = kwargs.get('gain', 0.033 if self.mag is None else 0.041)

I propose adding two different gain params on init (gain_imu and gain_ahrs), one for each mode, solving this issue and also allowing the use of updateIMU and updateMARG functions on the same initialized filter (ex. using IMU when magnetic distortions are detected on a step and MARG otherwise).

Good idea. I'll add separate gains to deal with the updates independently.