I have recently started writing a series of blog posts that detail how I have chosen to program my own IMU complimentary filter. I have done this for my own entertainment and as a learning opportunity. Hopefully others will find this interesting.
Here's basics of what this complimentary has to offer:
- Quaternion based attitude estimate
- Never requires re-orthogonalization unlike DCM or any other 3x3 rotation matrix solution
- Almost never requires re-normalization of the attitude estimate Quaternion
- Requires no trigonometric functions or floating point division, so it runs fast. Can process 6dof samples at 500Hz on an Arduino if non-IMU functions are light. Functions nicely at lower sample rates (~100Hz) if processing time is needed for other operations.
- No gimbal lock in any orientation
- Fully 3D capable after initialization. Will properly counter attitude estimate drift and error regardless of the amount of time in any orientation.
The current posts cover the following:
- My technique for generating update quaternions from gyro data
- Explanation of how pitch/roll drift compensation is done with accelerometer data
- Example code for the 6dof version of my complimentary filter
Future posts will build on the previous posts while examining the following:
- Magnetometer usage and implementation
- Example code for my 9dof complimentary filter
- GPS and Baro implementation with simple velocity and position estimation
- Example code for my 10dof+GPS complimentary filter
- Aircraft control based on quaternion data
- Anything else that strikes my interest... or is requested ;-)
My goals have been to write a filter that runs fast, behaves nicely in any orientation, and can be used to in my own multi-copter control software. So far I am happy. This is not intended to be the "best" complimentary filter in any way, just me having fun writing code. Nothing I have or will present is ground breaking, although I haven't seen any implementations quite like mine. I hope this is valuable to someone.