GUI for tuning Kalman Filter

Fine tuning of our Kalman IMUs is one of the most important step to be done in order to get the IMU ready to fly.
And a good tuning begins from "the table"...

Since one month I created a small application, written in java, multi-os, open-source, ready-to-use intended for studying, tuning, debugging your kalman application without any particular need.
It is able to getdatas from the serial port (incoming data from the micro) and visualize
them on two separately artificial horizon displays.

I put my effort in creating an application platform independent since the linux and OS X community are getting bigger and bigger.

New version: Artificial Horizon AH-3+ (graphic improved!)
Download the tar archive containing the application directly from here:

ArtificialHorizon AH-3+

untar it and double click for launching the application or much better open a console or a prompt in win and digit:

$java - jar <file_name>.jar

You get messages on the background helpful for "debugging" porpouses.

Only 2 steps must be taken in advance to get it working with your system:
  • Install and configure at least Jave Runtime Environment JRE 6, available for download on Sun's site.
    After installation configure your environment path variables, this is even important in windows;
  • This program does use the RXTX package to deal with the serial port on your system.
    The library is an open-source project available at: it supports 32 different platforms. No need to be installed, open the binary package and copy the library into your java folder according to the instruction here:;

: be aware that the application will fail or crashes in case it doesn't recognize the RXTX installed on your system. I strongly suggest to test the rxtx library after installation running one of the program available in this link:
Doing so your are sure the library is running along your JRE and prevent the application to frezz or crash]

The usage is really simple, select your baudrate, serial port and click on Open Serial to start getting incoming data from your microcontroller :)
As soon new data are available, they will be displayed on the screen moving your the artificial horizon up-downwards, bank left, right...(I 3th axis will be added soon for yaw :) )

The only thing you must be aware is how to send data from your micro.
Those are collected at your serial port following a simple packet protocol (I wanted to keep it as shortest as possible and easy, since serial communications can take much resources from our micros).

Somewhere in your code or firmware put an output routine able to send one string accordingly to this rule:

<angle_value><type_info> (followed by the carriage and return)

<angle_value> is whatever number in DEGREES along any axis
<type_info> specific information whether the previus angle number refers to pitch, roll, yaw and whether it is filtered (processed by your Kalman filter) or is a pure angle (the "reading" by your sensors)

<type_info> can only contain those string informations:
kp : pitch angle computed by your Kalman algorithm;
kr : roll angle computed by your Kalman algorithm;
pp : pitch angle, pure data, directly from your sensors;
rr : roll angle, pure data, directly from your sensors;

Here same examples to figure out how datas are sent by the microcontroller:
34kp 34 degrees filterd by Kalman, pitch
-23rr -23 degrees not filtered, readed directly from the sensors
178pp 178 degrees pure pitch, not filtered
-1kr -1 degree along roll axis, filtered

You can find further info on how to write your firmware in the README file in the archive.

That's all...I wish this application can help you in understanding what's going on in your application and let your drone to start with a fiiiiiine tuned IMU :) :) :)


PS: for any problem let me know ;)

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • just want to say thank because I will use this... I mean, will extract what I need to use it! just need a single AH drawer! THANK
  • Anyone has an experience to branch it to ArduPilot Mega?
  • Dave I made a windows instalation for the ArtificialHorizon software, it deals with all the necessary files to open the comm port. could u send me your e-mail so I can send the .msi file to u? thanks
  • Hello dave!!!
    I make it work in windows using Netbeans IDE 6.5 and Javacomm instead of rxtx.
    I made only 2 changes, one is the Artificial_Horizon.gif image that was missing and in the open port code u forgot to look for all the ports so the code stays like this:

    /*******BEGIN OF CHANGES********************/
    System.out.println("Trying to find serial port:" + defPort);

    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();

    if (portId != null) { // If portId contains at least one element!!!
    if (portId.getName().equals(defaultPort)) {
    portFound = true;
    System.out.println("Port found on: " + defaultPort);
    } else {
    portFound = false; // Don't execute the cycle below
    /********END OF CHANGES********************/

    Thank u very much!!! now im going to start the reeaaal changes... but u helped me a lot....

    When i have time i'll send u the netbeans project so u can put on the wiki.... see u
  • Ok..
    the source code is available on the repository

  • oh that's better dave.... thanks again...
  • Anyway I m going to create a tar archive with all the code inside and publish it in the google repository.

    I think tomorrow it will be available (sorry I have lot to do :) )

  • Eheh

    Anyway for whom is interested in the code:

    A java archive file.jar contains the source file!
    You can get the code simply using the command:

    $java xfv .jar

    and that's all!! You ll get the complete source code, comments, functionality and whatever...

    Anyway, if you need help implementing some particular functions or whatever I m glad to help you.

    Thanks again for giving it a try!!

  • Great software! I'm using it with the UAV dev board 2 and it works great!
    Is it possible for you to share the code? I'm thinking about adding a google maps screen into your software and feed with my GPS data.
    Thanks for the software!
  • Ehehhe
    ok, I ve improved last night a little it the graphic and rewrote the code, no is much better and faster.
    Most important I added a box displaying yaw values, so I renamed the whole project in AH-3 because 3 degrees of freedom.
    Even i I could be improved I really hope it could be helpful for people who try to understand kalman...

This reply was deleted.