In my prior post I mentioned the elegant nature of PID controllers as a means for implementing autopilots, in these posts I’ll be specifically talking about altitude autopilots.
I’ve made a few changes since my last post:
- the output of the PID is no longer tightly-coupled to the force equation
- new components such as Throttle and Thruster introduce an abstraction layer into the System. The Throttle naturally sits in-between the PID and Thruster
- the output from the PID is now clamped and normalised
- the normalised PID output is connected to the Throttle (also normalised) thus ensuring that the PID is only responsible for determining the amount of throttle
- while the Throttle instructs the Thruster the percentage to apply it is the role of the Thruster, given its knowledge of internal max thrust specifications, to both calculate and apply the force in Newtons to satisfy the autopilot
With this in place, the correct size (roughly), mass, max thrust can now be applied to the simulation.
In this video the altitude autopilot has been instructed to fly the visually-crude jet (modelled roughly after the Sea Harrier FA2) to a cautionary altitude of 50 m (164 ft). It does so via a PID which determines how much error exists between the PV (process variable or “current altitude”) and the SP (setpoint or in this case the “desired altitude”).
The clamped and normalised error output is connected to a throttle which in turn controls the jet’s VTOL engines by applying the value against the thrust range of the engine, in this case 97 kN, more than enough to lift the model with a mass of 8,000 kg being simulated here.
Near the end of the video you can see a 80.9% throttle being applied; this generates 78,470 N which is exactly the amount to counter gravity for this model.
Note: though drag is being simulated airfoil surfaces and lift are not
In this video the altitude autopilot has been instructed to fly the jet to an altitude of 100 m (300 ft). The slight overshoot at the start is mostly likely due to an over-eager integral term – something I’ll fix one day.
Pingback: Flight Sim Project Update | MickyD's Random Thoughts