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!
Comments
Great work! But a very strange thing happens when I connects X-plane 10 to Mission Planner: the flaps is always down to the last stage and it won't go up (retreat) whatever I do, using controller or my keyboard (I'm flying the 747 with Andrew Tridgell's parameters). Does anyone here know how to solve it?
Does anyone here know how to get the following issue fixed? Upon starting SITL, the UDP connects but mavlink generates an error.
For anyone that is interested I found the SITL quadplane instructions now here: http://ardupilot.org/plane/docs/quadplane-simulation.html
Now to make a Xplane quadplane!
Lol Tridge!
I think that needs to tested! Seeriously! ;-)
From memory when I visited the Cape in the 90's, the thrust on the Space Shuttle thrusters do equivalent of 40 million HP or something silly. They have gas turbine fuel pumps to pump some 700 tons of fuel in just a couple of minutes! Won't be much left of the 747 when they lift off!
I was wondering if it's possible for you to share how to run a quadplane in SITL, without xplane, in the first instance? I can't seem to find and docs on how to do it. Thx.
In the meantime I'll see if I can build a quadplane for xplane for funsies.
-
BTW I have found an issue with some RC_SPEED settings not running with various BLHeli ESCs and burning out motors/ESCs, because for some reason the ESC PWM are dropping frames if the RC_SPEED isn't a multiple of the ESC max Hz, which in turn causes them to cycle between max/min rapidly and makes them heat up within 30-60sec, as well as run erratic at low speeds. Where should I post the problem and settings used as a solution?
To solve it I made RC_SPEED 500 or 250 for 500Hz ESC's and 300 for 600Hz ESC's and I haven't had the problem since. Funnily in 3.5 you had it default to 300, which just so happened to sync with the 600Hz ZTW ESC's we used at the time for the quadmotors on the quadplane! After changing to Little Bees and DYS etc that are 500Hz, we were having smoking motor's and ESC's every meet...and couldn't figure out what on earth was going on, as they ran fine on a servo tester/RX etc.
I do think it would be fun to graft the shuttle boosters or SR71 engines onto a 747 and test fly the worlds biggest quadplane ...
@JB, it would be interesting to try an X-Plane QuadPlane, but I am not sure it will work. It worked for fixed wing and helis as the control bandwidth needed is quite low. I am typically getting less than 30Hz sensor data from X-Plane 10, which is enough for planes and helis, but would be very low for a multirotor.
I would guess it would work for larger quadplanes as they can work with a lower update rate, but I don't know exactly how large it would need to be.
Some people are getting much faster network rates out of X-Plane, up to 100Hz or so. At that rate I think even a small QuadPlane would probably work.
@Seno, yes, SITL is way better. We'll probably remove HIL support in a future version. The lag of HIL is just too much.
This is great! I've been working with HIL simulator for X-Plane (the old HIL version), but it seems like your SITL version is far more superior. I will test this immediately!
Now I have to make some X-Plane quadplane models...
Great works