*Article* **Unmanned Aerial Vehicles Motion Control with Fuzzy Tuning of Cascaded-PID Gains †**

**Fabio A. A. Andrade 1,2,\*, Ihannah P. Guedes 3, Guilherme F. Carvalho 3, Alessandro R. L. Zachi 3, Diego B. Haddad 3, Luciana F. Almeida 3, Aurélio G. de Melo <sup>4</sup> and Milena F. Pinto <sup>3</sup>**


**Abstract:** One of the main challenges of maneuvering an Unmanned Aerial Vehicle (UAV) to keep a stabilized flight is dealing with its fast and highly coupled nonlinear dynamics. There are several solutions in the literature, but most of them require fine-tuning of the parameters. In order to avoid the exhaustive tuning procedures, this work employs a Fuzzy Logic strategy for online tuning of the PID gains of the UAV motion controller. A Cascaded-PID scheme is proposed, in which velocity commands are calculated and sent to the flight control unit from a given target desired position (waypoint). Therefore, the flight control unit is responsible for the lower control loop. The main advantage of the proposed method is that it can be applied to any UAV without the need of its formal mathematical model. Robot Operating System (ROS) is used to integrate the proposed system and the flight control unit. The solution was evaluated through flight tests and simulations, which were conducted using Unreal Engine 4 with the Microsoft AirSim plugin. In the simulations, the proposed method is compared with the traditional Ziegler-Nichols tuning method, another Fuzzy Logic approach, and the ArduPilot built-in PID controller. The simulation results show that the proposed method, compared to the ArduPilot controller, drives the UAV to reach the desired setpoint faster. When compared to Ziegler-Nichols and another different Fuzzy Logic approach, the proposed method demonstrates to provide a faster accommodation and yield smaller errors amplitudes.

**Keywords:** control strategy; UAV; fuzzy; PID controller; ROS
