1 Introduction

Presently, helicopters are regarded among the most useful and maneuverable aerial vehicles. Their major features include ability of landing and taking off in restricted spaces besides flight in hover mode (unmanned aircrafts lack the latter ability). Simulation of mathematical model of helicopter was primarily proposed by Hefley and Mnich in American Military Researches Center [1]. Many papers have benefited from these equations which will be used in the current study as well [2]. Among the advantages of modern control that contributes to its superiority to classic control methods are: internal stability, adjustment or tracking, elimination of disruption effect, reduction of noise effect, and non-sensitivity to the model [3]. In the conducted research works, scarce instances were found about designing optimal controller based on linear quadratic regulator method for six degrees of freedom helicopter [4]. In these papers, the controller is seldom analyzed under influence of initial conditions while the current paper incorporates not only the variations of initial conditions but also presence of wind factor as perturbation input to the system. Simulation results are suggestive of highly suitable performance of the designed controller regarding different states of initial conditions of system and wind distribution as perturbing input. Compared to all former researches [58], the present model provides higher stability for the system along with imposing lower costs for optimal control and surprisingly better performance than robust control in this under these circumstances.

2 Mathematical modeling

The YAMAHA R50 mathematical model is based on [2]. This model has eleven state variables. Among them, several parameters must be estimated experimentally and others are measured directly. There exist two reference frames which are generally used to determine the motion of a helicopter: the body fixed framework and the fixed framework. The origin of fixed framework (Earth Framework) is chosen arbitrary, with the x axis pointing to nose, z axis pointing vertically downward and y is perpendicular to both. The origin of body framework is placed in COG, the x axis is defined to point in the helicopter longitudinal direction, the y axis is defined to point to the right and z is perpendicular both to the x and y axes (Fig. 1).

Fig. 1
figure 1

References frameworks

2.1 Rigid body equations

The helicopter is an aerial vehicle which is free to rotate and translate in all six degrees of freedom (i.e. rolling, pitching, yawing, surging, swaying and heaving). The rigid body equations are defined in the fixed framework. Three differential equations describing the helicopter translational motion in the body framework are derived as (1).

$$\begin{aligned} {\dot{u}}&= \frac{{ }^bf_x }{m}+{ }^bv\cdot r-{ }^bw\cdot q \nonumber \\ {\dot{v}}&= \frac{{ }^bf_y }{m}-{ }^bu\cdot r+{ }^bw\cdot p \\ {\dot{w}}&= \frac{{ }^bf_z }{m}+{ }^bu\cdot q-{ }^bv\cdot p\nonumber \end{aligned}$$
(1)

Similarly, the following three ordinary differential equations describing the helicopter rotational motion are derived (these equations do not depend on the reference frame) [9].

$$\begin{aligned} {\dot{p}}&= \frac{(I_{yy} -I_{zz})\cdot q\cdot r+L}{I_{xx}} \nonumber \\ {\dot{q}}&= -\frac{(I_{xx} -I_{zz})\cdot p\cdot r-M}{I_{yy}} \\ {\dot{r}}&= \frac{(I_{xx} -I_{yy})\cdot q\cdot p+N}{I_{zz}}\nonumber \end{aligned}$$
(2)

Euler angles rates are defined by (3).

$$\begin{aligned} {\dot{\phi }}&= p+\sin (\phi )\tan (\theta )\cdot q+\cos (\phi )\tan (\theta )\cdot r \\ {\dot{\theta }}&= \cos (\phi )\cdot q-\sin (\phi )\cdot r \nonumber \\ {\dot{\psi }}&= \frac{\sin (\phi )}{\cos (\theta )}\cdot q+\frac{\cos (\phi )}{\cos (\theta )}\cdot r \nonumber \end{aligned}$$
(3)

where \(\phi \) is the roll angle, \(\theta \) is the pitch angle and \(\psi \) is the yaw angle.

2.2 Force body equations

This section describes the translational forces acting on the helicopter. These equations are derived in the body framework and are decomposed along the three axes [10].

$$\begin{aligned} { }^bF\!=\! \left[ {\begin{array}{l} -T_{MR}\cdot \sin (\beta _{1c} )-\sin (\theta )\cdot mg \\ T_{MR}\cdot \sin (\beta _{1s} )+T_{TR} +\sin (\phi )\cos (\theta )\cdot mg \\ -T_{MR}\cdot \cos (\beta _{1s} )\cos (\beta _{1c} )+\cos (\phi )\cos (\theta )\cdot mg \nonumber \\ \end{array}} \right] \\ \end{aligned}$$
(4)

2.3 Moment equations

This section describes the torques acting on the helicopter about three axis of the body reference framework.

$$\begin{aligned} { }^b\tau = \left\{ {\begin{array}{l} { }^bf_{y,MR}\cdot h_m -{ }^bf_{z,MR}\cdot y_m +{ }^bf_{y,TR}\cdot h_t\\ \quad +Q_{MR} \cdot \sin (\beta _{1c} ) \nonumber \\ -{ }^bf_{x,MR}\cdot h_m -{ }^bf_{z,MR}\cdot l_m -Q_{MR}\cdot \sin (\beta _{1s} ) \\ { }^bf_{x,MR}\cdot y_m +{ }^bf_{y,MR}\cdot l_m -{ }^bf_{y,TR}\cdot l_t\\ \quad +Q_{MR} \cdot \cos (\beta _{1s} )\cos (\beta _{1c} ) \\ \end{array}} \right. \\ \end{aligned}$$
(5)

where \(\hbox {Q}_{\mathrm{MR}}\) is the torque generated by the main rotor drag and is defined by Eq. (6). The torque generated by the tail rotor drag is neglected because of its small influence on the helicopter [11].

$$\begin{aligned} Q_{MR} =-(A_{Q,MR}\cdot T_{MR}^{1.5} +B_{Q,MR} ) \end{aligned}$$
(6)

In which \(\hbox {A}_{\mathrm{Q,MR}}\) is a coefficient expressing the relationship between the main rotor thrust and \(\hbox {Q}_{\mathrm{MR}}\), and \(\hbox {B}_{\mathrm{Q,MR}}\) is the initial drag of the main rotor when the blade pitch is zero [11].

2.4 Flapping equations

Giving the cyclic inputs \(\hbox {A}_{\mathrm{MR}}\) and \(\hbox {B}_{\mathrm{MR}}\), allow the tip path plane (TPP) to tilt or flap in both lateral and longitudinal directions. This is the basis for controlling a helicopter. The flapping section of the main rotor derives a quasi-steady state model to describe this behavior. Therefore, it is implied that the equations do not account for the transient dynamics of the main rotor. This is because the main rotor is effectively governed by the control rotor input [2]. Figure 2 shows the block diagram for rotary wing.

Fig. 2
figure 2

Block diagram for rotary wing

\(\hbox {K}_{\mathrm{CR}}\) is the gain of the control rotor (Fly bar), \(\hbox {K}_{\mathrm{MR}}\) is the main rotor gain, \(\hbox {A}_{\mathrm{SP}}\) and \(\hbox {B}_{\mathrm{SP}}\) are swash plate entrance for lateral and longitudinal movement, \(\beta _{\mathrm{CR,1S}},\, \beta _{\mathrm{CR,1C}}\) are the lateral and longitudinal flapping angles produced by fly bar. \(\hbox {A}_{\mathrm{MR}}\) and \(\hbox {B}_{\mathrm{MR}}\) are pitch angles that finally influence on the main rotor and produce the final flapping angles. Flapping equations are available in [2].

3 Linearization

In order to linearize the non-linear system, operating points of system needs to be applied for all state derivatives. Operating points for hover mode includes the state in which all translational velocities are zero and Euler angles are constant as well. As such, the helicopter is suspended but will be gradually deviated. Unfortunately, zero-state variables cannot be totally considered when the helicopter is in equilibrium. This is caused by the force exerted by tail rotor for maintaining the helicopter consistent. Accordingly, Euler angle \(\phi \) shall have a non-zero value so that the force component of main rotor generated along y axis can nullify the force resulting from tail rotor. Assume the operating points for state variables as (7), which result in system matrices as (8) [12].

$$\begin{aligned}&x^{T}=[u,v,w,p,q,r,\phi , \theta , \psi , \beta _{1s}, \beta _{1c}] \nonumber \\&x_{op}^{T} =[0,0,0,0,0,0,c,c,c,0,0]\\&{\dot{x}}=Ax+Bu+B_{d} d, y=Cx+Du\nonumber \end{aligned}$$
(7)
$$\begin{aligned}&A\!=\! \left[ {{\begin{array}{llllllcclcc} 0&{}0&{}0&{}0&{} \quad 0&{}0&{}0&{}{-9.81}&{}0&{}0&{}{-9.81} \\ 0&{}0&{}0&{}0&{}0&{}0&{}{9.81}&{}0&{}0&{}{9.81}&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}{260.7}&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}{1.427}&{}{-4.453} \\ 0&{}0&{}0&{}0&{}1&{}0&{}0&{}0&{}0&{}0&{}{83.54} \\ 0&{}0&{}0&{}1&{}0&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}1&{}0&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}1&{}0&{}0&{}0&{}0&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}{{-1}/{0.078}}&{}0 \\ 0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}0&{}{{-1}/{0.078}} \\ \end{array} }} \right] \hbox {B}_{d} \!=\!\left[ {{\begin{array}{l} 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \end{array}}} \right] \nonumber \\&B\!=\!\left[ {{\begin{array}{l@{\quad }l@{\quad }c@{\quad }c} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} {-2.162}&{} {-0.023} \\ 0&{} 0&{} {-229.6}&{} 0 \\ 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} {0.27} \\ 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0 \\ 1&{} 0&{} 0&{} 0 \\ 0&{} 1&{} 0&{} 0 \\ \end{array} }} \right] \ \hbox {C}\!=\!\left[ {{\begin{array}{l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{}} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0 \\ \end{array} }} \right] \nonumber \\ \end{aligned}$$
(8)

where A, B, C are system matrices and \(\hbox {B}_{\mathrm{d}}\) is the system disturbance distribution matrix. After linearization, discrete equations of system should be derived in the general form of (9); discretization is done using MATLAB with zero-order-hold (ZOH) method [13].

$$\begin{aligned} \left\{ {\begin{array}{l} x(k+1)=\phi _s x(k)+\Gamma _s u(k)+\Gamma _d d(k) \\ y(k)=H_s x(k) \\ \end{array}} \right. \end{aligned}$$
(9)

4 Controller designing

The overall goal of the controller is to stabilize the helicopter model in a steady-state hover, defined to be where the translational velocities are zero, and Euler angles are constant. Often, it’s desirable to bring the states to a steady state condition as fast as possible; however, this task will always be bounded by the amount of actuator power available. The purpose of the optimal control is to determine an input u(k) so that the cost function is minimized.

$$\begin{aligned} I=\sum _{k=0}^N {x^{T}(k)Q_1 x(k)+u^{T}} (k)Q_2 u(k) \end{aligned}$$
(10)

where \(I\) is the performance index, k is the sample number [0, N], N is the finite time horizon, \(\hbox {Q}_{1}\) and \(\hbox {Q}_{2}\) are matrices that define the performance of the controller by weighting the states variables and control inputs. They are chosen by designer and must be symmetric and positive semi definite. Suppose the general form for a linear discrete system as (11).

$$\begin{aligned} x(k+1)=\phi x(k)+\Gamma u(k) \end{aligned}$$
(11)

In this case, optimal value for input vector and minimal performance index are described as below.

$$\begin{aligned} {\mathop {u}\limits ^{*}} (k)=-L(k)x(k),\quad j_{k}^{N} (x(k))=x^{T}(k)S(k)x(k) \end{aligned}$$
(12)

where \(L\) represents the feedback gain matrix for the closed loop system. J is proportional to the squared state vector \(x(k)\) with the matrix \(S(K)\). J is also minimized value for performance index I. the solution to (10) is referred to the algebraic Riccati equations (5) [14, 15].

$$\begin{aligned} L(k)&= [Q_2 +\Gamma ^{T}S(k+1)\Gamma ]^{-1}\Gamma ^{T}S(k+1)\Phi \end{aligned}$$
(13)
$$\begin{aligned} S(k)&= [Q_2 +\Gamma ^{T}S(k+1)\Gamma ]^{-1}\Gamma ^{T}S(k+1)\Phi \end{aligned}$$
(14)

Equations (13) and (14) will be solved backward after selecting weighting matrices and starting with k=N. Note that both L and K are time varying matrices because are computed for the finite sample sequence N. Since a linear controller is considered, the feedback matrix L needs to be constant. Consequently, by letting \(N\rightarrow \infty \) a steady state solution for L(0) can be found [16].

4.1 Effect of applying perturbation on the system

Since a component with constant value emerged for linear acceleration along y axis, optimal control equations thus need to be adjusted for applying this constant value as a disturbance input. So, new state variable \(x_d\) is added to system in order to take into account the amount of disturbance.

$$\begin{aligned} \left\{ {\begin{array}{l} x_d (k+1)=\phi _d x_d (k) \\ d(k)=H_d x_d \\ \end{array}} \right. , \quad x_{d} (0)=k_{dist} =0.1226 \end{aligned}$$
(15)

where \(H_d\) and \(\phi _{d}\) are scalars with unity value; because, \(d_{k}\) only affects component \(v\). To take the perturbation effect into account, new linear equations system will be rewritten as (16) [17].

$$\begin{aligned} \left\{ {\begin{array}{l} \left[ {\begin{array}{ll} x_s (k+1) \\ x_d (k+1) \\ \end{array}} \right] = \left[ {{\begin{array}{ll} {\phi _{s}}&{} {\Gamma _{d} H_d } \\ 0&{} {\phi _{d}} \\ \end{array}}} \right] \left[ {\begin{array}{l} x_s (k) \\ x_d (k) \\ \end{array}} \right] +\left[ {\begin{array}{l} \Gamma _s \\ 0 \\ \end{array}} \right] u(k) \\ y(k)=\left[ {{\begin{array}{ll} {H_s}&{} 0 \\ \end{array} }} \right] \left[ {\begin{array}{l} x_s (k) \\ x_d (k) \nonumber \\ \end{array}} \right] \\ \end{array}} \right. \\ \end{aligned}$$
(16)

As new state variables vector contains \(x_{d}\), the feedback matrix defined in Eq. (19) should be modified to take into account this new state variable.

$$\begin{aligned} u^{*}=-L(0)x(k)=-[{\begin{array}{ll} {L_s (0)}&{} {L_d (0)} \\ \end{array} }]\left[ {\begin{array}{l} x_s (k) \\ x_d (k) \\ \end{array}} \right] \end{aligned}$$
(17)

Hence, the new format of weighting matrices will be as Eq. (18).

$$\begin{aligned} Q_1 =\left[ {{\begin{array}{ll} {Q_{1s} }&{} 0 \\ 0&{} {Q_{1d} } \\ \end{array} }} \right] , \quad Q_2 =Q_{2s}, \quad Q_{1d} =[0] \end{aligned}$$
(18)

where \(Q_{1d}\) was assumed to be zero because the perturbation value is not controllable and is depends on the system.

4.2 Designing the controller with integration operator

Integration operator in the form of (19) shall be added to the system to eliminate the steady state error contained in designing parameters while applying the controller method.

$$\begin{aligned} x_i (k+1)=x_i (k)-x_s (k) \end{aligned}$$
(19)

In this case, the new state variable vector will be arrived as (20).

$$\begin{aligned} x(k)=[x_s (k),x_d (k), x_{i} (k)]^{T} \end{aligned}$$
(20)

Hence, the new matrices for system which consider the new state variables vector are rewritten [18].

$$\begin{aligned} \left\{ {\begin{array}{ll} x(k+1)=\left[ {{\begin{array}{lll} {\phi _s }&{} {\Gamma _d H_d }&{} 0 \\ 0&{} {\phi _d }&{} 0 \\ {-I}&{} 0&{} I \\ \end{array} }} \right] x(k) +\left[ {\begin{array}{l} \Gamma _s \\ 0 \\ 0 \\ \end{array}} \right] u(k) \\ y(k)= \left[ {{\begin{array}{lll} {H_s}&{} 0&{} 0 \\ \end{array} }} \right] \\ \end{array}} \right. \end{aligned}$$
(21)

It is noteworthy that for maintaining equilibrium of the helicopter, Euler angle \(\phi \) cannot be assumed zero simultaneously with zero translational velocities. Thereby, this parameter cannot be used in integration operator because the controller intends to nullify the parameters of linear velocity. Parameters which cannot be measured directly will not appear in integration operator either. Therefore, integration equation is defined as expressed by (22).

$$\begin{aligned}&\left[ {{\begin{array}{l} {u_i (k+1)} \\ {v_i (k+1)} \\ {w_i (k+1)} \\ {p_i (k+1)} \\ {q_i (k+1)} \\ {r_i (k+1)} \\ {\psi _i (k+1)} \\ \end{array} }} \right] =\left[ {{\begin{array}{l} {u_i (k)} \\ {v_i (k)} \\ {w_i (k)} \\ {p_i (k)} \\ {q_i (k)} \\ {r_i (k)} \\ {\psi _i (k)} \\ \end{array} }} \right] \nonumber \\&\quad \!-\left[ {{\begin{array}{l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{\quad }l@{}} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0&{} 0&{} 0&{} 0 \\ 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 0&{} 1&{} 0&{} 0 \nonumber \\ \end{array} }} \right] \left[ {{\begin{array}{l} {u(k)} \\ {v(k)} \\ {w(k)} \\ {p(k)} \\ {q(k)} \\ {r(k)} \\ {\phi (k)} \\ {\theta (k)} \\ {\psi (k)} \\ {\beta _{1s} (k)} \\ {\beta _{1c} (k)} \\ \end{array} }} \right] \\ \end{aligned}$$
(22)

Under these conditions, the new format for weighting matrices is as (23).

$$\begin{aligned} Q_1 =\left[ {{\begin{array}{lll} {Q_{1s} }&{} 0&{} 0 \\ 0&{} {Q_{1d} }&{} 0 \\ 0&{} 0&{} {Q_{1i} } \\ \end{array} }} \right] ,\quad \left\{ {\begin{array}{l} Q_2 =Q_{2s} \\ Q_{1d} =0 \\ Q_{1i} =k_\mathrm{int} H_s Q_{1s} H_s^T \\ \end{array}} \right. \end{aligned}$$
(23)

where \(Q_{1i}\) represents the integration weighting matrix.

5 Incorporation of KALMAN filter

As mentioned earlier, it is not practically possible to measure all output variables. Compass sensors, accelerometer, and gyroscope are mounted in unmanned helicopters, which respectively measure yaw angle, longitudinal movement, and rotational velocities of helicopter. Accordingly, flapping angles and Euler angles are not directly measurable. Therefore, KALMAN filter has to be applied to the system for predicting these values. Suppose the following system.

$$\begin{aligned} \left\{ {\begin{array}{l} x(k+1)=\Phi x(k)+\Gamma u(k)+e_x (k) \\ y(k)=Hx(k)+e_y (k) \\ \end{array}} \right. \end{aligned}$$
(24)

where \(e_{y}\) and \(e_{x}\) are respectively process and measurement noises with mean value of zero. To calculate predictor feedback matrix, an approach similar to computation of controller feedback matrix is followed. As such, the equations used in calculation of KALMAN filter productivity will be obtained through (25) [19].

$$\begin{aligned} \left\{ {\begin{array}{l} K(k)=\Phi P(k)H^{T}[R_{ey} +HP(k)H^{T}]^{-1} \\ P(k+1)=R_{ex} +[(\Phi -K(k)H)P(k)\Phi ^{T}] \\ P(0)=R_x (0) \\ \end{array}} \right. \end{aligned}$$
(25)

where \(R_{ey}\) and \(R_{ex}\) respectively are covariance matrixes related to \(e_y\)(k) and \(e_x\)(k) states. Sensor noise is assumed to be zero. Thus, variance of measurement noise (\(e_y \)(k)) will be zero as well. Figure 3 depicts how KALMAN filter is applied to system.

Fig. 3
figure 3

Simulation of KALMAN filter

To analyze the performance of predictor, two items of immeasurable state variables were compared for the simulated values and the values predicted by the KALMAN filter; the results can be seen in Figs. 4 and 5.

Fig. 4
figure 4

Simulated and estimated Euler angle \(\phi \)

Fig. 5
figure 5

Simulated and estimated Euler angle \(\psi \)

As it can be seen from Figs. 4 and 5, the predictor estimates selected Euler angles treatment similar to actual behavior of the system evaluated through nonlinear equations. It can be concluded that predictor estimates state variables behavior well.

6 Impact of wind disturbance

For applying the wind effect, lateral component of wind is considered as wind distribution component. Although wind has a 360\(^{\circ }\) distribution surrounding the helicopter as well as a \(\pm 180^{\circ }\) distribution (up and down), but the most effective one is lateral component of wind. Impact of this component on the helicopter gives a rise to force component along y-axis and creation of L component of the torque resulting from dynamics of main rotor. Furthermore, N component of the torque will be produced by dynamics of tail rotor.

6.1 Wind disturbance effects

The mathematical model is rewritten from the model proposed by [20].

$$\begin{aligned} V_{wind} =N_{wind} (\mu , \sigma ^{2})+A_F\cdot \sin (\omega t) \end{aligned}$$
(26)

where \(N_{wind} (\mu , \sigma )\) is a random process and represents the wind turbulence defined by white noise having an amplitude of 20 m/s, mean value of \(\mu = 0\), and variance of \(\sigma ^{2} = 0.7.\) Also, abrupt wind effect is defined by sinusoidal function with amplitude \(\hbox {A}_\mathrm{F} = 3 \mathrm{m/s}\) and angular velocity of \(\omega =0.628\) rad/s.

Effect of wind distribution on the helicopter body generates a force component along y-axis, which is exerted on the center of mass of the body. This effect can be mathematically explained by Eq. (27).

$$\begin{aligned} F_{y,wind} =\frac{1}{2}\cdot A_{Q,MR}\cdot A_{c}\cdot V_{wind}^{2} \end{aligned}$$
(27)

where \(\hbox {A}_{\mathrm{c}}\) is surface area of helicopter body. The wind effect exerted on the main rotor generates torque component L is evaluated via Eq. (28).

$$\begin{aligned} L_{wind}=\rho \cdot A\cdot \frac{C_{T,MR}}{\sigma }\cdot 4\cdot \Omega \cdot R\cdot V_{wind}\cdot \sqrt{(0.75\cdot R)^{2}+l_{m}^{2}}\nonumber \\ \end{aligned}$$
(28)

where \(\rho \) is air density, A is surface area of main rotor, and \(\hbox {C}_{\mathrm{T,MR}}\) represents propulsion force coefficient of the main rotor. Wind distribution also contributes to generation of torque component L caused by dynamics of tail rotor, which can be calculated using the Eq. (29).

$$\begin{aligned} N_{wind} =T_{wind}\cdot l_{t}, T_{wind} =4\cdot \rho \cdot \pi \cdot V_{wind}^2\cdot R_{TR}^2 \end{aligned}$$
(29)

where \(\hbox {R}_{\mathrm{TR}}\) is a radius of tail rotor blades. Figures 6 and 7 illustrates impact of wind distribution applied instantaneously on the system components.

Fig. 6
figure 6

Effect of wind disturbance on torque components (N/m)

Fig. 7
figure 7

Effect of wind disturbance on force (N)

7 Simulation results

Selecting initial weighting matrices is an arbitrary process, and then modifying should be done for each element separately to improve controller characteristics. Hence, initial matrices are assumed to be unit matrix for all weighting matrices; then after some try and error through simulation results, final form for matrices is selected as (30).

$$\begin{aligned} \begin{array}{l} \left\{ {\begin{array}{l} Q_{1s} =eye(11,11) \\ Q_{1i} =10^{-4}.eye(7,7) \\ \end{array}} \right. ,\quad Q_{2s} =\left[ {{\begin{array}{llll} 1&{} 0&{} 0&{} 0 \\ 0&{} {10^{4}}&{} 0&{} 0 \\ 0&{} 0&{} 1&{} 0 \\ 0&{} 0&{} 0&{} 1 \\ \end{array} }} \right] \\ \end{array} \end{aligned}$$
(30)

7.1 Controller performance with no initial conditions

Taking into account the weighting matrices from (30) and zero initial conditions, and also, neglecting the effect of wind distribution, the result of applying the controller will be as follows.

As observed in Fig. 8, there is a downward trend in \(v\) over first second which is because of tail rotor propulsion force, then is followed by an upward trend to level off. Also, since there is a relationship between flapping angles, changing \(\beta _{1s}\) will causes changing \(\beta _{1c}\). Hence, a small variation in component \(u\) will be generated. Considering linear matrices of the system, it’s cleared that \(u\) and \(v\) will directly effect on \(p\) and \(q\), which can be seen in Fig. 9. From Fig. 8, the steady state error, however small, in Euler angle \(\phi \) is because of neutralizing the effect of \(f_{y}\) created by tail rotor to avoid rotation of helicopter. As it can be seen, controller try to remove the variation in \(u,v\) using \(u_{lat}\) and \(u_{long}\).

The controller nullifies all the state variables except Euler angle within 5 s and with a very small maximum overshoot, indicating its suitable performance. As also mentioned in linearization section, all Euler angles cannot be simultaneously put equal to zero. For stabilizing the helicopter in hover conditions, it is enough to have zero angular and translational velocities and fixed Euler angles; these objectives were well realized (Fig. 10).

Fig. 8
figure 8

Translational velocities (m/s)

Fig. 9
figure 9

Angular velocities (rad/s)

Fig. 10
figure 10

Euler angles (rad)

7.2 Controller performance with initial conditions

In this case, the initial conditions are considered simultaneously for translational velocities and Euler angles. Values of these initial conditions applied with the purpose of investigating resistance of controller for all states of initial conditions. Hence, 1 m/s for translational velocities and 4 rad for Euler angles is considered. Figures 11, 12 and 13 represent performance of controller affected by initial conditions.

Fig. 11
figure 11

Translational velocities (m/s)

Fig. 12
figure 12

Angular velocities (rad/s)

Fig. 13
figure 13

Euler angles (rad)

Figures 11, 12 and 13 demonstrate variation trends of state variables of system influenced by initial conditions. As clearly seen, all parameters rapidly reach their final values and there is no steady state error in the system which is because of applying integration operator. In this state, the helicopter is rapidly held in hover state as well. The maximum overshoot in these diagrams are extremely small for all parameters.

7.3 Controller performance in the presence of both initial conditions and wind disturbance

The system now is tested under simultaneous impacts of wind disturbance and initial conditions. To do so, components of force and torque extracted in wind distribution section are added to the system with initial conditions stated in Sect. 7.2 in order to evaluate capability of the controller from this aspect.

Component of the force generated along y axis and under influence of wind force (Figs. 6, 7) largely influences v component of velocity. Though, L component of torque directly affects v component only but also causes change of flapping angles. As changes in one of flapping angle lead to little variations for other flapping angle, there are accordingly some changes in u component of velocity before reaching to final value as observed in Fig. 14.

As can be seen in Fig. 15, it is clearly known that no remarkable changes occur in parameters of rotational velocity in initial moments, but slight fluctuations are observed after 8 s. This is caused by impact of torque component L because rotational velocity component of p is directly affected by this torque component. Rotational velocity component q is directly affected by the torque component N, which doesn’t considerably influence parameter q owing to its small magnitude.

Fig. 14
figure 14

Translational velocities (m/s)

Fig. 15
figure 15

Angular velocities (rad/s)

According to Fig. 16, effect of torque component N on the Euler angle \(\psi \) results in steady state error. Furthermore, Euler angle, which is directly affected by torque component L, has also undergone steady state error. Nonetheless, it must be reminded that hover mode signifies zero translational and rotational velocities and constant value of Euler angles, which is perfectly realized in the current research.

Fig. 16
figure 16

Euler angles (rad)

8 Conclusion

An unmanned helicopter with six degrees of freedom was modeled in the current paper. System equations were initially extracted using the model recommended by NASA and the model then was simulated using SIMULINK/MATLAB software environment. Subsequently, system equations were linearized taking into account the hover conditions for helicopter. An optimal control was then designed using linear square regulator method. This controller is designed with the intention of reducing stabilization time and maximum overshoot in order to maintain the helicopter in hover mode. KALMAN filter was applied on the system for predicting values of state variables since all state parameters cannot be totally measured in practice. Finally, initial conditions and wind effect were also incorporated into the system in order to analyze resistance of controller. In this paper, selecting weighting matrices is done by considering Lyapunov asymptotic stability theorem which means that initial matrices suggested for optimal control in different references does not take into account. Surprisingly, better results are arrived in this research than other essays used suggested matrices; so that selecting fewer values for weighting matrices elements resulted in better performance with lower cost of designed controller. Consequently, from the results of this essay and some articles which worked on selecting weighting matrices through optimization methods [21], it can be concluded that using suggested matrices for weighting matrices just neglect some part of research area and will cause not only weaker performance, but also more expensive controller. Then it is recommended to start designing trend using unit matric and then modify it is necessary for better results.