Want to test code with the simulator X-Plane?

Here's an example of how to get data from the simulator: http://gist.github.com/228998It has everything you need to treat it as a virtual IMU. This was instrumental in getting my extended Kalman filter running (to be open sourced soonish) and I hope you find it useful too!(I'll do an updated version that shows you how to control the plane in X-Plane from your code.)

E-mail me when people leave their comments –

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

Join diydrones


  • Let me know if you have any questions or get stuck!
  • That's exactly what I was looking for! Thank you!

  • @Jason Slay

    I am working on an updated post with code. It includes a bunch of updates but due to work limiting my time it probably won't be ready until January.

    This might get you started if you're a confident programmer: https://gist.github.com/1161599
  • Any chance we will see the updated post with the control commands? Thanks!

  • Gload is what you want to look for…

    self.az = unpack_from('f', data, 9+16+36)[0] # normal
    self.ax = unpack_from('f', data, 9+20+36)[0] # axial
    self.ay = unpack_from('f', data, 9+24+36)[0] # side
  • Tim,
    What variables are you using for accelerations from X Plane. From the input/output menu I see the angular rates but not the accels.
  • Faisal, I'll be curious to hear a comparison between FlightGear and X-Plane with respect to ease of adding it into the loop. Thanks for your links too!

    Any good sources you guys are using for smaller (R/C) planes in X-Plane? I've been a big fan of X-Plane for some time - it is a great simulator, especially if you have a techy bent...
  • Developer
    I just bought Xplane last week to do this. Thank goodness I can use your code! I can't believe what a good deal this program is.
  • I was able to run a closed loop simulation with FlightGear as well. It's super easy ... in fact, all that you need is already done and explained in my blog posts. The only thing left to do is to flesh out the C code with your IMU/autopilot code and test away!


    X-plane looks interesting, I'm gonna check it out!
  • ah got it, different versions of xplane.
This reply was deleted.