Hi everyone.

Are you trying to test your control law, that you implemented in Simulink, on a flight simulator (e.g. X-Plane) and see how it  performs before you actually try it on your drone?

Then this is the right tool for you!!

This is basically some Simulink models that allow communication between Simulink and X-Plane 10 (Yes X-Plane 10, not 9!)

Simply, it decodes the UDP data packets coming from X-Plane to meaningful data (roll, pitch, yaw, rates...etc), so you can use them in your control design!

Also, it allows you to send commands to the plane in X-Plane (e.g. control surfaces, nosewheel and many!!)

I know many of you (developers, researchers, or even hobbyists), myself included, have been looking for such tool. Probably since long time, like myself!

I also know that there are many people who have already done that, but I can not easily find such tool that can be just downloaded and used immediately.  So I thought of just doing it and share it with you guys.

These are basically three models.

1- 'setup_xplane': it sends some commands to xplane to tell it what data to send back (e.g. attitude angles, rates, GPS data..etc). Basically, it checks the boxes of the requested data in the 'Data Input & Output' screen in xplane

2- 'getData_from_xplane': it receives requested data packets from xplane, then decipher them to meaningful information.

3- 'commands_to_xplane': send commands to xplane to manipulate the plane actuators (elevators, ailerons, rudder, nose wheel). However, it's not limited to that!! You can have almost full control of the simulator environment, by sending the appropriate commands.

Again, this is tested successfully on X-Plane 10 NOT 9. However, it can be modified to talk to X-Plane 9 (you will do that; yet, i don't see why you still use X-Plane9 anyway!)

Feel free to play with it and tune/modify/improve/copy/redistribute it, for good, but please at least keep the credit :)

I hope you find it useful for you guys, and I am waiting for your feedback.

[Codes here]


[EDIT] July 2nd 2014

I did a little modification on the nose wheel  control signal. It was not working properly. Now it does.

Inbox me if you are interested in the modified version.


[EDIT] Jul 6 2014

Files are moved to Mathwroks File Exchange website

Link here

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

Join diydrones

Email me when people reply –


  • Hi Mohamed

    while i was trying connect the simulink with x-plane i opened all m files(getdata,send command and setup_x-plane ) i get a error.

    "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.
    Use 'mex -setup' to select a supported C-compiler."

    Do you have any advise

    • @ thevenin:  Could you contact me by email?

      • yes i contated to you by e-mail at 10.44 today

  • Hi Yoga,

    I am glad it serves your needs. It certainly helped a lot in our lab, too. It facilitates the process of simulation testing and control design.

  • I have found this UDP very useful as it is very configurable. I could adapt it to a helicopter X-planes model and set the various parameters like rotor rpm, pitch etc. Getting the data back is also very easy and I could close the loop on an X-planes helicopter model using Simulink. Thank you.

This reply was deleted.


Hiroki Tanaka liked Hiroki Tanaka's profile
Oct 13
Derrick Davies liked lisa TDrones's profile
Sep 23
xemone liked Max Gilson's profile
Aug 31