In-Flight Parameter Estimation for Multirotor Aerial Vehicles

This paper proposes a method for in-flight parameter estimation for Multirotor Aerial Vehicles (MAV). This task is important because it provides parameters with better accuracy for the actual vehicle operation. In order to simulate a flight it is adopted a simulation environment Software-In-the-Loop (SIL).


Introduction
When dealing with MAVs, flight tests, regardless of being performed in outdoor or indoor environments, involve risks, both for equipment and for the people who are participating in the experiment. These risks can be explained by the MAVs high speed propellers [1] and, from the standpoint of control, they are unstable, due to nonlinearities, aerodynamic disturbances [2] and a complex and coupled dynamic [3].
To avoid hazards during flight tests of such vehicles, simulation is an alternative to be used. Nevertheless, the simulation does not eliminate the need for flight tests. Therefore, it is only a preliminary step.
In general, simulations save time during the project development, and they can be said to be more efficient than experimental tests time-wise. Even so, simulations may not truly represent reality. An usual approach is SIL simulations, in which all the components are simulated, such as sensors, actuators and vehicle model. SIL simulations can validate a system before an experimental test, and it also allows the design of a compatible hardware with the software while avoiding damages of equipment. In this context, a simulation environment is useful for estimating in-flight parameters, since there are difficulties and risks to perform a real data acquisition. This paper is organized as follows: in section 2 the MAV modeling is presented, in section 3 the simulation environment SIL is described, in section 4 the method for estimation is presented, in section 5 the simulation results are shown and finally in section 6 some conclusions and future work suggestions are proposed.

Mathematical Model
The differential equations that describe the dynamic behavior of the multirotor can be obtained by the Newton-Euler formalism. This work chooses to represent the attitude by the quaternion of rotation q ∈ R 4 , however for visualization is adopted Euler angles (φ, θ and ψ).
The kinematic attitude model for the quaternion of rotation is given by the following differential equation [4]: where being ω ω x ω y ω z T ∈ R 3 the angular velocity of the vehicle represented in S R and [ω×] is given by: Rewriting the equation (1) explicitly, one obtains: Applying Newton's second law for rotational motion and neglecting disturbance torques, one can obtain: where τ [τ x τ y τ z ] T ∈ R 3 is the resulting propulsion torque in the vehicle represented in S B and h I ω ∈ R 3 is the angular momentum of the body represented in S B , being I ∈ R 3x3 the matrix of inertia of the vehicle represented in S B . It is assumed that the vehicle has symmetrical structure with respect to the coordinate axes. The matrix I resulting in a diagonal matrix defined by: Rewriting the equation (5) explicitly, one can obtain: Applying the second Newton's law of motion and neglecting any perturbation, we obtain the following model of translational movement in S I : where r [r x r y r z ] T ∈ R 3 is the three-dimensional position of the CM represented in S I , n [n x n y n z ] T ∈ R 3 is the normal unit vector perpendicular to the rotor plane represented in S I , f is the total thrust, g is the acceleration of gravity and m is the mass of the vehicle.

X-Plane Model
In this work it was considered the Gyro-200ED-X8 octocopter of the company Gyrofly Innovations 1 , as illustrated in Figure 2

Simulation Environment SIL
The environment consists in a computer running two software: MATLAB/Simulink and X-Plane. The attitude control laws and position are implemented in Simulink, while the vehicle dynamics and the flight environment are simulated in X-Plane. The sequence of sending and receiving data by the software MATLAB/Simulink and XPlane, can be observed in Figure 3.
The standard method of X-Plane to communicate with external processes and machines is through User Datagram Protocol (UDP). The steps in this data flow are: the X-Plane sends the outputs of the octocopter model to the control system using UDP (in this work it was used a rate of 90 Hz); the MATLAB/Simulink receives the data and performs the calculation of the control input signals, which are sent to the X-Plane; the X-Plane receives control input signals via UDP with values for throttle command. The works of [5] and [6] show more details of the communication between MATLAB/Simulink and X-Plane.

Parameter Estimation X-Plane Model
Define the set of identification indexes for the rotors of the octocopter as J {1, 2, ..., 8}. The analytical model of equations (7) -(10) has as inputs the total thrust magnitude f and the net propulsion torque τ. However, inputs of X-Plane model are throttles T j , ∀ j ∈ J. The T j has a magnitude which varies from 0 to 1. Since the control systems of both models are identical, it is necessary to convert f and τ to T j , in order to make the simulation with the X-Plane model equivalent to the analytical model, therefore allowing comparisons. The initial step of this conversion is to calculate the individual thrust f j .
Consider the octocopter illustrated in Figure 4. In this figure, ∀ j ∈ J, f j denotes the real thrust produced by the j-th rotor, τ j denotes the torque reaction of the j-th rotor. The arm length of the octocopter is denoted by l. Through inspection of Figure 4, we can obtain the magnitude of the total thrust f and the components of the resultant propulsion torque τ [τ x τ y τ z ] T ∈ R 3 , as being Based on equation (11), one can also affirm that the individual thrust commands f j , ∀ j ∈ J, are related to f and τ, by: where where k is the coefficient of yaw torque, defined by k k τ /k f . Using the Moore-Penrose pseudo-inverse matrix, the equation (12) is inverted, obtaining The last step is to convert f j to T j . It was made some tests in order to estimate how T j relates to both f j and τ j .
The tests consisted in varying T j and measuring both f j and τ j . It is expected that the measured values are equal to the command values. These tests have shown that T j relates to both f j and τ j by a linear equations below:

Simulation Tests
The dynamics of the mathematical model is integrated using the fourth order Runge-Kutta method with time step of T = 0.002 s, which is the same time step for the X-Plane model. The mass of the vehicle is m = 2.132 kg and the acceleration of gravity is g = 9.796 m/s 2 .
In order to estimate the parameters k f and k τ , it was elaborated a test that makes use of a simulation environment that was presented Section 3.
The test is the following procedures: stabilize the vehicle attitude and height; add a random signal δ 1 to T 1 to excite the models; measure f 1 and τ 1 ; estimate k f and k τ using the criterion of least squares and the measurements of f 1 and τ 1 ; and validate the estimated models. Only the data for rotor 1 are used, since all rotors are considered to be identical. Letf 1 andτ 1 denote measures of f 1 and τ 1 , respectively. Modeling the measures by: where [ 1 (t) 2 (t)] T ∈ R 2 represents eventual modeling errors or noise in the measurement.
Applying the data sets in the equation (18), for each sample at an instant of time t = t 1 , t 2 , ..., t n and writing in matrix form, one obtains: where Y [y(t 1 ) y(t 2 ) ... y(t n )] T , X . . .
Denoting the estimates of Θ by Θ, one obtains Θ according to the criterion of least squares (LS) [7], given by: For the models validation, a test was performed according to the following procedures: insertion of the estimated parameters in the models; stabilization of the vehicle attitude and height; random signal input μ 1 in τ; and comparison between the data for f 1 andf 1 .
In Figure 5 the random signals δ 1 and μ 1 are presented. In Figure 6 the comparison between f 1 andf 1 is shown, in which the data forf 1 is expected to be equivalet to f 1 . In Figure 6(a) the test results before the models estimation are For the estimation of (I x , I y e I z ), three tests are carried out. Each test consists in moving the vehicle along a single axis where the estimates have to be made, while the movement in the other axes are disregarded.
The Table 1 presents the estimated parameters.

Conclusion
The methodology presented proved to be effective, because it is possible to estimate the MAVs in-flight parameters through a simulation environment SIL. In this way we can minimize the risks in the operation of such vehicles. This methodology can be applied before flight tests.  Fig. 7. (a) Data forω x for the X-Plane and the mathematical models obtained through tests carried out after the estimation of I x in order to validate the estimated parameters. It should be noted that, after the stabilization of the models, μ 1 is added at 10 sec. (b) and (c) correspond, respectively, to the data forω y andω z for both models.
work, the presented procedures can be implemented in flight tests.