Polar coordinates

http://diydrones.com/profiles/blogs/fly-by-polar?id=705844%3ABlogPost%3A1225160&page=1#comments

Airspeed control is critical when flying sailplanes. You want to fly close to stall but never beyond it, since that will normally cause a tip stall and great loss of energy. How do you teach an autopilot to fly on the edge of stall?

One solution is to teach the autopilot about the aircraft geometry and aerodynamics. First you start with the wing section. From the wing section you can use a simulation tool to generate aerofoil polars (picture above from XFLR5). These polars describe the lift, drag and moment coefficients generated at different airspeeds and flap settings.

From the aircraft position and the amount of corrective pitch movement you need, you can calculate the acceleration you require from the wing. This is known as load. From load, geometry and aircraft mass, the lift coefficient can be calculated.

From lift coefficient and the wing polar you can calculate the required angle of attack for the wing. From the required angle of attack, you can calculate required elevator pitch.

From the wing polars, you know the maximum possible lift coefficient. Now you can avoid increasing angle of attack beyond Cl(max) and avoid stalling. This is only half of stall prevention. The other half is in energy management.

Both when gliding and under power, the aircraft loses energy due to drag. For a glider this determines the descent angle. For a powered aircraft it determines the engine power. By using the estimate of drag coefficient from the wing section polar, the autopilot can set the target climb/descent rate and pitch angle. When power is applied, it adds energy to the system so the estimated climb rate and target pitch increases.

Working in combination with basic estimated climb rate is airspeed error feedback. Airspeed error is converted into meters of potential energy error and added to the target pitch. The combination of target estimate and energy feedback are great for stall prevention.

Document describing airspeed by energy management

If you change flap settings then the wing polar changes. As the flaps are changed, the autopilot has to interpolate between the different wing flap polars. The result is a smooth transition between airspeeds.

This method also automatically re-trims the elevator for different airspeeds. It also automatically does airspeed control fadeout. It also reduces dependency on PID gains. Some optional gains are still required for different flying styles.

One problem with this method is that it relies on knowing the initial wing-elevator incidence. At high airspeeds the aoa is small and sensitivity to change is high. The solution is to have a feedback from the accelerometers comparing to calculated load. This error feeds an integrator which retrims the elevator. The result is an even better trim for low speed flight.

Despite all the stall prevention, my first test flight resulted in terrible tip stall when turning downwind. Adding a little bit of extra airspeed command resulted in lovely smooth turns. When I went back to the estimated airspeed calculation, I had set airspeed setpoint 2m/s too slow.

If this all sounds new, it isn’t. It is simply re-applying the basics that we know about aerodynamics. If you are interested in aerodynamics basics you might start here

The project is based on a branch of MatrixPilot based here: https://github.com/crashmatt/MP_Aerodyn

The original Matrixpilot project wiki is here: https://code.google.com/p/gentlenav/ Aerodyn uses the MatrixPIlot code base for hardware drivers and IMU. My thanks go to the MatrixPilot team for their support and innovation. The Aerodyn project also uses a flexible field programmable mixer which is used to move the flight surfaces with accuracy. This is used to fly this 5m, 10 channel aircraft. More about that later.