X-Plain Simulator Setup

I found the instructions for setting up the Simulator a bit sketchy.  

I got it working on my Dell Latitude D830 laptop with Windows 7 Pro 64bit. I'm using X-Plain 9.21rc2,  the AruduPilotMega Planner 0.5 by Michael Oborne, ArguPilot Mega with IMU shield and a Spektrum 8 receiver / transmitter.I was not sure how all this fit together but I think I understand it now. Here is how I understand it now.

  1. The Radio communicates with your receiver.
  2. Your receiver talks PPM to the APM inputs.
  3. The APM, with a few special changes in APM_config.h, is told to send X-Plane data 
    USB port on the IMU shield.
  4. Using the FTDI serial driver the ArduPilotMega Planner connects to the APM and opens
    the network port 49005 on localhost IP ( for X-Plane to talk to.
  5. X-Plane, with a few settings, sees the data on the port and acts accordingly.

My transmitter is programmed for a simple four servo plain no mixing.

The switches on my IMU, from left to right are  UP, UP, UP Down, when you are facing the switch.

This turns off the IMU mixing. 

In the ArduPilotMega Planner, I set my comm port and check the Reverse box for Roll, Pitch and 


For a time I could had trouble getting all the controls to register.  After checking and rechecking my

connections I got it to work find. 


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

Join diydrones

Email me when people reply –


  • can anybody tell me is there a way to interfere the PPM singnal from RC receiver to arducopter board ?  i was trying to read the value using pulsein() and write using servo mapping 1000 -2000 0 -179 didn't work :( 

    please help me thanks in advance

  • I hope you can help me with setting up X-Plane... I did everything from manual, but I can't get any data like Plane GPS, Plane IMU or Ardupilot Output to fill the screen in Ardupilot SIm program.
  • Developer

    I am glad I found this discussion. I am tying to get this going on a PowerBook (runs X-Plane 9) and a HP G-60 laptop running ArduPilot Sim from Planner.  I have FlightGear 1.9 on both to help get this going. I used Jean L Naulan's AFG_Control on PC and FlightGear with ArduPilot (168) over a year ago but with good success. 

    I don't get any data in GPS with FG or X-Plane. I could get no manual control.

    I get !! loc err a lot.

    I will try slowing down X-Plane UDP to 10/sec. 

    I use a APM 1.0 beta version with NAV-DOP, GPS message data turned on.  I added this for HK_GCS. 

  • With a little work I'm getting stable flight from an X-Plane simulator.  Getting the airspeed throttle stable was the hard part. I'm sure this can be made better. The "default" setting did fly but resulted in 0 to 100% surges in the throttle.

    I ran around and around on all the PID numbers until I found the Throttle Gain on the Sim interface resulted a more stable flight.

    Is there a good description of what the Sim Gains do and how they should be set? 

    There are my PID settings.

    3692146495?profile=originalHere are my gain settings.  You'll see how the throttle is still surging but it is better controlled.



    I found my problem.  My PID settings where all zero (0).  After thinking through it I concluded you can't control the change if you don't have a value to change it by.

    I changed my PID through the APM Planner (Action/PID Config) to the values I found here. http://code.google.com/p/ardupilot-mega/wiki/MPPID

    Now I need to work out the perfect PID Values for the X-Plane RC. Anyone know? Really the only issue is the throttle sarges. 

  • Developer

    Ok, i just tested everything on a Intel Celeron 1.7 gig (single core), and managed to make it all run. The main things i did was


    run xplanes full screen at 1024x768, and lower every display settings, and in weather change the visibility to 5 nm.

    This got it running at about 30-50 fps while sitting still.


    in the data in out screen i change the UDP packet rate down to 10 hz. i usualy run 50. Basicly whatever you change this number it relates to how much cpu Ardupilot sim will use. As packets are sent to the APM at the same rate received from xplanes.


    Normaly i test on a 3.2gz I7, so multiple cores and lots of cpu and graphics power.


    if you have a look at http://www.x-plane.com/pg_Sys_reqs.html  the laptop i used is below spec apart from memory, it had 2gb 

  • I've made more progress but I still can't fly a mission.

    I was having big issues with X-Plane getting a high frame rate. I recommend you display Frame Rate on the screen so you can keep track of this. (See my settings pic.) The screen rate needs to be higher then the UPD rate feeding X-Plane for good results. I fixed this issue by running X-Plane on a different computer then the Flight Planner / ArdupilotSim.  To make this work, I had to program the ArdupilotSim program to connect to X-Plane at a different IP then  I added two new text fields for Simulater IP and Port.


    3692144723?profile=originalThis IP and port send the control data to X-Plane ( I set the IP address and port in X-Plane to send it's data back to the ArdupilotSim program ( port 49005).

    3692144770?profile=original With my connection to X-Plane working. I added these lines to APM_Config.h, compiled and uploaded the code to my APM.

    Using APM PLanner 0.4.12 by Michael Obone, I added a few way points and started flying.  Here are my waypoints.


    #define WP_RADIUS 30 // What is the minimum distance to reach a waypoint?
    #define LOITER_RADIUS 45     // How close to Loiter?
    #define HOLD_CURRENT_ALT 0    // 1 = hold the current altitude, 0 = use the defined altitude to for RTL
    #define ALT_TO_HOLD 600

    float mission[][5] = {


    I found my Mode switch has three modes, Manual, FBW-B and Auto. In manual I can fly all day. In FBW-B mode the plane doesn't fly to the next waypoint and I can only control the rutter. In Auto mode I can control everything but the throttle.What am I missing?

    Here is my X-Plan settings.

    The APM code I'm using is the code is the latest "Release".



  • I still have not yet got a HIL simulator working all the way. I'm beginning to learn all the issues. I have been able to fly both the X-plane and FlightGear simulator through the APM but I have not seen the GPS tracking data return back through to the Ground Station.

    After creating cables for all the serial ports and connecting things like the GPS emulator to the APM it came to me; What if I used a second APM to encode the flight APM's PPM output and send serial GPS data from the simulator to the GPS port. This would fix a couple of issues that bother me. 1) You are not flying the "real" code when you run a HIL now and 2) it would embodiment the testing code.

    The code should be simple enough. The APM code is already reading PPM and translating it into joystick code for the simulator. Reading the NEMA code and formating it as GPS code for the APM should be simple too.

    I have only one issue. I've looked for days and even studied the PERL code that talks to the simulators. I'm still confused about how best to that interface. Because there is no network, serial would be the best way out of the hardware so a utility to read that and send to the simulator would be needed.

    Does anyone know of "GOOD" example of code to interface with either X-Plane or FlightGear?
  • I'm on the edge of getting HIL working. Right now I'm just trying to get it to Fly manually. The biggest issue is the timing between FlightGear (FG) and the output of the APM. It is easy to over run FG's input and then the controls become unresponsive.

    I'm finding FlightGear is easier to work with the X-Plain. To bad there is not an API interface to RealFlight.

    The biggest issue seems to be that APM overruns the input of FG and causes it to be very sluggish. I have found turning off as much of the display features as I can helps increase the frame rate and gets working just fast enough if I can get it over 40fps.

    Is there a way to slow down the updates coming from APM?

    Also FG uses a IP interface. Is there a way to change the IP used by the Simulator? I could then run FG on one system and APM and the simulator on another.
  • Developer
    Cool, Try the RC planes in Xplane. They should match the default PID settings a little better.
This reply was deleted.


DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
DIY Robocars via Twitter
RT @DAVGtech: Another incident: https://t.co/G1pTxQug6B
DIY Robocars via Twitter
RT @DAVGtech: What a great way to connect why @diyrobocars community is so valuable and important! Have to start somewhere @IndyAChallenge…
DIY Robocars via Twitter
RT @DAVGtech: https://t.co/GwkbSBjdGa
DIY Robocars via Twitter
RT @DAVGtech: Good morning from @IndyAChallenge at @IMS. It was a late night, but worth it. Come see for yourself how the pass ended and ch…
DIY Robocars via Twitter
RT @circuitlaunch: Robot fun this Saturday (23) at Circuit Launch! From 10am to 4pm. Lots of robots, autonomous car racing training, tech t…
DIY Robocars via Twitter
RT @chr1sa: 10 of these autonomous racecars will be competing tomorrow at the Indianapolis raceway
DIY Robocars via Twitter
RT @a1k0n: Sync'd @joshu's GoPro w/ my datalogging; video is 2.5X speed, Google imagery upper-right. Found out my track boundaries are WAY…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Also, at 45mph, the front tires literally blow up like a balloon and it doesn't have much front traction, so the car becomes fai…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Okay, some datalogs! Green dots are precalculated racing line (from my crummy optimizer -- it veers to the middle after 2 for Re…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Welp my @selfracingcars entry, hastily conceived heading filter and all, actually worked! Heading home, datalogs and videos to f…
Oct 18
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
Oct 15
DIY Robocars via Twitter
RT @f1tenth: What can we learn from autonomous racing? Actually, a lot! To get an idea what you can do in this field and where the research…
Oct 11