Developer

Using X-Plane 10 with ArduPilot SITL

ArduPilot has been able to use X-Plane as a HIL (hardware in the loop) backend for quite some time, but it never worked particularly well as the limitations of the USB interface to the hardware prevented good sensor timings.

We have recently added the ability to use X-Plane 10 as a SITL backend, which works much better. The SITL (software in the loop) system runs ArduPilot natively on your desktop machine, and talks to X-Plane directly using UDP packets.

The above video demonstrates flying a Boeing 747-400 in X-Plane 10 using ArduPilot SITL. It flies nicely, and does an automatic takeoff and landing quite well. You can use almost any of the fixed wing aircraft in X-Plane with ArduPilot SITL, which opens up a whole world of simulation to explore. Many people create models of their own aircraft in order to test out how they will fly or to test them in conditions (such as very high wind) that may be dangerous to test with a real model.

I have written up some documentation on how to use X-Plane 10 with SITL to help people get started. Right now it only works with X-Plane 10 although I may add support for X-Plane 9 in the future.

Michael Oborne has added nice support for using X-Plane with SITL in the latest beta of MissionPlanner, and does nightly builds of the SITL binary for Windows. That avoids the need to build ArduPilot yourself if you just want to fly the standard code and not modify it yourself.

Limitations

There are some limitations to the X-Plane SITL backend. First off, X-Plane has quite slow network support. On my machine I typically get a sensor data rate of around 27Hz, which is far below the 1200 Hz we normally use for simulation. To overcome this the ArduPilot SITL code does sensor extrapolation to bring the rate up to around 900Hz, which is plenty for SITL to run. That extrapolation introduces small errors which can make the ArduPilot EKF state estimator unhappy. To avoid that problem we run with "EKF type 10" which is a fake AHRS interface that gets all state information directly from the simulator. That means you can't use the X-Plane SITL backend to test EKF settings.

The next limitation is that the simulation fidelity depends somewhat on the CPU load on your machine. That is an unfortunate consequence of X-Plane not supporting lock-step scheduling. So you may notice that simulated aircraft on your machine may not fly identically to the same aircraft on someone elses machine. You can reduce this effect by lowering the graphics settings in X-Plane.

We can currently only get joystick input from X-Plane for aileron, elevator, rudder and throttle. It would be nice to support flight mode switches, flaps and other controls that are normally used with ArduPilot. That is probably possible, but isn't implemented yet. So if you want a full controller then you can instead connect a joystick to SITL directly instead of via X-Plane (for example using the MissionPlanner joystick module or the mavproxy joystick module).

Finally, we only support fixed wing aircraft in X-Plane at the moment. I have been able to fly a helicopter, but I needed to give manual collective control from a joystick as we don't yet have a way to provide collective pitch input over the X-Plane data interface.

Manned AIrcraft and ArduPilot

Please don't assume that because ArduPilot can fly full sized aircraft in a simulator that you should use ArduPilot to fly real manned aircraft. ArduPilot is not suitable for manned applications and the development team would appreciate it if you did not try to use it for manned aircraft.

Happy Flying

I hope you enjoy flying X-Plane 10 with ArduPilot SITL!

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Developer

    docs have been updated for helicopters:

    http://ardupilot.org/dev/docs/sitl-with-xplane.html#flying-a-helico...

    Using SITL with X-Plane 10 — Dev documentation
  • Developer

    I've now got helicopters working with XPlane-10 SITL. Here is a demo of flying a Bell JetRanger in SITL

    I'll update the docs on how to setup for heli flights soon

  • Hey Tridge,

    It now works! Thank you so much for taking the time to fix this. I tested it with and without joystick with success.

    Thanks again,

    Ryan 

  • Developer

    Hi Ryan,

    I think I have fixed the throttle input now. Same basic method, but with fixes for rounding errors. Can you try again?

    Cheers, Tridge

  • Developer

    Hi Ryan,

    Is it the input throttle that is bad? We may need to find a new way to handle it.

    The problem with throttle is that X-Plane uses the same field for two very different values. In data type 25 it sends both the joystick throttle and the current throttle demand. So if your joystick throttle is at 70% and ArduPilot is currently outputting 30% throttle then data type 25 will alternative between 30% and 70%.

    I needed some way to distinguish the two, so I used an ugly trick where 0.000123 is added to the throttle that ArduPilot is sending after rounding it. It then recognises those digits in the incoming throttle and discards it as its own input reflected back.

    What do you have setup in your joystick throttle? There are several throttle choices in the X-Plane joystick setup. Perhaps a screen shot of your joystick setup would help me reproduce the issue? Also, if I could test with the same aircraft as you that may help.

    Cheers, Tridge

  • Great work Tridge! I am working on getting this going and seem to have an issue with the throttle not responding properly. I have confirmed that my joystick works correctly while not in SITL. When in SITL the throttle bouncing from target throttle to zero. Any ideas? 

  • Developer

    Perfect timing for some of my research!  Thanks and as usual, great work!

  • Nice work Tridge and Michael.  I look forward to modeling some of my e-gliders in X-Plane for use in this new facility.  Tridge, how's the thermal performance of the 747?  ;-)

    Kelly

  • Developer

    @naish, I know you're joking, but we do get regularly asked about using ArduPilot for manned aircraft, so I put in this disclaimer so that this demo wasn't taken as approval for manned operation.

    As to what you will do with it, a 747 would make an awesome shed if you have a big enough back yard!

  • "  Please don't assume that because ArduPilot can fly full sized aircraft in a simulator that you should use ArduPilot to fly real manned aircraft. ArduPilot is not suitable for manned applications and the development team would appreciate it if you did not try to use it for manned aircraft.  "

    @ Tridge so what I'm going to do now with the B747 I just bought!? 

This reply was deleted.