Skip to main content
. 2022 Nov 26;7(4):214. doi: 10.3390/biomimetics7040214
Algorithm 1. Starling-behavior-inspired flocking control algorithm for UAVs
/*Initialization*/
Set initial parameters of the proposed algorithm and the model of fixed-wing UAV
Generate the position xi,yi,hi, heading angle ψi and velocity Vi, h˙i of UAV i randomly
/*Begin*/
for i = 1 to n
  for j = 1 to n
    Select neighbors according to Equation (1)
    if UAV j is the neighbor of UAV i
       UAV i interact with UAV j according to Equation (21)
        Calculate Cij according to Equation (9)
    end if
    Calculate φi according to Equation (12)
    Find the local leader li according to Equations (10) and (11)
  end for
  Calculate Riobs to Equation (16)
  if RdRiobs
   Execute collision prediction according to Equation (17)
   if φΔφθiφ+Δφ
    Set parameter γ=1
    Calculate the control signal of evasion pattern of UAV i according to Equation (22)
   end if
   if there exist a local leader li
    Set parameter β = 0
    UAV i follows the local leader according to Equation (21)
   end if
  end if
  Follow the virtual leader according to Equation (23)
  /*Limitation*/
  Set limitations according to Equation (15)
  Update the position qi and velocity pi according to Equations (24) and (25)
end for