shubhampaul / Real_Time_Planet_Tracking_System

RTPT or Real Time Planet Tracking System.It tracks planets using keplers laws and osculating elements and uses MPU9250 for Yaw auto Calibration and GPS to get user's location to feed data to the keplers algorithms for planet tracking.
GNU General Public License v3.0
60 stars 35 forks source link

Kalman filter parameters #3

Closed romatou18 closed 4 years ago

romatou18 commented 4 years ago

Hi Paul,

First of all thanks for you great article on hackster.io and the work done on the mpu9250 lib.

I have remarks and questions about this code: in https://github.com/shubhampaul/Real_Time_Planet_Tracking_System/blob/master/MPU_fux_BNO_mBias/MPU_fux_BNO_mBias.ino line 244

`// global constants for 9 DoF fusion and AHRS (Attitude and Heading Reference System) float GyroMeasError = PI * (40.0f / 180.0f); // gyroscope measurement error in rads/s (start at 40 deg/s)

float GyroMeasDrift = PI * (0.0f / 180.0f); // gyroscope measurement drift in rad/s/s (start at 0.0 deg/s/s)

// There is a tradeoff in the beta parameter between accuracy and response speed. // In the original Madgwick study, beta of 0.041 (corresponding to GyroMeasError of 2.7 degrees/s) was found to give optimal accuracy. // However, with this value, the LSM9SD0 response time is about 10 seconds to a stable initial quaternion. // Subsequent changes also require a longish lag time to a stable output, not fast enough for a quadcopter or robot car! // By increasing beta (GyroMeasError) by about a factor of fifteen, the response time constant is reduced to ~2 sec // I haven't noticed any reduction in solution accuracy. This is essentially the I coefficient in a PID control sense; // the bigger the feedback coefficient, the faster the solution converges, usually at the expense of accuracy. // In any case, this is the free parameter in the Madgwick filtering and fusion scheme.

float beta = sqrt(3.0f / 4.0f) * GyroMeasError; // compute beta

float zeta = sqrt(3.0f / 4.0f) * GyroMeasDrift; // compute zeta, the other free parameter in the Madgwick scheme usually set to a small or zero value

define Kp 2.0f * 5.0f // these are the free parameters in the Mahony filter and fusion scheme, Kp for proportional feedback, Ki for integral

define Ki 0.0f`

float GyroMeasDrift = PI (0.0f / 180.0f); means that this constant is 0 => 0/180 = 0 Pi = 0. It means that the Gyro drift is considered to be 0 ? This also means that float zeta = sqrt(3.0f / 4.0f) * GyroMeasDrift; the zeta parameter is 0 ?

I am not an IMU or Kalman filter specialist but I am confused with that as I understand that a good kalman filter parameter evaluation is quite crucial to getting reliable results.

Could you shed a light on why these 2 parameters would tend towards zero and thus not taking into accoun the Gyro drift over time if I am correct?

Also I have another question about the Accelero and Gyro bias vectors:

float gyroBias[3] = {0, 0, 0}, accelBias[3] = {0, 0, 0}; // Bias corrections for gyro and accelerometer

Shouldn't the bias be calculated during i.e. the selfTest or during accelero and gyro calibration ? Regards

Regards

Romain

shubhampaul commented 4 years ago

Hi Romain,

I would suggest you raise an issue at the repo of the original author of this code, i.e Kris Winer.

I believe this is the original code (line 238-245): MPU9250BasicAHRS.ino

Regards Paul