# Real-Time Swarm Search Method for Real-World Quadcopter Drones
## 2 The Proposed Swarm Search Method
### The Drone Position Update Mechanism
#### 2.1.2 The Dynamic Model of the Drones for the Mechanism
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **Parameters** & **Values** \\ \hline \multirow{2}{*}{Environment} & Gravity acceleration \(g\) & 9.81 \\  & Draft coefficient \(b\) & 0.02 \\ \hline \multirow{4}{*}{Kinematic model} & \(M\) & 1.2 \\  & \(m\) & 0.1 \\  & \(l\) & 0.3 \\  & \(r\) & 0.1 \\ \hline \multirow{4}{*}{Controller} & Linear proportional (P) gain & [300, 300, 7000] \\  & Linear integral (I) gain & [0.04, 0.04, 4.50] \\ \cline{1-1}  & Linear derivative (D) gain & [450, 450, 5000] \\ \cline{1-1}  & Angular P gain & [22,000, 22,000, 1500] \\ \cline{1-1}  & Angular I gain & [0.00, 0.00, 1.20] \\ \cline{1-1}  & Angular D gain & [12,000, 12,000, 0.00] \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Model parameters. Figure 2: The control system of a quadcopter drone. ```
S: The search space of the problem S: The swarm of the drones \(N_{D}\): The number of drones in S \(d^{k}\): The \(k\)-th drone \(\mathbf{x}_{t}^{k}\): The position of \(d^{k}\) at iteration \(t\) \(\mathbf{v}_{t}^{k}\): The displacement of \(d^{k}\) at iteration \(t\) \(f(\mathbf{x}_{t}^{k})\): The objective function value of \(\mathbf{x}_{t}^{k}\) \(s_{\mathbf{x}_{t}}\): The global best position of S at iteration \(t\) \({}^{p}\mathbf{x}_{t}^{k}\): The personal best position of \(d^{k}\) at iteration \(t\) \(\mathbf{x}_{t,n}^{k}\): The position of \(d^{k}\) in the \(n\)-th control period at iteration \(t\) c: The command output of the controller
``` (1) Initialize S. for\(k=1,2,\ldots,N_{D}\)do \(\mathbf{x}_{0}^{k}=\text{random vector}\in\mathbb{S}\) \(\mathbf{v}_{0}^{k}=\mathbf{0}\)  Evaluate \(f(\mathbf{x}_{0}^{k})\) \({}^{p}\mathbf{x}_{0}^{k}=\mathbf{x}_{0}^{k}\)  Deploy \(d^{k}\) at \(\mathbf{x}_{0}^{k}\) if\(f({}^{p}\mathbf{x}_{0}^{k})\) is better than \(f(s_{\mathbf{x}_{0}})\)then \(s_{\mathbf{x}_{0}}={}^{p}\mathbf{x}_{0}^{k}\) endif endfor \(t=0\) ```
**Algorithm 1** Swarm search. ``` (2) Update S. for\(k=1,2,\ldots,N_{D}\)do \(\mathbf{v}_{t+1}^{k}=w\cdot\mathbf{v}_{t}^{k}+c\cdot[\phi_{1}({}^{p}\mathbf{x}_ {t}^{k}-\mathbf{x}_{t}^{k})+\phi_{2}({}^{s}\mathbf{x}_{t}-\mathbf{x}_{t}^{k})]\) \(\mathbf{x}_{t+1}^{k}=\mathbf{x}_{t}^{k}+\mathbf{v}_{t+1}^{k}\) \(\mathbf{x}_{t,0}^{k}=\mathbf{x}_{t}^{k}\) \(n=0\) while\(\mathbf{x}_{t,n}^{k}\
eq\mathbf{x}_{t+1}^{k}\) or a collision is not predicted do \(\mathbf{c}=\text{Controller}(\mathbf{x}_{t,n}^{k},\mathbf{x}_{t+1}^{k})\)  Actuate \(d^{k}\) with c (\(n=n+1\))  Evaluate \(\mathbf{f}(\mathbf{x}_{t,n}^{k})\) if\(f(\mathbf{x}_{t,n}^{k})\) is better than \(f({}^{p}\mathbf{x}_{t}^{k})\)then \({}^{p}\mathbf{x}_{t}^{k}=\mathbf{x}_{t,n}^{k}\) endif endwhile if\(f({}^{p}\mathbf{x}_{t}^{k})\) is better than \(f(s_{\mathbf{x}_{t}})\)then \(s_{\mathbf{x}_{t}}={}^{p}\mathbf{x}_{t}^{k}\) endif endfor (\(t=t+1\)) ```

**Algorithm 2** Swarm search. ### The Overall Procedure of the Swarm Search

The overall procedure of the proposed swarm search is summarized in Algorithm 1, and each step of the algorithm is explained in the following. First, the swarm of the drones is initialized. For each drone in the swarm, the position is randomly initialized in the search space \(\mathbb{S}\), and the displacement is initially set to a zero vector. The objective functions are initially calculated for each drone, and the initial personal best position of each drone \({}^{p}\mathbf{x}_{0}^{k}\) is set as the position of itself. Additionally, the initial global best position of the swarm \({}^{g}\mathbf{x}_{0}\) is set as \({}^{p}\mathbf{x}_{0}^{1}\). Following this, the swarm of the drones is updated. For each drone in the swarm, the position is updated through the drone position update mechanism, as explained above. During the update process, the personal best positions and the global best position are also updated, and this update process is repeated until a termination condition is met. For example, a termination condition can be defined as a maximum number of iterations.