Developer

X Plane Integration



I wanted to get a hardware in the loop sim running in X plane and I wanted to document my first attempt. I've been able to connect the ardupilot using a binary protocol and a custom Perl socket server based on the work of Jeffery Goff http://www.perl.com/pub/a/2004/07/09/xplane.html

I have everything in place, but a lot of tweaking to do. The really nice part is that there is no extra hardware or soldering to do. The IMU parser will read in the X plane output. The GCS_Xplane.pde when finished will output binary to Xplane. I'll have it working hopefully in the next rev.

If you want to try it and help make it better, I could really use the help. If you've never heard of Perl or Serproxy or Sockets, I don't think I'll be able to help you get it running.

Here is the flow of information
Ardupilot <-> Serial Port <-> Serproxy <-> Perl_AP_glue <-> Xplane

Here are the files to make it run on 2.6.2.


GCS_None.pde - I modded GCS_None.pde to output binary control surface data.

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Thanks Michael - I want to be able to port any control variable I wish to the screen to see what's up with it. I've managed to get my Perl script to work though. I had a problem with the SO_REUSEPORT which was causing my Perl CLI to get upset. I've subsequently commented out ReusePort => 1, in line 50 of Xplane.pl and that little problem is fixed!
    home.pl : Najlepszy hosting. Domeny, serwery, e-mail, sklepy internetowe, SSL
  • Developer
    Andrew, What extra data do you want out? ill see what i can do.
  • OK, for the record, I have managed to get serproxy working on my x64 platform by telnetting to it. That doesn't seem to be the problem. Looks like I'll have to educate myself some more about Perl scripts etc.
  • Can anyone shed any light on this little problem I have? I've had X-Plane and APM working well with Michael Oborne's ArdupilotSim program, but I want to get more data out than he makes available with it, so I've headed in this X-plane.pl and serproxy direction. Now being a Perl numpty, I don't know what I'm doing wrong, but serproxy sits there waiting for a client and the perl script seems to execute rapidly in an OS shell and disappear. X-plane behaves as if nothings happens. I'm wondering if serproxy runs on x64 platforms? Any hints from out there? I'm running the serproxy cfg as Com3 and port 5333, 38400 baud and nils=false. What else am I missing? Which order should I fire everything up?

    Thanks in advance for the pointers!
    http://X-plane.pl/
  • Hello Jason,

    Have you test the IMU information from XPlane into your attitude algorithm estimator?

    I'm currently on it (using the XPlane default RC plane as test vehicle), and I encountered some "problems".

    - I have notified that many XPlane information doesn't follow the same sign criteria (if you take X axial front, Y right wing, Z vertical down), e.g:
    1. GLoad side is measuring left wing instead right wing (you can check it while you are in ground with brakes on).
    2. Vertical speed is Vy instead Vz.

    And I don't know yet what are the units of other quantities, like pressures (aiming for simulate the air speed sensor).

    May I be wrong? Have you found other "mistakes"?

    And do you feel comfortable with the readings of the accelerometers? The attitude estimation works really bad with them.

    By the way, If someone is interested, I've written a little C code (actually is a tiny version from http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml with a 3D rotation from attitude given by XPlane) simulating 3D magnetometer as XPlane.
  • Developer
    Update: I have just about finished everything to you need to do full hardware in the loop for Ardupilot and soon Mega (should be easy now.) I've already squashed a few Ardupilot bugs from the couch.
    I'll post it soon!

  • Well you got the brains so you might as well do it :) Can you make your fly-by-wire sim allow for full attitude?
  • Developer
    The Futaba transmitter talks to the RX which sends PWM to the Ardupilot. This is standard.

    Then ardupilot outputs pitch, roll and throttle commands to the computer using a simple binary protocol.

    I user serproxy to relay that info over the network to a perl script which can talk to X plane over the network.

    I would skip serproxy but I couldn't get Device::Serial compiled and working for Perl.

    Xplane listens to UDP packets and sets the values, then the whole thing goes in reverse as Xplane sends the telemetry data of the plane. The Perl script reformats that data to match the IMU binary format and tricks out the Ardupilot hardware which can't tell the difference.
  • That's cool. So the tx is hooked up to the laptop and xplane sim fowards the commands to the ardupilot? Trying to understand how it works??
This reply was deleted.