Hi guys,

This is not really a post about something new but rather a summary of steps others did before me and a little help to my personal memory (already forgot once how it works). The post is referring to ArduPlane but I don't see what would be different for ArduCopter. Would also like to say thanks to the developers here :-)

The problem: you want to get a HIL simulation running without windows (i.e., on a Mac or linux system) using the latest APM git repo code and QGroundcontrol as the GCS.

Outline of one possible solution:

  1. Install dependencies: ArduPlane (git version), QGroundcontrol 0.9.0, FlightGear V2.4.0, python 2.7, pyserial-2.5, MAVProxy (git version), pymavlink (git version), arduino-0022 and cmake 2.8.6 for building and uploading APM code straight from console
  2. Copy MAVLink.xml to FlighGear protocol directory (for Mac OS: /Applications/FlightGear.app/Contents/Resources/data/Protocol/ )
  3. Start MAVProxy: python2.7 mavproxy.py --master=/dev/tty.usbserial-A600dLKS --fgout=localhost:5010 --fgin=localhost:5000 --out=localhost:14550
  4. Start FlighGear with parameters: --generic=socket,out,40,localhost,5000,udp,MAVLink --generic=socket,in,45,localhost,5010,udp,MAVLink
  5. Start QGroundcontrol
  6. Enjoy :)

More detailed info on dependencies and configuration:


  1. git clone https://code.google.com/p/ardupilot-mega/
  2. cd ardupilot-mega/ArduPlane
  3. Modify APM_Config.h:  "#define HIL_MODE            HIL_MODE_ATTITUDE"
                                          "#define HIL_PORT            0"
  4. cd ..
  5. Follow instructions in README.txt for building and uploading code (essentially, assuming arduino1280: mkdir build && cd build && cmake .. && make ArduPlane-upload )

B) MAVProxy and pymavlink: (note: should be in the same directory(?)):

  1. mkdir APMHIL
  2. git clone git://git.samba.org/tridge/UAV/pymavlink.git
  3. git clone git://git.samba.org/tridge/UAV/MAVProxy.git

C) Setting stuff up (modify paths according to your installation paths):

  1. export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7:/Users/andre/pyserial/lib/python2.7/site-packages
  2. export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH

D) Trouble shooting:

For my EasyStar I had to fix rudder control to 0 and invert the direction of elevator control. This is easily done by the two modifications inside mavproxy.py:

status.rc_elevator = (-1.0) * scale_rc(m.servo2_raw, -1.0, 1.0, param='RC2')
status.rc_rudder   = 0.0;

Also: every time one starts FlightGear one needs to start the engine manually by pressing 'S', which is annoying :)

E-mail me when people leave their comments –

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

Join diydrones


  • Thanks Robin,

    Haven't been playing around with simulations anymore but I'll look into it again and give it a try.



  • Hi Koen,

    I got some updated settings from Section 6.5.2 of http://mapserver.flightgear.org/getstart/:

    fgfs --native-fdm=socket,in,60,,5503,udp --fdm=null

    worked for me, where 5503 was the default --fgout argument passed to runsim.py by sim_arduplane.sh. It seems that MavProxy is no longer responsible for forwarding info to flightgear, it comes directly from the runsim.py script.


  • Are the settings as described still valid for MAVproxy, I don't see any fgout options in the current version. How do I feed in and output to and from Flightgear if these aren't specified?

  • sent you a friend request. If you accept we can send PM like email (or I can send you an email address).

  • I get a lot of errors. do you have an email I can send you a .txt

  • Hi,

    Sorry again for the late reply. Didn't notice your post. What exactly are the errors you get? I'll check out the current repo versions at the weelend.

    Cheers, Andre

  • Hi again, I am still having all sorts of problems. After I run cmake I try to upload with "make ArduPlane-upload" however I get so many warnings and errors it fills my screen. They are all located in ArduPlane.ccp that is created after cmake. I suppose I am using the wrong version of the ardupilot mega code but I'm not sure. Is there any chance you could point me to the right versions of ardupilot-mega, mavproxy, and pymavlink code. I do not think the git versions are the right ones.

  • Hi Aaron,

    sorry, just saw your questions. The value for the "--master" parameter depends on your (windows, mac, linux). It's the serial port your APM is connected to. Your're right, that was sort of missing from the instructions. So if you live in the windows world that may be COM0 or COM1 or something.. Hope this answers (both) of your questions... Andre

  • Hey Andre. I am completely new at all of this so if you or someone else could give me some pointers. I am having a hard time following your instructions. I downloaded all of the dependencies and I think I installed them correctly, however, I can never get the --master=/dev/tty.usbserial-A600dLKS command to work in terminal. Next do I need to connect the APM board to the computer at a certain point, it is not mentioned in your instructions. last I do not understand you instructions concerning flight gear. How do I change the parameters?

    Any explanation would help me out alot. 


  • Alan, if I find the time I'll give it a try but in the meanwhile if you have concrete questions then PM me, just sent a friend request. Cheers, Andre

This reply was deleted.