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.
Comments
Thanks in advance for the pointers!
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.
I'll post it soon!
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.