3D Simulation of Flight Control System for Quad Tilt Rotor UAV Based on Flightgear

The quad tilt rotor (QTR) has complex dynamics characteristics, especially in conversion mode. It is difficult to model the QTR dynamics and the environmental factors have a great influence on it. To solve the problem of control in conversion mode of QTR, this paper carries out the design of the controller based on improved active disturbance rejection control (ADRC). We propose the 3D simulation based on FlightGear to better reflect the state of quad tilt rotor in conversion mode. The simulation results show that the flight control system is effective. The 3D real scene simulation can directly observe the status of every control mechanism, which can provide a better and more intuitive analysis for manipulation strategy.


Introduction
The quad tilt rotor (QTR) combines the advantages of multi rotor and fixed wing with good vertical takeoff/landing and cruising performance. It has the characteristics of long range and high cruising efficiency. Because of its multi rotor and fixed wing UAV flight characteristics, the design of its flight control system is the focus and difficulty [1][2][3][4][5][6][7].
Papachristos [8] exhibited the nonlinear/linearized dynamics and the corresponding attitude tracking controller designed by PID controller. However, due to the nonlinear coupling of longitude and latitude manipulation and the indeterminate complex variable mechanical structure with tilting of the nacelle [9,10], the control effect of the PID controller is limited. Oner [11] designed a LQR controller for position control of the vehicle in vertical flight mode. The flight control method based on the optimal control needs to obtain an accurate linear model by linearizing the nonlinear model. However, for the nonlinear model, the control range of the controller is limited to the vicinity of the trimming point. References [12][13][14] combined intelligent algorithms with classical control algorithms, considering that the tilt quad rotor is high order, time varying and nonlinear system in the transition mode, Cheng Peng [15] introduced neural network into PID controller to improve controller robustness. But the controller structure is more complicated and the design process is difficult.
In this paper we design an attitude controller based on active disturbance rejection control (ADRC). We propose a 3D simulation based on FlgihtGear and design a 3D model of quad tilt rotor. The 3D simulation is carried out to verify the model and flight control system.

Tracking Differentiator
TD is tracking differentiator that arranges a transition process for the attitude angle command and obtains its differential signal, that is, the attitude angular rate command:

Extended Sate Observer
The ESO can simultaneously estimate the system states and total external disturbance. The structure of the ESO can be described as: , ,

Nonlinear state error feedback
NLSEF is a nonlinear state error feedback that nonlinearly combines the deviation between the output of the tracking differentiator and the state of the system. The traditional NLSEF control law of ADRC is as follows: 1 e is error between the command signal and the controlled object position output, 2 e is the error between the command differential signal and the controlled object speed output. Through OpenSceneGraph technology, FlightGear supports various 3D file formats, including VRML1, AC3D, DXF, etc. Among them, .ac file is the standard used in most FG models. The model development in this paper also uses AC3D for secondary development. Figure 2 is the rendering of the quad tilt rotor model developed with AC3D software. During modeling, it is important to note that the definition of the object name corresponds to the name in the configuration file below. The property "/sim/model/path" in the main FlightGear property tree controls which models will be loaded. The easiest way to load a new model is to use the "--prop" command: fgfs -prop:/sim/model/path=Models/V44.ac If set the 3D model to the default value for the aircraft instead of specifying it on the command line, it is needed to edit the aircraft configuration file. When starting FlightGear with the "--aircraft" option, it reads properties from one of the folders, such as: fgfs -aircraft=V44 There are a series of configuration files in the aircraft model file, as shown in figure 3. The Models folder contains all model-related files, such as textures, 3D models.ac, and animation.xml files. The entire aircraft can be modeled as a file or split up to make it easier to move parts of the aircraft. The partial code of the animation file is shown in figure 5.

Design of 3D Model for QTR
The. XML in the home directory contains the entire flight dynamics model of the aircraft. There are three different flight dynamics models in FlightGear: YASim, JSBSim and UIUC. They have their own advantages and disadvantages. When model data is limited, YASim is considered the best way to model, and when real wind tunnel data is available, JSBSim is the best choice. All of them can be found in the open source model. The partial code of the dynamic model is shown in figure 6.
The Systems folder is system interaction files, including buttons and help documents. Sounds folder is a sound file for the actions of various parts of the model. The sound is very important for the actual feeling of the simulation.

3D Real Scene Simulation Environment
This simulation environment is built in the ununtu 18.04 system. It is relatively easy to configure the environment in the Linux system with only a few lines of commands, and it is faster to develop under Linux than under Windows. First, install git environment through the following commands: sudo apt-get update sudo apt-get install git sudo apt-get install gitk git-gui When git is installed, clone the source from GitHub with the following commands: git clone https://github.com/ArduPilot/ardupilot cd ardupilot git submodule update --init --recursive Then install the build tool chain and configure the environment: Tools/environment_install/install-prereqs-ubuntu.sh -y .~/.profile Install and update MAVProxy and pymavlink: pip install --upgrade pymavlink MAVProxy --user Finally, FlightGear is installed to achieve 3D display: sudo apt-get install flightgear The environment for 3D real scene simulation is completed. Its architecture is shown in figure 7.

Simulation Results
To start FlightGear, open the script file with the following command: fg_quadplane_view.sh When FlightGear starts, start the simulation environment with the following command: sim_vehicle.py -v ArduPlane -f quadplane -L KSFO --console --map After the simulation environment is started, commands can be entered through the terminal or directly through the ground station for simulation. In the process of simulation, first to takeoff in helicopter mode, as shown in figure 9(a) and (b), then set a target, let the quad tilt rotor fly to the target point automatically. In the process of flight, if the current flight speed reached the set value, the flight mode automatically from helicopter turn to fixed wing. When the quad tilt rotor reaches the target point, it will hover around the target position. Then the flight path planning is carried out for the quad tilt rotor. As shown in figure 9(c) and (d), the quad tilt rotor followes the set trajectory in fixed-wing mode and land in helicopter mode. Figure 10 shows the flight modes of quad tilt rotor during the whole flight. In the whole simulation process, the quad tilt rotor can follow the commands very well, and through the 3D real scene simulation, the nacelle state of the quad tilt rotor during the conversion mode and the flight state of the quad tilt rotor can be better reflected.

Conclusion
In this paper, we carry out the design of the controller based on improved active disturbance rejection control. We propose the 3D simulation based on FlightGear to verify the flight control system. The simulation results show that the flight control system is reasonable and effective. The 3D real scene simulation can directly observe the nacelle state and the flight state of the quad tilt rotor.