AHRS Algorithm

Dear dong, the pixhawk has low cost sensors as mpu6050 but that is so good in real flight, they are using EKF with 22 - 24 states with a GPS , would you mind tell me what is different between pixhawk and your 16 states EKF?
I know nav420 (crossbow) has two EKF, 7 and 13 states. is kind of sensors important for optimal result?

Best Regards
Amin

Because I do not know details about PX4 EKF, I cannot answer your question well. You can refer to our algorithm math in the online document and the PX4 document for detaisl. You can even dive into the code to get more info.
However, if you only want to know some superficial differences, the EKF differences could include the following:

  1. The system equation. For example, one may choose quaternion as state, others may choose Euler angles. One may want to estimate the IMU scale factor errors while othter don't. One may use error states to form the sytem equation.
  2. The measurement. This is mainly about what kind of measurements are available.

What do you think of the differences between Aceinna's algorithm and PX4's?

Thank you for the reply, the PX4's algorithm has additional 6 states as Wind Vector and other things.
I'm interested to implementation your 16 states for AHRS very soon, I'll ask many questions.
I'm using ADIS16445 IMU, Ublox neo-M8N , HMC5883l , stm32f4
IMU1.jpg

Best Regards
Amin

Dear dong, is static and dynamic accuracy different in a VG or AHRS ? forasmuch as when I used madgwick , mahony or 7 state EKF algorithm and my IMU was on the table, all attitude was true, but when try it in real flight , attitude doesn't follow up true values.
I think this problem is Caused by accelerometer sensor and it need to compensate with a method , am I right ? and forasmuch as , some algorithm as Loosely coupled is using GPS data as velocity (NED), this problem solved ? and are you using IIR filter for LPF ? I see 3rd Butterworth low-pass filter in codes.

Best Regards
Amin

For VG/AHRS, the pitch and roll angles are stabilized using accelerometer measurements. It is assumed that the accelerometer measures gravity plus some white noise. This is "true" in static mode. However, in dynamic mode, there is linear acceleration which cannont be considered as noise any more. You have to implement a mechanism in your algorithm to detect such linear motions and then reduce the weight of the acceleration in attitude determination.
If GPS is available, pitch and roll can be well stabilized since pitch and roll are coupled with GPS north and east velocities.
For LPF, we are using 3rd Butterworth. It is an IIR filter.

Dear Dong,

Thanks for your explanation, I need to know if I buy your openIMU300ZA, may I be able to program the ZA module with my own stlink? I want to buy openIMU300ZA not ZI.

and one more question, in AHRS mode, if any GPS lost occurred, do I need to expect any lose of stability in roll, pitch and yaw axes?

Best Regards,
Amin

Thanks for your explanation, I need to know if I buy your openIMU300ZA, may I be able to program the ZA module with my own stlink? I want to buy openIMU300ZA not ZI.
Yes, you can use your own stlink. OpenIMU300ZA is renamed to OpenIMU300ZI.

and one more question, in AHRS mode, if any GPS lost occurred, do I need to expect any lose of stability in roll, pitch and yaw axes?
If in AHRS mode, GPS is not used. So, I assume you mean the INS mode. For INS mode, when GPS is lost, it will drop to the AHRS mode after some time. And pitch and roll accuracy will be a bit lower.

Dear Dong,

in INS mode with GPS lost, do you have any information about error rate in the elapsing time and distance? for smooth paths and paths with a maze?

I have an AHRS280ZA-200, I have a problem with it, when I rotate it in any direction very fast, it will freeze for a while ( 1-2 seconds ) it seems it is because of 200d/s gyros used in it, so the algorithm used in it needs to restart itself or something like that. I want to know is openIMU300ZI the same ?

Best regards,
Amin

You can get the state covariance matrix P to get an estimate of the state error w.r.t time.

OpenIMU300 has a gyro range of 400dps. If over range, the algorithm will restart.

Dear dong,
is innovation (measurement error) vk = zk - hk a 9x1 vector in INS mode that include position , velocity , attitude (lat , long, alt , vn, ve, vd, roll , pitch , heading) ,and calculate from gps and ins ? if is it true? so, H (observation matrix) in EKF update is a matrix 9x16, am I right?
I need to some information for simulating in Matlab and programming in my Micro.

predict.jpg
Best regards
Amin

Innovation can be a 9x1 vector. However, heading can be unavailable if GNSS speed is low. In this case innovation is 8x1.
Besides, to lower computational consumption, sequential update is implemented. In this case H is 3x16.

Thank you for the reply, when H is a 3x16 , gain ( K ) will be 16x3 , R is 3x3 , inv (R) is 3x3 and measurement error must be 3x1 , because we can't multiplication matrix 16x3 in 8x1, forasmuch measurement error must be a 3x1 vector , because for calculate X ( state update ) we need to a vector 16x1 ,am I right? If is it true ,please tell me how to define measurement error ( Vk ) ? I can't understand this part.

Best Regards
Amin

The keyword here is "sequential update". That is, to reduce computation, measurements are applied sequentially. You can do position update first, then velocity update, and then attitude update. In this case, you have a measurement of 3x1 instead of 9x1.
Of course, you can well use the 9x1 measurement to do a full update.
Please refer to the code to see how sequential update is implemented.

There is some theory about sequential update: http://mocha-java.uccs.edu/ECE5550/ECE5550-Notes05.pdf

Thank you very much , this is so intelligently method, I'll dive to codes, I had a problem with ( inv ) higher order matrix, but we have a inv 3x3 now , and this is so easy . dear dong , pardon me for this question but I like to know, does this method need to calculate kalman gain ( k ) once or seperate for position, velocity and attitude , if so ? we need to separate tuning gain (k) for position, velocity and attitude?

Best regards
Amin

Kalman gain should be calculated separately for position, velocity and attitude.

Thank you very much.

if i have got kalman filtered imu data , and some gps position, is there a simple INS algorithm @Dong-xiaoguang
i want to calculate the position when GPS is not available?

This post is deleted!

Hello, does AHRS/VG dynamic attitude app also using 16 state EKF ? or need to less state ?

Best Regards
Amin

@Dong-xiaoguang said in AHRS Algorithm:

Kalman gain should be calculated separately for position, velocity and attitude.

Dear Dong,
the method you mention is for INS , what about for AHRS?
are position and velocity required for AHRS too or are those for INS specifically?

Best Regards
Amin

Log in to reply