# Dynamic Modeling and Altitude Control for Flying Cars Based on Active Disturbance Rejection Control
## 2 Dynamic Model
### Structure of Flying Car  
The forces on the flying car can be expressed as illustrated in Figure 2. Besides the gravity, the lift forces are produced by the propellers. In the force analysis of the flying car, \(E\big{(}O_{E},e_{x},e_{y},e_{z}\big{)}\) denotes the geodetic coordinate system and \(B\big{(}O_{B},b_{x},b_{y},b_{z}\big{)}\) denotes the body coordinate system. The relationship between these two systems can be expressed as:  
\[\left[ \begin{array}{c}x\\ y\\ z\end{array} \right]=R\left[ \begin{array}{c}X\\ Y\\ Z\end{array} \right]=\left[ \begin{array}{cc}C_{\theta}C_{\phi}&S_{\theta}S_{ \phi}C_{\psi}-S_{\psi}C_{\phi}&S_{\psi}S_{\phi}+S_{\theta}C_{\phi}C_{\phi}\\ \par S_{\phi}&C_{\phi}C_{\psi}+S_{\theta}S_{\phi}S_{\phi}&S_{\theta}S_{\psi}C_{ \phi}-S_{\phi}C_{\phi}\\ \par-S_{\theta}&S_{\phi}C_{\theta}&C_{\theta}C_{\phi}\par\end{array} \right] \left[ \begin{array}{c}X\\ Y\\ Z\end{array} \right] \tag{1}\]  
where \(C_{x}=cos(x)\), \(S_{x}=sin(x)\), \([X,Y,Z]\) denotes the position in the body system, \(P=[x,y,z]\) denotes the position in the geodetic coordinate system, and \(R\) denotes the transfer matrix. Figure 1: Structure of a flying car. (**a**) Top of the flying car with the propellers folded up; (**b**) Top of the flying car with the propellers unfolded; (**c**) Structure of the flying car with the propellers folded up; (**d**) Structure of the flying car with the propellers unfolded. Figure 2: Force analysis of a flying car. Define \(\omega_{B}=[p,q,r]^{T}\). It is represented as:  
\[\omega_{B}=\left[ \begin{array}{ccc}1&0&-S_{\theta}\\ 0&C_{\phi}&C_{\theta}S_{\phi}\\ 0&-S_{\phi}&C_{\theta}C_{\phi}\end{array} \right]\omega_{E} \tag{2}\]  
where \(\omega_{E}=[\theta,\phi,\psi]^{T}\) denotes the Euler angle in the geodetic coordinate system. Based on Figure 2, the lift forces of the propellers can be expressed as:  
\[F=\left[ \begin{array}{ccc}0&0&\sum_{i=1}^{4}lF_{i}^{T}\end{array} \right]^{T} \tag{3}\]  
where \(l\) denotes the distance between the propeller and its body and \(F_{i}^{T}\) denotes the lift forces of the four propellers. Based on the above equations, the translational motion of the flying car can be expressed as:  
\[m\ddot{P}=RF=\left[ \begin{array}{c}0\\ 0\\ mg\end{array} \right]+d_{F} \tag{4}\]  
\[\ddot{P}=\frac{RF}{m}-\left[ \begin{array}{c}0\\ 0\\ g\end{array} \right]+\frac{d_{F}}{m} \tag{5}\]  
where \(m\) denotes the mass of the flying car, \(g\) denotes the gravity, \(F\) denotes the force on the flying car, and \(d_{F}=[d_{1},d_{2},d_{3}]^{T}\) denotes the external disturbance on the moment of the flying car. The moment of the forces can be expressed as:  
\[m_{F}=\left[ \begin{array}{c}l(F_{4}-F_{2})\\ l(F_{3}-F_{1})\end{array} \right] \tag{6}\]  
\[m_{A}=\alpha\Big{(}\Omega_{2}^{2}+\Omega_{4}^{2}-\Omega_{3}^{2}-\Omega_{1}^{2} \Big{)} \tag{7}\]  
\[m_{d}=\left[ \begin{array}{ccc}d_{\phi}\dot{p}&d_{\theta}\dot{q}&d_{\psi}\dot{ r}\end{array} \right]^{T} \tag{8}\]  
where \(\Omega_{i}\) denotes the rotation speed of the motor, \(\varpi\) denotes the reaction torque coefficient, \(\left[d_{\phi},d_{\theta}d_{\phi}\right]\) represents the aerodynamic drag coefficient, \(m_{F}\) denotes the moment of the lift force, \(m_{A}\) denotes the reaction torque of the propellers, and \(m_{d}\) denotes the moment of the air resistance. Meanwhile, based on the theorem of the moment of momentum, the rotation of the flying car can be expressed as:  
\[m_{B}=I_{B}\dot{\omega}_{B}+\omega_{B}\times(I_{B}\omega_{B})+m_{d} \tag{9}\]  
\[\dot{\omega}_{B}=I_{B}^{-1}[m_{B}-m_{d}-\omega_{B}\times(I_{B}\omega_{B})] \tag{10}\]  
\[\left[\begin{array}[  
\[\left[ \begin{array}{c}U_{1}^{F}\\ U_{2}^{F}\\ U_{3}^{F}\\ U_{4}^{F}\end{array} \right]=\left[ \begin{array}{c}l(F_{1}+F_{2}+F_{3}+F_{4})\\ -\frac{l}{l_{x}}(F_{2}-F_{4})\\ -\frac{l}{l_{x}}(F_{1}-F_{3})\\ -\frac{\varpi}{l_{z}}(\Omega_{1}^{2}-\Omega_{2}^{2}+\Omega_{3}^{2}-\Omega_{4}^ {2})\end{array} \right] \tag{12}\]  
By combining the above equations, the translational motion of the flying car can be expressed as:  
\[\left\{