# Inverse Optimal Design for Position Control of a Quadrotor
## 4 Simulation Results and Analysis  
### Testing/Evaluation Methodology  
In order to verify the effectiveness of the proposed inverse optimal position controller of a quadrotor, we perform some computer simulations. The position dynamics (5) of a quadrotor is employed in the simulations. This paper focuses on position control using inverse optimal control. Therefore, for attitude control, we considered simplified attitude dynamic of the quadrotor ignoring gyroscopic and centrifugal term as follows [20]:  
\[\ddot{\phi}=\frac{u_{2}}{I_{xx}},\ \ddot{\theta}=\frac{u_{3}}{I_{yy}},\ \ddot{\psi}=\frac{u_{4}}{I_{zz}}.\]  
In addition, we did not consider the rotor dynamics of the quadrotor. Therefore, the input of the system is not the thrust of each motor, but the newly defined inputs \(u_{1-4}\) made by the calculation of each motor thrust.  
The simulations parameters are chosen as follows: \(m=1.0\) [kg], \(g=9.806\) [m/s\({}^{2}\)], \(I_{xx}=2.3\times 10^{-3}\) [kg \(\cdot\) m\({}^{2}\)], \(I_{yy}=2.3\times 10^{-3}\) [kg \(\cdot\) m\({}^{2}\)], \(I_{zz}=5.09\times 10^{-3}\) [kg \(\cdot\) m\({}^{2}\)] and \(J=6.5\times 10^{-5}\) [kg \(\cdot\) m\({}^{2}\)]. In addition, the sampling time was fixed at 0.001 [s] for simulation.  
The attitude control inputs of a quadrotor are given as follows:  
\[u_{2} =l\cdot b({\Omega_{1}}^{2}-{\Omega_{3}}^{2}), \tag{52}\] \[u_{3} =l\cdot b({\Omega_{2}}^{2}-{\Omega_{4}}^{2}),\] \[u_{4} =d({\Omega_{1}}^{2}+{\Omega_{3}}^{2}-{\Omega_{2}}^{2}-{\Omega_{4}} ^{2}),\] \[\Omega_{r} =\Omega_{1}+\Omega_{3}-\Omega_{2}-\Omega_{4},\]  
where \(l\) is the distance between the center of a quadrotor and the center of a propeller, \(b\) and \(d\) are the thrust and drag factors of the quadrotor, respectively, \(u_{2}\), \(u_{3}\), and \(u_{4}\) are the inputs for the roll (\(x\)-axis), the pitch (\(y\)-axis), and the yaw (\(z\)-axis), respectively, and \(\Omega_{i}(i=1,2,3,4)\) is the propeller speed of the \(i\)-th rotor.  
In the simulation, we employ the PID control which is a typical linear-control techniques for the attitude control of a quadrotor. Also we use the attitude control input to realize the convergence of the attitude of a quadrotor to the reference attitude of a quadrotor, which is the output of the position control.  
To design the attitude control inputs of a quadrotor, we define the errors \(e_{\phi}\), \(e_{\theta}\), and \(e_{\psi}\), which are related to the attitude of a quadrotor respectively, as follows:  
\[e_{\phi}=\phi_{d}-\phi,\ e_{\theta}=\theta_{d}-\theta,\ e_{\psi}=\psi_{d}-\psi.\]  
We designed the attitude control inputs \(u_{2}\), \(u_{3}\), and \(u_{4}\) using the following expressions [20]:  
\[u_{2} =K_{p,\theta}e_{\phi}+K_{d,\theta}e_{\phi}+K_{i,\phi}\int e_{\phi }dt\] \[u_{3} =K_{p,\theta}e_{\theta}+K_{d,\theta}e_{\theta}+K_{i,\theta}\int e_{ \theta}dt\] \[u_{4} =K_{p,\psi}e_{\psi}+K_{d,\psi}e_{\psi}+K_{i,\psi}\int e_{\psi}dt.\]  
In these controllers, \(K_{p,d}>0\), \(K_{d,q}>0\), and \(K_{i,q}>0\) for \(q=\phi,\ \theta,\ \psi\) are the proportional, derivative, and integral control gains, respectively. The simulation is performed with the PID parameters presented in Table 1.  
In this paper, the feedback gain of PID controllers used in attitude control is selected by changing slightly based on gain of PID controller used in [21]: These gains were tuned to ensure acceptable tracking performance while minimizing the overshoot and the undershoot of error signals.