mavlink/qgroundcontrol — pull request #698 by DonLakeFlyer (2014-06-11 02:08:45+00:00)
Title: Flight Gear

Disregard the separate commits in here. I will commit with good comments directly to master after folks are happy with the code review. I'm eventually committing direct to master since these changes cause merge conflicts which are a huge nightmare to fix. Already communicated the plan to Lorenz and Thomas.

This set of changes fixes FlightGear+HIL to work on all OS. Current state of master is only Linux works, all other OS fail. The goal was to not only make it work on all OS, but to also make it way less fragile to setup differences.

Changes:
- FlightGear+HIL works on all OS
- HIL settings from the config ui are now saved run to run
- Assumes FG3, so no separate terrasync server process, sets—enable-terrasync as command line option
- You can compile in or out connection debugging using the DEBUG_FLIGHTGEAR_CONNECT define
- Programmatically attempts to setup communication protocol in FG protocol directories. If that fails it gives you sudo command on clipboard to do it yourself.
- Windows reads fgrun preference file for —fg-root, —fg-scenery and exe name and location. This is needed on windows only since fgfs exe location can vary, and 32 or 64 bit can vary as well.
- Linux tries —fg-root in /usr/share/flightgear/data/ (Archlinux) and /usr/share/games/flightgear/ (ubuntu)
- Incorporate Thomas’s changes
- Removed atlas from default options since separate atlas app is not started by default, you can add yourself and it will be saved to you settings
- Both --fg-root and --fg-scenery can now be specified in the ui options for non-standard install locations
- If we can't find the application location in the normal locations we will prompt with a file picker to specify the app location
- Had to fix the threading model changes in master. As it stands, ::connectSimulation checks all the prerequisites and reports back failure to ui. This needs to happen on main thread, hence needed to move a bunch of stuff back to ::connectSimulation from ::run. The code which needs to be in the secondary thread is still in the ::run method.

I'm sure I missed some other specifics. I've been working on this forever with lots of little tweaks to make it less fragile. On Windows there is still a crash when you stop HIL which I haven't been able to figure out yet. But given previously you couldn't get Windows+FG+HIL to work at all, I figure this is still an improvement. After I get his through, I'll look at that bug and there is also still a lot of secondary cleanup I'd like to do across all HIL implementations. But for now, I've been sitting on this too long, so it's time to get the changes in.