While I was in Salt Lake City two weeks ago I re-attacked the problem of using X-Plane as a simulator to help design control laws for a pitch axis autopilot, which would use electric trim commands to control the aircraft in pitch. I was stuck for awhile, but eventually got all the hooks to X-Plane working so I could read the data from the sim, display an autopilot control panel, and control the sim with the simulated autopilot. Today I did some more work, and now I've got a pitch hold mode working quite well, and am working on an altitude hold mode.
I am experimenting with some things, such as adaptive autopilot gains. The gain required will vary considerably depending on the CG, and the airspeed. The autopilot starts off with a low gain, and if the performance is not good enough it automatically slowly increases the gain until the performance is acceptable. If the gain gets too high, and its commands cause the aircraft pitch to start to oscillate, it quickly backs off on the gain until the oscillation stops. This part works quite well, at least in the simulator. It'll be interesting to see how well it works in the aircraft. This feature, if it works, should make it possible to use this autopilot on many other aircraft types without changing the software.
Originally, I was considering using the Arduino micro-controller as the basis for the autopilot. Now I am considering the Parallax Propeller micro-controller. The Propeller is interesting because it has what are effectively eight separate CPUs (they call them cogs), sharing common memory. You can dedicate CPUs to specific functions, and they can whir away without being affected by what is happening in the other cogs. For example, I would dedicate one cog to reading the serial data from the Dynon EFIS, another cog would monitor the pilot selections from the control panel and display status info on an LCD display. Another cog would do the inner loop control law, which would be a pitch hold law. Another cog would do the outer loop control laws (e.g. altitude hold, airspeed hold, vertical speed hold, etc) which would send pitch attitude commands to the inner loop control law. Another cog would act as a safety monitor, and would disconnect the autopilot if one of the other cogs locked up, or if specified airspeed or load factor limits were exceeded.
This should be a fun project. If it works, I'll share the design info with the amateur-built aircraft community.