# Optimal Control for a Three-Rotor Unmanned Aerial Vehicle in Programmed Flights
## 1 Introduction  
Unmanned aerial vehicles are the subject of many publications, and their applications are growing every year. New possibilities for implementing this technology to improve various areas of life, such as medical rescue [1], management of large buildings [2] and their inspection [3], creating models of existing buildings [4] and their assessment [5], as well as for public safety by state authorities [6], are being discovered. Due to the responsibility and complexity of the tasks performed, reliable and mission-adapted flying objects are necessary. The quadcopter is the most popular type of multi-rotor unmanned aerial vehicle (UAV). There are many scientific articles available on its control [7] and dynamics [8]. The tricopter, which uses three motors to generate thrust, is a much less common type of UAV in the literature. It requires a suitable design due to the odd number of motors. Examples of using a tricopter with a tail servo [9] or without [10] can be found in the literature. Scientists have mainly focused on design projects [11] and construction [12] of tricopters, with less attention given to simulation studies of their flight dynamics. The literature on modeling this type of object does not provide sufficient attention to control and quality regulation. [PERSON] et al. [13] presented simulations of the motion of a tricopter in their work but did not indicate how to choose the coefficients of regulators for this type of object. [PERSON] has focused his dissertation [14] on considering what type of controller is best for a tricopter-type object. However, he did not consider the universality of the implementation of the controller types in question and the possibility of tuning their parameters to the needs of users. On the other hand, the authors of the paper [15], subjecting to their considerations an object of the tricopter type, considered a design that is not commonly used due to the lack of a tail servo. The tail servo not only makes it difficult to consider the control of thisobject but also provides opportunities for better control during dynamic movements. In a number of papers, including [16], the authors have considered the control of the chosen design but have not considered the choice of controller settings depending on the mission to be performed by the UAV. Most of the research conducted does not focus on using the tricopter to perform a specific task but only on experiments testing the correctness of derived models [10]. The authors believe that there is a gap in the optimization of program flights and the methodology for selecting tricopter regulator gains for program flights presented in this paper. The authors of this paper addressed the issue of selecting proportional-integral-derivative (PID) regulator parameters for tricopters for altitude, rotational, and linear motion, which, according to the authors' current knowledge, has not yet been accomplished using the proposed method. The choice of the type of regulators was conditioned by its common implementation in flight control software such as PX4, ArduPilot, and BetaFlight. Common optimization methods were used to achieve the intended goal of selecting parameters. The use of optimization methods for all gains of specific trajectories is innovative. The authors first considered which optimization method is best, for example, a hovering task. They then proceeded to use the best optimization method to realize specific trajectories that may be useful for, for example, monitoring buildings. The author's contribution to the paper was to optimize controller coefficients not for general tasks but to consider individual tasks and present a procedure for how the recipients of this paper can perform optimizations not only for their object but for a specific object and a specific trajectory, which has not been the subject of research work before. A computer-aided design (CAD) modeled object that can be printed in 3D was used in this paper.