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é
Oakland, Tracy and Palo Alto 

I accidentally smashed my camera when I was in Quebec last week... so I had to get a replacement. I chose a Panasonic DMC-TZ5.
It's a pretty good camera, so far, the only negative points I have against it are the lack of an optical view finder which makes it hard to spot moving airplanes...
Second point is the fact that while connected via USB, the screen is on full blast, which drains the battery like crazy... Seriously... people...

The reason I chose this camera is because it has a wide angle lens (28mm) and a powerful 10x zoom! And also, it can take HD videos at 30fps...

Anyway, I coulnd't really test it on the ground, so I scheduled a flight in a 7ECA. Bruno had an aerobatic practice session at Tracy and needed a ride...

I flew to Oakland just after the marine layer melted, picked him up and then we flew to Tracy.

On our way there, we overheard a poor guy on the radio coming from Livermore, who wanted to fly to Half Moon Bay via Bravo... and apparently, he got overwhelmed and decided to fly back to Livermore...
SFO class bravo can sure be overwhelming...
If he ever reads this though, he could have done this easily by flying lower and only talking to Palo Alto or San Carlos towers. but technically, it is possible to fly from Livermore to Half Moon Bay by staying clear of Bravo and any Class Delta airspaces.

Anyway, Tracy was hot... and we had a good time watching and filming Bruno, Mike fly around :-)

Once I got back to Palo Alto, I took some pictures of planes landing with the new camera. Even without the viewfinder, the pics are quite amazing, and the 720p@30fps videos look great!

Here's one I took of the same citabria I flew, coming back from a flight later that day...

Youtube has the "HD" version on their site, just click on the video to see it.

And finally, some pictures I took yesterday. I love this camera :)

Propellers in Infinite Runway 

I'm glad to say that aircrafts in Infinite Runway are finally being propelled by actual computation of lift coming from rotating airfoils :)
 
In my last post, I wrote that I needed the following to properly simulate the propeller:

  • propeller pitch
  • propeller blade velocity at a specific angle (relative to the propeller itself)
  • airflow velocity (relative to the airplane)
  • angle of attack at a specific rotation point (function of the propeller blade velocity above, and the airflow velocity)
  • propeller RPM
  • air density
  • propeller diameter

It wasn't that difficult afterall. I managed to get all these info from a few vector computations. (except the air density, which is coming from elsewhere)
 
To get the lift generated by a blade, Infinite Runway does the following: 

  1. Get the velocity in feet/min of the propeller at 3 O'clock (the descending one)
  2. Create a vector pointing downward from the propeller blade
  3. Get the aircraft velocity at that point on the blade (taking into account the wind)
  4. Substract these two vectors to get a vector representing the velocity of the blade relative to the air flow
  5. Compute blade pitch vector. (Point a vector down, and rotate it by 'Pitch' degrees)
  6. Get angle of attack of the blade by computing the dot product between the normalized results of 4 and 5.
  7. Run this angle of attack and blade velocity (length of non normalized result of 5) through the code used to compute lift/drag for wings (which takes into account the atmospheric pressure, amongst other parameters)
  8. Get the lift force, and apply it on the PhysX model.
  9. Repeat for 9 O'Clock (some small tweaks and vector inversions required obviously)

This gives pretty accurate results. With the previous model, where a simple force was applied, it was easy to reach over VNE during stable flight.
Now, it is much more difficult as the angle of attack of the propeller blades will decrease with the airspeed, decreasing the generated lift required to accelerate the aircraft further. A variable pitch would be required in this case.
 
Also, this takes care of the P-Factor as during climb and high power settings, the descending prop will have both a greater angle of attack and a higher forward speed than the ascending one. This combinaison of factors cause more lift to be generated from the descending blade (3 O'Clock position), inducing a yaw to the left, which is why we have to apply right rudder on take off on most airplanes.

Below is a video showing the result of the blades lift generation.
Graphs:

  1. Difference between left/right angle of attack
  2. Right Blade angle of attack
  3. Left Blade angle of attack
  4. Right blade speed
  5. Left blade speed
  6. Overall angle of attack of the airplane. (not wing specific)

The first graph is the most representative of the effect where we see that both blades don't have the same angle of attack for any given aircraft pitch attitude. Click on the link below the video to view it in High Def and see the graphs in crystal clear quality ;)

Vector colors:

  • Blue is current aircraft velocity
  • Red is aircraft Up
  • Green is the pitch
  • Yellow is the current blade velocity


P-Factor Tests in Infinite Runway from Matt on Vimeo.

Propeller Simulation 

The more I read about it, the more I feel like propulsion theory, although very similar to regular airfoil theory, is much more complicated...
There are lots of variables that come into play when trying to simulate this. I'm currently trying to gather some data, formulas, papers about blade theory...
The problem is that some of them go way beyond what I could implement easily in Infinite Runway.

The hard task is to find the right balance between a flight simulator, and a propeller simulator... Gosh! there are complete books about this topic!
If I were to implement a propeller as real as possible, it would take me years, and Infinite Runway could be renamed "Incredibly Precise Propulsion Simulator" but it would stink at everything else... (flight model, 3D graphics...)

The current approximation I'm targeting right now is how to accurately compute the thrust at 4 or more points on the propeller blade.

This requires a few variables:

  • propeller pitch
  • propeller blade velocity at a specific angle (relative to the propeller itself)
  • airflow velocity (relative to the airplane)
  • angle of attack at a specific rotation point (function of the propeller blade velocity above, and the airflow velocity)
  • propeller RPM
  • air density
  • propeller diameter
  • ???

That is a lot of inputs... So far, I've found only pieces of the solution, no magical all-in-one formula...

I was thinking that using my current system to calculate lift for the wings would work for the propeller as well though... since the blades are wings really, only small rotating wings... they can for instance, stall, just like real wings...

I'm mentioning this part, since propeller handling in Infinite Runway has always been very badly implemented... It's always been a force applied where the prop would be... Not really what happens in real life... but it follows the Infinite Runway principle...

"It's not optimal, but it'll do until I come back to it later on... in the mean time, I can work on something else that's much more fun" :)

Anyway, I'm focusing on this because I wanted to implement P-Factor in a more realistic way, and that effect cannot really be simulated with a 1 point thrust... or well, it could... I could just offset the thrust force to the right of the prop based on the angle between the aircraft's 'at' and its velocity...
The only issue is that this offset would probably have to be set by the airplane designer... It's a simple approximation but it doesn't completely solve the underlying problem, which is that prop pitch, lift and such are not handled in a correct way.

The 4 points approach I mentioned above might (should?) solve the P-Factor issue as well as the proper thrust/airspeed problem...

We'll see how it goes...

Silverlight DeepEarth Tests 

Tonight I played a but with an open source silverlight project called DeepEarth. It's basically a Silverlight implementation of Microsoft Virtual Earth. It has smooth scrolling and panning and blending between different layers.

They have a live demo up here.

Of course, having tons of flight tracks handy, I thought I would add the functionnality to show them. The project doesn't currently support dynamic objects besides simple pins. But the code is clear enough, adding new features was extremely easy...

I added a simple line drawer with an open dialog to import a track file coming from my GPS Tracker.

Here's the result for a touch a go practice at Oakland last year. :)

I have some ideas about what to do with this... we'll see how it goes ;-)

Progress with PhysX 

Lots of progress has been done on the PhysX front... My initial frustrations, although not completely gone have been mostly solved...

I now have OK ground behavior and am making progress on the flight front... I've updated two aircrafts so far, the Cessna 150 and the Citabria 7ECA.
Interestingly enough, the Citabria feels much more realistic than the Cessna 150.

Infinite Runway now can handle much more precise weight and balance configuration. I added a new system to configure shapes with weights that can be placed at different relative locations on the airplane. It's really nice to tweak the shapes that way to make the weight and balance as real as possible.



The next step from here will be to add new PhysX related things... I thought today that the Wind Sock could actually be simulated like a cloth! How cool would this be??

Now take a look at the following videos showing two wheel landing, a 3 point landing followed by a prop strike :)

Sorry about the poor quality of these videos... Vimeo had issues tonight and none of my uploads actually made it through. Youtube might have the HD version sometime tomorrow though...

 


Citabria Wheel Landing - Infinite Runway from Matt on Vimeo.

This last one shows a couple mishaps in the 150 :-)


Mishaps in Infinite Runway from Matt on Vimeo.

PhysX in Infinite Runway 

Don't ask me why... but I got this urge last week to change Infinite Runway's physics engine... It's a pretty stupid move as the physics engine is the most important part of a flight simulator...
Anyhow, I made the necessary backups and started to play with the NVIDIA PhysX SDK.

I chose PhysX over Havok for obvious reasons ;-) But I did look into Havok... They have a pretty extensive support for vehicles, and their SDK is so much cleaner than PhysX's... However, the feature set I need in IR (Infinite Runway) is pretty limited, and PhysX's Api is much simpler to use for this.

The few required things for IR are:
 - A good vehicle model and behavior (for take off and landing roll, as well as general ground handling)
 - A good suspension/spring modelling (for the landing part)
 - The ability to directly place an object in 3D
 - The ability to apply forces at specific points on a rigid body.

ODE (the previous physics engine) featured all of these... but I wanted to move a bit further by defining shapes for the wings, breakable constraints...

One big advantage that PhysX and Havok have over ODE is that they have remote visualizers. PhysX's visualizer and code setup is very much easier than Havok's though.
These visualizers come in handy when trying to figure out exactly what the shapes look like inside the physics engine. Without them, you are pretty much guessing, what the shapes actually look like in the eyes of the physics engine.
I might sound dumb saying this, but when you have to deal with cross Up Axis stuff, not having a remote debugger can be pretty nightmare-ish...

I spent the entire week end (except for a little break to go spin an Aeronca ;-)) trying to adapt IR to PhysX.

If I count the numbers of hair I pulled over the course of the port, I'd say it went like this:
 - 80% trying to deal with Up Axis bullshit... Thanks ColladaMax for not doing the conversion yourself! and Max for being ZUP...
 - 10% was spent trying to make the suspensions look realistic...
 - 10% was spent tweaking the physics up to where it is right now.

I encountered a lot of fluttering during the last part where I tweaked the flight aerodynamics... It was simply due to a misunderstanding of the several layers of Actors/Body/Shapes each of which have their own mass or density... After reading the doc, things got clearer although I'm still missing some parts about how to set the inertia tensor based on the shapes of the airplane...

Here's an early video of status for tonight... The ratios and lift/drag scales definitely need more tweaking but it's getting there...



The funny thing is that the actual aerodynamics part didn't change by a single bit. Its only input is a transformation matrix, and a velocity at specific points on the airplane. And since this is still the same with PhysX, only the values will have to be tweaked :) Hopefully, this won't take long!

About the ZUP issues... The problem was that the assets I'm importing are all oriented as if the Z axis was pointing upwards. And unfortunately, IR is Y UP... And so is the physics engine, as it it setup...
The trick is to inject a simple node at the root level of the aircraft that contains a slightly modified identity matrix. The children all carry this conversion when they are recursively updated. The physics engine and the rest of the game only deal with the converter node, and are then shielded from the UP Axis madness...

Below is a gallery of the latest screenshots taken this past weeks. I made some progress on the scenery modelling...

Remote Aircraft Flight Model Configuration System 

The citabria is almost done... The moving parts, cockpit, wheels, painting are all done and the flight model is close to the real thing now, thanks to a new feature of FSP called Remote Aircraft Flight Model Configuration System.
 
Tweaking a flight model in FSP involves two things:

  • Flying the airplane and figure out what's wrong with the flight model
  • Changing values to fix what's wrong

There are 2 types of values to edit in the form of straight floating point values (wing area, various coefficients...) or curves (lift and drag profiles).
 
Doing these editions while flying can be very painful because the game has to be paused to allow value editing without crashing. This laps makes you lose the feeling you had just before the value was edited... and when you know you are very close to the ideal value, it's frustrating to go back and forth between the game and the tweaking window...
 
There was an idea that had been in the back of my head for quite some time. Making this a team work. Obviously, doing it on a single computer is possible, but focus still has to be taken away from the main application, making keyboard shortcuts unusable.
 
The solution is to allow remote configuration, over some sort of connection.
 
After showing the Citabria video (see below) to Bruno, he told me he had to come and check it out!
 


Aerobatics in a Citabria! from Matt on Vimeo.

I thought, what a good opportunity to finally make the remote thingy work!
 
It took roughly 4 hours to make everything functional, with quite a bit of wandering around, exploring several techniques.
 
The approach I took was to use .NET Remoting. Remoting is great as it keeps me from having to mess with connection settings, sending data... A few lines of code can do all that setup work for you.
 
The initial idea was to expose the AircraftParams instance that contains all the aircraft flight model values, retrieve it on the other side of the connection, and display the proxy object in the property grid...
 
Unfortunately, this didn't quite work out the way I thought it would... The property grid was not happy about the proxy object and unable to traverse it with reflection :-(
Since I was certainly not going to copy every field manually to another instance, or even display properties in text boxes a la MFC, I needed another idea...
 
I eventually settled on something simple. Having a wrapper class what would be exposed through remoting, with a property returning a string containing the xml-serialized objects of the aircraft params.
 
I didn't serialize the entire object as I couldn't really replace it when the values were updated since it was referenced by others objects in the app. I could however replace the instances containing the flight model parameters, which are only used locally and have no events.
 
I added little helper to serialize/deserialize on both sides and voila!
 
Bruno and I gave it a test ride and he could fly the aircraft while I was tweaking the values on another machine! Pretty sweet!
 
Here are some pics of the tweaking flight... (Disregard the mess on the desk, it is temporary... ;)

 

Quick comment about the accuracy of news reports... 

I don't know about you, but when I read an article in the mainstream media (CNN, CBS, or any of those...) that is about any of the topics I have some knowledge in, there is always a WTF in it...
 
The one that appears the most is in aviation articles... like this one [cnn.com]

"The aircraft cracked in two after it crashed at the end of runway 220"
There is no runway 220... not even a 22... but a 20...
 
 Another example [dailymail.co.uk] :

"He said air traffic control had come on the radio and said 'climb, climb, climb 10,000ft, you are going to hit a plane"
 
Air traffic control would never say that, and they probably meant climb to 10'000 feet (from an altitude below that...)... You don't need a 10'000 feet avoidance maneuver to avoid another plane... And the news guys reports that, and make this complete BS the headline! Seriously...
 
On a side node, I find it also very shocking is that the guy reporting this horrible incident gave them his picture and told them he was the CEO of a website which was mentioned in the article... WTF is that about!
 
So I realize when I read those... what are all the stupid things that they write in the medical, finance, space stories that are completely wrong and misleading?? I wouldn't know, I'm no expert at those... but by extrapolating, I can guess that these articles are as full of BS from dumb reporters as the aviation and computer related articles...
FSP News, Twitter... 

I mentioned here a few months ago that I had found a name for the simulator... I'm not quite ready to reveal it yet... but I'm working on the website...
I've got two versions... one fully in Silverlight 2.0 and one in boring old html+css... I'm not sure which one to use...
 
On the coding side, not much has changed... Lots of things have kept me away from VS2008 these past few weeks... but I'm glad to say they are sorting out... at least I hope...
I'm currently working on modeling a Citabria 7ECA in FSP. This will be the second tail dragger in the simulator, the first one being a Piper J3 with an extremely lousy flight model...
 
Having real flight experience in a 7ECA will certainly help... at least for the non aerobatic part... I'll leave the +60 degree of bank and +30 degree of pitch flight envelope for Bruno to tweak ;-)
 
The 3D model is not complete yet, but the basic shape + initial texturing is done and it looks pretty nice already. I haven't modeled the interior yet, but that'll come last as it's my least favorite part of aircraft modeling...
 
In other news, I now have a twitter account... for those who want to follow, here is where you need to go:
http://www.twitter.com/mlaban
 
Time for a bit of GTA IV before going to bed...

Hiking for the Lazy Aviator 

Last saturday, Julie and I went hiking with a group of friends in a park in the mountains between San Mateo and Half Moon Bay. It was quite cool, and it brought back some memories of when I was a kid... when my parents would take me and my 2 brothers in the hiking trails in the region of Lyon.

The total distance we walked was 7 miles, and it took us a few hours.

The next day, I had scheduled a flight in a Citabria and the weather was more than perfect, so I headed for the hiking trail, just to see what it looked like from above... and it is quite small! I circled around the entire trail in about... 30 seconds :-)

After this 30 second hike, I went on along the coast all the way down to Santa Cruz... then back to Palo Alto for a few touch and goes... 1.5 hours of fun!

G1000 Bay Tour ! 

Yesterday, I flew with two friends from my school who live in the area. We went for an extended bay tour, departing from Palo Alto, overflying SFO Airport, San Francisco, Alcatraz, the Golden Gate Bridge... then we continued north to Petaluma for a quick touch and go... and finally straight to Point Reyes before coming back to PAO via the shore line.

Flying the G1000 is just fantastic, traffic awareness, moving map, integrated radios, in flight weather (metars, cloud coverage...), and even XM Satellite Radio :)

Petaluma was really crowded... I was expecting an empty traffic pattern, but there were lots of airplanes all over the place... That was probably because there was almost no wind and no turbulences, which is not a frequent occurence at Petaluma. On our way home, I was monitoring Norcal, and we kept hearing airplanes asking for flight following to Petaluma... At some point, we heard something like:

Airplane: "Cessna 123K, request flight following to Petaluma"
Norcal: "Who isn't today?" :)

Another thing I like about the 172SP is the autopilot. It comes really handy when transitioning through SF Class Bravo to leave time for traffic spotting and listening to the controllers... and also, when used in NAV mode, you are sure to go directly to a point, and not wander around your desired track :)

Unfortunately, I couldn't keep the track for this flight... My 96C was in the back, over my flight gear, and couldn't even get a fix from there... (because of the high wings I suppose...)Too bad it doesn't have a better GPS receiver in there... my $50 bluetooth receiver works much better...

Playing with Silverlight... 

Silverlight 2.0 Beta 1 was released on Wednesday and I've had some time to play with it. I coded two application, one that connects to my website and retreive all the comments posted by my fellow readers, and another more amusing one, a small minigame...

Minigame...

Click on the image to get to the game page!
(Silverlight Beta1 can be installed from the game page, it's a really compact download and quick install)

I've included the source code. It might not be super optimized, super smart, super kewl... but somebody might find it useful...

Click here to download the source code

If you are a silverlight guru and know a better silverlighty way of doing things better that how I did, let me know! :)

Autopilot Fighting with the Wind 

Two quick videos before going to bed...

I worked on the Autopilot today... trying to get rid of the shimmering/stuttering effect in the yoke whenever the autopilot was in control. I solved this problem by fixing a long time bug which had the animations of the control surfaces and moving parts tied to the joystick rather than the actual physical damped values set by the flight model.

The way the controls are moved in a different manner for each airplane is done via a simple delayed response with non linear interpolation from the joystick inputs multiplied by a scalar on the input value. The delay is independant for each control surface, so the longer the delay, the slower the aircraft will respond to a user input from the joystick.
An aircraft with a fast response would be an aerobatic airplane, and an airplane with a slower response could be a Cessna, Piper, or even slower for an airliner...

But the jitteriness was not only due to that animation bug, there was another problem with the PID controllers... linked again to the chaining of two pid... the first pid had issues when calculating the derivative for small corrections, which made it output spikes, which in turn caused even more disturbance in the following PID...

I also made some changes to the wind/turbulence system, and the following video shows the Autopilot in action in severe turbulences. I could watch this video for hours... I love how the controls move on their own to counter the wind forces :-)
The second video shows the failure of the autopilot, I had set it to a low speed, with heavy turbulences... it shows how a turbulence that was a tiny bit too strong knocked the plane over and threw it in a spin... It's funny to see how the autopilot is still trying to recover hopelessly during the spin :-)

Just one note though, the airplane doesn't have an spin-out system, I just disconnected the autopilot and got out of it before it was too late!


Autopilot fighting... from Matt on Vimeo.

Severe Turbulences with Autopilot from Matt on Vimeo.

Silverlight 2 is coming... 

Silverlight 2 is coming... this is my dream come true... create desktop like experience in my favorite managed language, but on the web! (and cross platform!)

Beta 1 will be released next week during Mix08 in Las Vegas!

Scott Guthrie has a list of tutorials to demonstrate how to create a simple silverlight widget that connects to the Digg.com webservice.

I'm really impatient to try this new beta! I played with 1.0 and 1.1 but it was too javascipty for me and there was pretty much no support for built in controls. Silverlight 2 will come with a list of controls like buttons, lists, progress bars, images, video controls and even a datagrid (!), which is just what I need! (Hello Linq Queries!!)

This will be the opportunity to re-do the FSP's website draft which lead to the rant post about html last month... let's hope Silverlight helps me out with this!

G1000 Checkout! 

I finally had time to fly with an instructor at West Valley to complete my G1000 checkout and BFR. We flew for about an hour, played around with the G1000 (but looked outside 90% of the time ;)) did some stalls, slow flight, touch and goes, landings in different configurations, go around and used the autopilot a bit...

The 172SP G1000 is a very cool machine, it flies so much faster than the planes I usually fly in, and it is incredibly easy to control!

So two days ago, while I was watching Max Trescott's G1000 CD section about the KAP 140 (autopilot), I realized that the designers of the autopilot must have had the same problems as me... I mentionned in an earlier post that I had difficulties tweaking the autopilot PID's at low/high speeds... But here are the autopilot limitations:

Cessna 172R/S Autopilot Limitations
(Reference the appropriate PIM for the complete list of limitations)
Maximum Airspeed ........................................................... 140 KIAS
Minimum Airspeed .............................................................. 70 KIAS
Minimum Approach Speed.................................................. 80 KIAS
Maximum Flap Extension...................................................... 10 deg

How interesting! And thinking I was trying to make the AP work at 65kts or less with full flaps!! I should have come up with such limitations as well! And I will ;-)


So Bruno, when are you coming with me so I can teach you how to use the G1000 ? :)