# What is the maths behind Loitering of Aircraft?

I am making a controller for loitering using PIDs. The equation which is used to find the radius of circle given bank angle and speed is in following link: How to calculate angular velocity and radius of a turn?

What i did was give the speed and current bank angle of aircraft to find the radius it will make. By subtracting this radius value with the required radius of circle i got the difference between them. This difference was given to PID "Roll from Radius Error loop", this generated the required roll value which is given to "Aileron from Roll loop" and in this way the required circle radius was achieved. But there was a problem. The Loiter is around a point but with above simulation the aircraft do not loiter around the required point. In other words the center of circle was shifted. My question is how can i loiter around a point what is the math behind it or how can i loiter around a specific point.

• What are you building/making the controller in (eg what language)? What controller inputs do you have? This sounds like a homework problem as written. Apr 13 at 6:24
• Programming drone logic is way outside the scope of this forum. Drones.SE might be a better fit, although the breadth of the question seems like a better fit to a chapter or two of a textbook, rather than the paragraphs of a Stack Exchange answer. Apr 13 at 6:39
• @RalphJ The question is perfectly valid for aeroplanes as well. The paragraphs of DeltaLima's answer seem to do the job just fine. Voting to keep open. Apr 13 at 8:26
• Did you account for wind? Apr 13 at 12:41
• @tedder42 i am making flight controller in MATLAB/Simulink
Apr 14 at 4:41

What you have built is an open-loop controller. You do not feed the distance between the aircraft and the specific point back to the control loop. And thus if the aircraft deviates momentarily from it's intended radius of curvature, it will recapture the intended radius, but now the circle centre has moved.

You should program your controller to not only fly a certain radius, but also to fly a constant distance from the specific point.

On the ideal path:

• the curvature radius is equal to the distance to the specific point
• the speed vector is perpendicular to the vector between the aircraft and the specific point
• the distance to the specific point is at the target value.

Now for the controller:

• You control the radius of curvature with the bank angle
• You control the speed vector (track angle) with the radius of curvature
• You control the distance to the specific point with the speed vector.

The model will be non-linear, so for larger deviations from the target distance, a PID controller without any limiting logic may not be stable. You may need separate controller logic to bring the aircraft to an acceptable initial state before activating the constant turn controller.

• thank you for the answer, you got my point. I will keep these things in mind and implement it.
Apr 14 at 4:54
• @Asad I am glad I could help. Wishing you a clear mind, lot's of fun, a bit of luck (it seems one always needs a bit of luck for controller implementation) and finally success during the implementation. Apr 14 at 7:11

In the multidimensional matrix of stability and control of aircraft, maintaining an earth reference position means unfortunately that the controller needs to consider multiple signals. Also, it needs direct feedback of the controlled variable - the GPS position. @StephenS asks a very valid question in a comment: “Did you account for wind?”

The referenced answer shows the math valid for an aeroplane in a co-ordinated turn: a quasi-static situation, all is trimmed such that altitude remains constant, no inter-dimensional accelerations such as the propeller torque changing the required bank angle. Or the dynamics for angular acceleration: it takes some time before bank angle is reached after deflecting the ailerons (and rudder, to maintain the turn being co-ordinated). And in that situation the turn radius is constant with regard to wind axes, not earth axes.

The controlled variables are GSM position amd altitude. The main input signals are airspeed and bank angle. If there is a direct feedback of distance to GSM position, the error in distance can be used to apply aileron/rudder/elevator deflection, engine power to fly upwind/downwind etc. a full simulation of all physics is required.

Generally in such a situation you want two nested controllers.

The "inner" controller adjusts the plane to achieve a desired bank angle.

The "outer" controller adjusts the bank angle to achieve a desired flight path. You can make small adjustments by alternating tighter and looser turns around the circle. To move the centre of the circle east fly looser curves when flying east than when flying west. For larger adjustments you probablly want to switch to a completely different navigation mode.

• Yes exactly. I am following this scheme "Roll from Heading Error"->"Roll rate from Roll error"->"Ail. from Roll rate error"