MAV-blog

Stuff related to MAV's (and UAV's) from a hobbyist's point of view. Info

Testing Kalman filters

A lot of people think they need great electronics skills, a lot of time, and embedded programming skills to experiment with Kalman filtering of IMU-data. Think again! The key to all your success stories is simulation!

One of the easiest tools that can help you with those simulations, is a great flight sim called Flight gear. It uses advanced aerodynamics simulation libraries, among which some were created by the NASA. Good enough for our purposes! On top of that, you can easily configure Flightgear to log all the data you need. I updated my config file to log the following variables:

  • Roll
  • Pitch
  • Acceleration along the 3 axis
  • Gyro reading along the 3 axis
  • Heading
  • Airspeed
  • ...

All the available fields can be found in FlightGear\docs\README.properties
I added the following lines to the configuration xml:

<logging>
  <log n="0">
   <enabled>true</enabled>
   <interval-ms>100</interval-ms>
   <filename>fg_log.csv</filename>
   <delimiter>,</delimiter>
   <entry n="0">
    <enabled>true</enabled>
    <title>AccX</title>
    <property>/accelerations/pilot/x-accel-fps_sec</property>
   </entry>
   <entry n="1">
    <enabled>true</enabled>
    <title>AccY</title>
    <property>/accelerations/pilot/y-accel-fps_sec</property>
   </entry>
   <entry n="2">
    <enabled>true</enabled>
    <title>AccZ</title>
    <property>/accelerations/pilot/z-accel-fps_sec</property>
   </entry>
   <entry n="3">
    <enabled>true</enabled>
    <title>DRoll</title>
    <property>/orientation/roll-rate-degps</property>
   </entry>
   <entry n="4">
    <enabled>true</enabled>
    <title>DPitch</title>
    <property>/orientation/pitch-rate-degps</property>
   </entry>
   <entry n="5">
    <enabled>true</enabled>
    <title>Roll</title>
    <property>/orientation/roll-deg</property>
   </entry>
   <entry n="6">
    <enabled>true</enabled>
    <title>Pitch</title>
    <property>/orientation/pitch-deg</property>
   </entry>
      <entry n="7">
    <enabled>true</enabled>
    <title>Heading</title>
    <property>/orientation/heading-deg</property>
   </entry>
   <entry n="8">
    <enabled>true</enabled>
    <title>airspeed</title>
    <property>/velocities/airspeed-kt</property>
   </entry>
  </log>
 </logging>

Then I created a small VB tool (Yeah, kalman filters in VB ;-) ) to filter the data. This is the result:

One thing you can see, is that if I calculate the centripetal acceleration, and substract it from my y and z acceleration, the resulting roll angle has a standard deviation of only 2 degrees. Not bad!

Files for you download pleasures:

20 November 2007, 21:55 | Link |

|