Matthieu LABAN
.NET, My Life, Flight Simulation and Real Flight...

 
About Me :
25 Years old developer and aviation
enthusiast living in Santa Clara, California.
View Matthieu Laban's profile on LinkedIn 
Contact me at :
mlaban at gmail dot com


Photo & Video Galleries:
- Gallery List
- Flight Videos
Resume :
e-mail me to get my latest résumé
Autopilot Test Flights 

After some tweaking, I finally got all the components of the Autopilot working. To stress test the system, I coded a simple GPS DirectTo function that automatically switches to another airport within a 25NM radius once the airplane is within 1 mile of the destination waypoint, and keeps doing this forever...
It's real fun to watch the airplane fly around by itself :)

I recorded a two tracks of flights in the bay area. (Click to view in Google Earth)
-> PAO, SJC, E16, WVI, OAR, SNS
-> PAO SJC, SQL, SFO, OAK, LVK, SCK, MOD, PAO

Due to the lack of implementation of a speed controller in the first one, there has been some glitches during the flight... Climbing to a defined altitude without adjusting the throttle was causing it to stall and overcontrol...

It's interesting to watch how all the controllers are fighting with the ailerons to match the target heading and altitude...
Thankfully, I implemented an autopilot circuit breaker (a keyboard key ;)) to disconnect the GPS and Autopilot in case of trouble! :)

Latest screenshots:

Autopilot 

Yesterday, I made an experiment on FSP... I let it run the entire day while I was away in San Francisco for Fleet Week (cool event!, loved the low pass of the Blue Angels!). When I came back, the app had eaten around a gig of memory... (for 8 hours). Not good... It's leaking memory somewhere... even though the airplane was standing still and not doing anything (no terrain tile loading/generation).
Then I occurred to me... I needed a way to make the airplane fly on autopilot to check that the simulator can run for long periods of time, especially with the terrain system in action.

It's been almost a year since I worked on the aircraft systems in FSP.
Last time was about implementing an autopilot. I took some time trying to implement it and I got side tracked somehow... But now that I need it, I decided to look into it a little more seriously. Went back to wikipedia on the PID Controller page, and during this year time, contributors made a lot of additions to the page, including graphs and pseudo code. 

I remember last year getting freaked by the formulas, and not remembering much of integrals and derivatives from school. Then after setting the problem down in terms of pseudo code, it all made sense... The pseudo code that is now on the page is similar to the one I did last year, which is pretty cool :)

Makes me think though... I remember at school being so lousy in math and wondering what the hell these derivatives and integrals could even be used for...
Perhaps:
 - 1: I really sucked to begin with
 - 2: It was not properly explained and lacked real world application...

If it was explained properly with real world applications, then I don't understand why I didn't get it...
There's probably a bit of both ;) BUT, I don't remember ONE single exercise that actually pointed to a REAL life example of where integrals and derivatives could be used... It was all "Exercise 1.1: calculate this. Exercise 1.2: calculate that..."
I even recall once where I asked a genuine question to my professor:
"So, what is this used for in real life? Do you have an example of something that actually uses this?".
I think thought I was being sarcastic and got all upset about it! Perhaps he didn't know any real application? Who knows...

Anyway, this is a message for everyone out there who is scared of integrals, derivatives and other signs in formulas... try to lay down the problem and remove the "I'm smart at math, check out at my formulas!" feel by typing the pseudo code and breaking the problem into smaller pieces.

Anyway, back to FSP... I integrated a small PID controller class. It works well now, but will need some tuning of Kp, Ki and Kd to function even better...
The first thing I wanted to test this with was an autopilot HDG (heading) mode to fly a certain heading and maintain it... I quickly realized that to do this, I need 2 PID's. One that will control the other one...

PID1 will be the controller that will monitor the heading and make corrections to it by controlling...
...PID2 which will be responsible for maintaining a bank angle.
It's the same for other axes:
Altitude mode, will maintain the altitude by setting another PID that will control a rate of climb.

That's going to be fun stuff! Last night, I implemented the bank angle system. Works pretty well, and useful when the plane gets out of control.
What it does is take the input values, angle, time, and calculates the output which is fed to the control axes system. So it acts like a real autopilot by moving the ailerons!
It's really fun to put the plane in unusual situations and watch the autopilot move the ailerons automatically to recover!

Tonight, I'll try to chain this to the heading controller, and my heading Autopilot will be done! :)

Comments about Latest Version of FSP 

Quick comment about the latest version of FSP... Turns out there was sort of a memory leak due to a surface being allocated on my behalf by Managed DirectX... It took me quite some time to figure out who was creating that many surfaces. I realized something was wrong when the app started to take years to exit while being locked forever in a DeviceLost event... All the surfaces were being hooked up to that event, and one surface per frame was created... yeah... Nop wonder the game crashed randomly after some time...

This is fixed now, I'll release something soon... with probably a new name for the project ;)
Stay tuned!

Also, the min specs have changed for the latest release. The game now requires a Shader Model 2.0 video card that also supports Multiple Render Targets (at least 2). Check you video card specs for this feature.

 

Small patch to FSP  

Turns out, there was a small glitch in the version of FSP I released a couple days ago. It wouldn't launch unless you had debug version of the CRT. (Installed with Visual Studio 2005).

I released a patch that is available for download on the FSP Page.

 

Flight Simulator Project Version 2.5 is out ! 

Yes, it's true! 1 year a 3 months after last release, I finally decided to release a new version! It took me a day to clean all the code, fix obvious bugs and prepare the release package.

There are so many changes in this build... the list of what's new would be so long... I updated the readme with the most obvious ones. Here is an abstract from the ReadMe file.

  • - Reworked the terrain engine. Theorically supports the entire earth. Just needs data.
  • - New flight model: 
    •  - Takes into account wing specifications and all types of drag (lift-induced, parasitic...)
    •  - Added flaps (behavior is not tuned.)
    •  - Added a load and balance window (Aircraft->Edit Flight model->Add Weights...)
    •  - Better simulation of crosswind. Not only acts on the rudder but on the entire aircraft body.
  • - Added support for models coming from the Google 3D Warehouse. Just drop the models kmz files in ./Airports/KPAO/
    Note about the kmz files. Due to the poor quality of the Google Sketchup Collada Exporter, extremely low performance can be observed when loading certain models. If this happens, try re-exporting the models with the latest version of Sketchup, or if you are the creator of the model, then try reducing the number of objects, materials and polygons in the models.
  • - Added support of background loading of terrain. This is still work in progress. Lag can be observed during the loading of the tiles. Note that tiles, once generated, are cached so subsequent loading of the same tiles will be much faster.
  • - Added new realistic atmospheric scattering rendering (sky colors)
  • - Added time of day simulation. Use shift-A and Shift-Q to modify the time.
  • - Added option to turn on/off anti aliasing

There are some regressions in this version:

  • - Cockpit support is broken
  • - No post processing effects can be used
  • - Only 2 airplane models are available. Others will be back online soon.
  • - Retractable gears are no longer working
  • - Speed indicated at the top left of the screen is buggy
  • - Some Z-Fighting occurs in some places
  • - Numerous other bugs...

To download the latest version of FSP, click here!