So off to study control systems we go. For the beginning, the simplest implementation of a PID controller. And the key word is simple. No boundary checking, trial and error parameters, ...
And it didn't work half that bad (running FlightGear and recording the flight did introduce some lag and jitter):
For the development and tests: FlightGear with Rascal110-JSBSim aircraft, connected trough wireless network to the Samsung Galaxy S2 which is running the autopilot software.
The flight: starting the engine, controlling the plane with a mouse while taking off, banking to the left side, turning on the autopilot, the plane levels (some oscillation because of the lag introduced with running the simulator and recording it), using just the rudder to turn right, plane turns right while being stabilized with no roll, reset all controlling surfaces to default position, using just the rudder to turn left, plane turns left while being stabilized with no roll, reset all controlling surfaces to default position, fly straight, turn off autopilot, plane "crashes".
And that's how the flight looked, location, speed, and altitude (yes, the "heat map" still needs a legend, it's a work in progress).
Now, just fro fun, let's look at some graphs, these are always fun:
Time stamps of network packets with data received. Almost completely linear, with some variation. In some other tests, where the variation was significant, the autopilot would fly smooth, then correct violently (error being calculated was wrong due to incorrect timing of the event and the received data stamp), oscillate a bit and the settle again.
Roll graph: showing target attitude, current attitude and error.
Roll graph: showing the PID controller output, not limited to reasonable boundary’s.
Roll graph: showing integral part of the error, not very useful for calculating offsets at the moment since it's not limited to reasonable boundary’s.
Roll graph: derivative part of the error, showing where were the quickest changes.
Roll stabilization was computed with these weights: Kp=0.1111, Ki=0.0, Kd=0.5
Pitch graph: showing target attitude, current attitude and error.
Pitch graph: showing the PID controller output, not limited to reasonable boundary’s. Zooming closer to the latter part, there would be visible some minor oscillation, as is visible in the previous graph.
Pitch graph: showing integral part of the error, not very useful for calculating offsets at the moment since it's not limited to reasonable boundary’s.
Roll graph: derivative part of the error, showing where were the quickest changes.
Roll stabilization was computed with these weights: Kp=-0.019, Ki=-0.025, Kd=0.75
It's not perfect, but it's a start.
No comments:
Post a Comment