I don't have the cash right now to buy a plane, ArduIMU, an auto pilot, and associated hardware. So, while I'm saving for the hardware, I want to play with the various algorithms out there in a simulation environment - to gain a deeper understanding and feel for it. I want to be able to code in C, so I can use the code directly in the hardware autopilot when I reach that point.
I want to use a flight dynamics model to generate sensor inputs to the autopilot (3 axis gyro, 3 axis accelerometer, GPS - just like ArduIMU), and have the autopilot generate control surface inputs to the simulated plane in the flight dynamics model.
Phase 1: Open loop. Tuning/experimenting with the AHRS algorithm. This would not require the flight dynamics model to accept control surface input from the autopilot. I would load the simulation and fly an airplane around in some pattern. The FDM would generate and log the sensor readings and the "ground truth" pitch-roll-yaw angles. My AHRS code would read in the sensor log, compute the pitch-roll-yaw angles, and would allow me to compare it with the "ground truth" data generated by the FDM.
Phase 2: Close the loop. Use the autopilot to accept sensor inputs from the FDM, and send back control surface inputs.
Right now I'm concentrating on Phase 1. Has this been done before? I've looked around a bit and it seems that FlightGear is well suited for this type of hackery. Are these properties the ones I should use to generate the correct sensor data, emulating an ArduIMU? How can I get the values I need out of FlightGear (I read that a UDP socket is used?).
*ground truth data to be logged and compared with my own AHRS output*
How does everyone here test their algorithms before sending it up in the air? Anyone else run their autopilot code in a closed loop with a flight dynamics model? If not, I wouldn't mind putting in some extra effort to make this interface nice/easy-to-use so that it can be used by the community out of the box for autopilot testing.
Thanks in advance!