Polaris
Polaris is an Extended Kalman Filter (EKF) for fixed-wing aircraft. It provides realtime orientation data to allow for higher-level navigation software to be developed.
Polaris is a six-degree-of-freedom extended Kalman filter for inertial navigation, and requires a 3-axis gyro, 3-axis accelerometer, a 3-axis magnetometer, an airspeed sensor, an altimeter and GPS.
What you should understand very clearly about this filter is it has gimbal lock / singularity issues. UAVs aren't used for aerobatics (yet) so if you keep things gentle and smooth (±45 degrees from level in pitch and roll) you'll be just fine.
Polaris was developed by Tim Trueman and Ryan Beall. It's based on a BYU paper [PDF].
Mac/Linux/Unix Installation
- Go to http://x-plane.com/pg_downloads.html and download the demo (this takes the longest)
- Download source code
- Execute "sudo easy_install numpy twisted" in the terminal
- Start X-Plane and set the checkbox that outputs data (Input/Output in the menus then see screenshots below)
- Run "python Polaris.py" in the command line
Windows Installation
- Go to http://x-plane.com/pg_downloads.html and download the demo (this takes the longest)
- Download source code
- Install the 32-bit Python 2.6.x package here http://python.org/download/ (It should be the first package in the list)
- Install the 32-bit numpy package http://sourceforge.net/projects/numpy/files/ (Make sure it's for Python 2.6)
- Install the 32-bit twisted package http://twistedmatrix.com/ (Make sure it's for Python 2.6)
- Right-click on My Computer and go to Properties. This pops up a dialogue box of system information; click on the Advanced tab and then on the Environment Variables button. In the new dialogue that pops up, click on the Path variable in the System Variables box; then click the Edit button. Place your cursor in the Variable Value textbox, right before the final double-quote of the string. Type a semicolon (to separate the previous value from the one you're about to add) and then type the location of the python executable on your systemÑprobably something like "C:\Python26". Click OK until you're out of all the dialogue boxes. Now, when you type python at any DOS command prompt, Windows will be able to automatically find and run the correct executable.
- Start X-Plane and set the checkbox that outputs data (Input/Output in the menus then see screenshots below)
- Run "python polaris.py" in the command line
Future
- Position estimate
- Wind vector estimate
- Altitude estimate
- Airspeed estimate
- Tuning / noise / real hardware testing (perhaps a genetic algorithm for tuning)
- Porting to other languages/platforms (microcontrollers)
- Email Austin about virtual magnetometer in X-Plane
FAQ
Q: Why can't I use the 64-bit version on Windows?
A: I can't get numpy or twisted to work for the 64-bit version (I can't remember which wasn't workingÑperhaps both)
Q: Why did you build this and release it as open source?
A: I felt like it was a good idea; I wanted to learn about EKFs; There wasn't anything great out there; And I wanted to put out the best EKF available under an open source license.
Q: What license is it released under?
A: Apache 2.0
Q: Something doesn't work.
A: Email or IM me: tim@dronedynamics.com
Q: Where's the documentation?
A: It's coming. I promise.
Q: Why does your filter suffer from gimbal lock / singularities? I want to do aerobatics!
A: The vast majority of UAVs are not going to be doing crazy maneuvers; a few common sense rules keeps things simple and allows for optimized precision. Also if you think you can solve this problem, email me or just write the code! This is open source after all.
Q: Can I get involved and become rich and famous?
A: Fuck yeah! And probably not. Email me anyways though if you want to get involved: tim@dronedynamics.com
Q: Can you port this to my hardware/platform/microcontroller?
A: Who knows? You can always do it yourselfÑI'll support you any way I can if you're doing it yourself.
Screenshots
X-Plane + Polaris running

Performance

X-Plane Config