Complementary Filtering High Res Barometer and Accelerometer for Reliable Altitude Estimation
This is a simple example of some of the stuff I've been working on recently. This is a demonstration of the soon to be released filtering capabilities of the FreeIMU library using the FreeIMU v0.4.3 as sensor board.
The sensor fusion algorithm estimates the orientation of the board and from that an estimation of the dynamic acceleration is computed by subtracting the gravity from the accelerometer readings. The dynamic acceleration is the fused with the high resolution barometer readings coming from the MS5611 through a complementary filter.
The result, as seen in the graphs is an extremely reliable altitude estimation which can go up to 5-10 cm of precision with almost immediate response to motion.
Graphs programmed in python with pyqtgraph.



tau
Hello Fabio!
This is exact what I did with atmel's sensors xplained. I did not check your code, but I added also a non-constant "time constant" for the filter. So the time constant depends on the (absolute value of) acceleration. Do not know if this is needed (so how big is the error from double-integration).
This means that with multicopters the double integrated acceleration has greater effect than the baro when accelerating. So the barometer is used "more" when the pressure is stable and less when accelerating.
Magnetometer behaviour
Hi Fabio,
I have stable outputs using the getYawPitchRoll(ypr) function, but have some strange behaviour.
When I hold the 0.4 sensor board in one direction the yaw output is stable. When I turn it clockwise or counterclockwise I see the yaw values change. But when rotating and than holding the board stable in a new direction the yaw value slowly changes back to the starting value.
Any idea what can cuase this behaviour?
How does the board behave in
How does the board behave in the Processing program FreeIMU_cube?
It's the same. Check this
It's the same.
Check this video:
http://youtu.be/fiBV1mIOze0
Please check the following: *
Please check the following:
* You are using an original FreeIMU v0.4.3, right? If not, you may be having a board with a rotated magnetometer or a misalignment with sensors' axis.
* If you do use a FreeIMU v0.4.3 please load the FreeIMU_raw example and check in the Arduino IDE serial monitor that all the columns are alive (no constant zeroes or almost non moving values)
If the above works as supposed, you have a magnetometer which badly needs to be calibrated. Some magnetometers have little biases, others very strong biases. If that's the case, you'll find calibration code on the repository. This is current a work in progress (good for developer, bad for enduser) but an easy to use GUI for calibration should be released soon.
It's an original FreeIMU
It's an original FreeIMU v0.4.3. I have two which show the same behaviour.
Since I work with your windows library I can not use your calibration code.
With the freeIMU_raw example all colums show figures. Magnetometer values also change when rotating the board, but than return to the old values, as in the processing sketch.
So I guess the magnetometer needs calibration. Have to wait for your windows code I think ;-)
Thanks for the help sofar.
Variometer
I am very impressed by the sensitivity and accuracy of the fused sensors!
This combination could make an ideal variometer for an RC glider.
How could I change the output of the FreeIMU lib from sending absolute elevation values to sending vertical speed values in (centi)meters/second?
A normal model sailplane searching for thermal rising air has about a range from + 5 m/s to -5 m/s max.
Could you include a line of vario code in the library?
Thanks for all the amazing work you are doing! I enjoy your videos.
Hannes
In the code I'll be releasing
In the code I'll be releasing soon, there is a variable holding the vertical speed which is the result of the sensor fusion which gets integrated to get the altitude difference... you probably only need that one.
releasing the code with a tutorial example
Fab,
This is amazing - I'd love to see this incorporated into our OSD in our flying machines.
Have you posted the code yet and can you give a little tutorial on making it work with the new FreeIMU v0.4 we just purchased?
Thanks again for this amazing work :)
Rick
Have you considered using
Have you considered using kalman filter?
Yeah, but it would require me
Yeah, but it would require me to study kalman filters which I only have a limited knowledge of and I don't think it would be implementable on the poor Arduino microcontroller.
Absolutely interested in seeing people using Kalman for this..
Impressive! Looking forward
Impressive! Looking forward to see the new FreeIMU Library.
I would like to discuss some stuffs i'm working on with my project with FreeIMU.
Congrats! BTW, nice pics from Portugal!
Feel free to contact me
Feel free to contact me anytime, both here, on the launchpad questions site or though email.
wow wow wow! outstanding. :)
wow wow wow!
outstanding. :)
Post new comment