After the hardware was "completed", I was finally able to focus on the software side of things. The linked video shows the first test flight of an attitude stabilizer, that will later on become my autopilot.
I mounted the navigation board and my RC receiver v2 (both discussed in previous posts) on my Graupner Elektro Rookie plane (I'll be later moving this stuff to my Skywalker, but I want to make sure everything works before I do that).
A simplified description of how the stabilizer works:
- The RC transmitter is used to set target roll and pitch angles (aileron and elevator sticks).
- The navigation board reads measurements from a gyroscope and a magnetometer, and uses those measurements to track the plane's attitude.
- The RC receiver reads the attitude from the navigation board and compares the measured roll and pitch angles to the target roll and pitch angles. Ailerons and the elevator are then adjusted to correct for the error.
The sensor fusion algorithm used in the navigation board is explained in a previous post. The attitude control itself is done just by a P-controller (which was set for too much gain in the video). I'll probably be adding a derivative term as well, just to get a slightly faster response to turbulence. I'm guessing I won't be needing an integral term though, as I'm relatively sure the steady state errors in the roll and pitch will not be significant compared with other navigation errors.
Now to implement an autopilot, all I'll have to do is to change the way I set the target roll and pitch. I'm again planning on using just a P-controller at first. As the plane is (I hope) mostly flying quite level, the roll and pitch angles correspond with changes in heading and changes in altitude respectively. A GPS receiver, which is already on-board, provides the heading of the plane. The target heading (to the next waypoint) is computed and the roll angle is set according to the heading error. The same thing is done with the altitude and pitch angle. An important caveat, however, is that the roll and pitch angles should be kept relatively small even if the heading or altitude errors are large. I plan to address this by simply having a fairly low saturation value for the target angles.