AHRS Algorithm


May I have your 16 state EKF algorithm, I want to design and build my own PCB using analog devices sensors.

Best Regards,

You could download the reference code form Vs code Aceinna extension.

Thank you very much, please pardon me, does this algorithm works without GPS? as far as I know this algorithm has 6 state from GPS data, am I right ?

The algorithm can run in VG/AHRS mode if GPS is not enabled. For AHRS mode, a magnetometer is required.
You can refer to our VG/AHRS application for more details on how to configure the algorithm to run in VG/AHRS mode.

Thank you for reply, are you using loosely coupled method? May I use it in fixed wing uav? Do I need any dampening to mount it?


Yes, a loosely coupled method is implemented in the algorithm. The INS is mostly tested on land vehicles, like a car. For fixed wing UAV, I think you might test it and tune it for yourself. If dampening is needed or not depends on your platform.

Thank you for reply, what parameters must change for tuning EKF algorithm, and can I using another sensors for better effect ? I mean is ADIS16445 IMU or another ...

Best Regards

I cannot answer your question in a short post.
Generally, you need first get some knowledge about the math of the algorithm. You can refer to our online document: https://openimu.readthedocs.io/en/latest/algorithms.html
Besides the EKF algorithm, there are also some other functions in the INS algorithm. These functions have their tunable parameters. You have to dive into the code to get them.
If you want to use on some other IMUs, you need to port the algorithm to your platform.
I am afraid to make everything work might cost much more time than you expected.
Why don't you just try OpenIMU300ZI?

Thank you very much for the reply, I'm interested to buy this product, but many years ago I bought AHRS280ZA-200 and wasn't good and I decide implemented my AHRS with better sensors. I bought an ADIS16445, and designed PCB for that, I tested 7 states EKF algorithms in real flight, but that doesn't follow up true values ( roll , pitch , yaw ), I'm hopeful your algorithm can help me.
is openIMU300ZI suitable for fixed wings?

Best Regards

I cannot say if openIMU300ZI is suitable for fixed wings or not. You can check its datasheet to see if it meets your requirements.

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

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

Best Regards

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

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,

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,

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.

Best regards

Log in to reply