Tom Pycke, who is one of the more sophisticated UAV hobbyists, has a good post showing how to use the open-source Flight Gear simulator program to test your autopilot code.
"A lot of people think they need great electronics skills, a lot of time, and embedded programming skills to experiment with Kalman filtering of IMU-data. Think again! The key to all your success stories is simulation!
One of the easiest tools that can help you with those simulations, is a great flight sim called Flight gear. It uses advanced aerodynamics simulation libraries, among which some were created by the NASA. Good enough for our purposes! On top of that, you can easily configure Flightgear to log all the data you need. I updated my config file to log the following variables:
He includes sample VB code, too (yes, you can code a Kalman in VB!). Read it all here.