Simple Controller Tuning for Unmanned Aerial Vehicles using Governors

A simple governor-based controller tuning is implemented and tested for the application to unmanned aerial vehicles (UAVs). We show that the governor-based tuning approach enables the high-level tuning of the existing controller of the UAVs by using a single tuning parameter only. We implement the approach on two UAV platforms of different sizes and controller frameworks to prove the versatility of the given approach. The validation is performed with experimental data collected for the UAVs flying in the supervised environment of an indoor flight laboratory.


I. INTRODUCTION
Unmanned aerial vehicles (UAVs) are used in an increasing number of applications, ranging from crop monitoring and spraying in agriculture over automatic inspection of infrastructure to search and rescue tasks (see, e.g., [1]- [3]). The field of possible applications grows even further when combining UAVs with ground robotics (see, e.g., [4] for a literature review in the context of production systems and the references therein). The hardware of UAVs is commonly tailored to specific tasks due to the broad spread of possible applications. Thus, UAVs come in various sizes and are equipped with different onboard sensors and actuators meeting the specific needs of the desired application. Consequently, UAVs are available from many different manufacturers and with a heterogeneous set of possible hardware configurations.
While UAVs were mainly operated by a minority of experts and enthusiasts a few years ago, the increased ease of operation and the increased robustness of the integrated controller structure enable almost everyone to control UAVs after a short briefing. This stems from the fact that the controller hardware is more powerful nowadays and undertakes tasks that previously had to be manually performed by an expert operator. Consequently, the direct steering of UAVs is more and more replaced by inputting reference values only for the closed-loop controller running on the UAV itself. Thus, the flight behavior of UAVs is mainly determined by the tuning of the control loops running on the flight controller.
The increased ease of operation masks the complexity of the controller structure. As the overall controller structure contains multiple control loops with a large number of parameters, the accurate tuning of the controller towards certain control goals necessarily requires expert knowledge.
An incorrect tuning may result in significant damage up to a total loss of the UAV or even cause damage to third parties. In some cases, a direct tuning of the control parameters may also require access to the software scripts implemented on the flight controller. Since these may be of enormous financial interest to the manufacturer, such an access is often not granted. Additionally, a retuning of the parameters or other significant changes to the control framework may cause conflicts regarding the UAV insurance. As a consequence, many UAV platforms do not provide an easy way for tuning the controller structure, nor do they grant access to the controller implementation.
Although the majority of commercially available UAVs are already delivered with controller parameters that yield stable flight behavior, the operator might want to change the controller tuning according to specific needs. As an example, a UAV operated outdoors may be tuned more aggressively to travel large distances in less time compared to a UAV operated in constricted indoor environments. A UAV operated indoors will usually be tuned more conservatively, resulting in slower movements and higher control accuracy to prevent contact with surfaces and equipment. Figure 1 shows such a scenario in the flight laboratory operated by the authors in the research building ZESS of the Ruhr-Universität Bochum. The complexity of the UAV controller structure on the one hand and the need to retune the controller with respect to specific use cases of the UAV on the other hand are addressed in this paper. The proposed method can be applied if the user has no access to the UAV controller and without expert knowledge on UAV controllers. We use a previously presented governor-based tuning approach (see [5], [6]) to retune UAVs without changing any internal tuning parameters. This way the controller structure and the parameters of the UAV remain unchanged, and only the reference values transmitted to the UAV are modified. As a result, the approach is highly adaptable to UAV platforms of different sizes regardless of the specific controller structure implemented by the manufacturer.
Section II introduces the governor-based approach and the basic terminology. Section III presents the experimental setup and the specific UAV platforms used in this contribution. Section IV gives results of flight experiments and evaluates the performance of the given approach regarding the implementation on the UAVs. Conclusions are given in Section V.

II. TUNING BY GOVERNORS
We briefly recall the main idea of using governors as summarized, e.g., in [5], [6], and present the different variants suitable for tuning the control behavior.
To tune the controller used in a UAV without changing internal parameters, we focus on the control error with the reference and the output value w(t) and y(t), respectively. The control error e(t) serves as the input to the original controller. A simple way to modify the control error artificially is to introduce a static scalar K, such that the control error e(t) can be manipulated according tō A new control errorē(t) results that enforces a different control signal when forwarded to the implemented controller. This so-called error governor can be used to generate more aggressive or more conservative control signals by choosing the value of K larger or smaller than one, respectively. K = 1 obviously yields original control behavior.
Error governors are useful especially if the control error is computed externally and forwarded to the controller. If the control error is computed directly on the controller hardware, the modification of e(t) might be difficult. Alternatively, the reference value and the process output can be modified before being sent to the controller according tō which results from (1) by introducing the manipulated reference value and process outputw(t) andȳ(t), respectively, describing the manipulated error bȳ However, it might be more practicable to manipulate only one of the signals forwarded to the controller. The same modified control errorē(t) as in (2) can be achieved by changing, e.g., the reference value w(t) using K and leaving the output signal y(t) unchanged. This so-called reference governor then only modifies w(t) and results from insertinḡ e(t) = K(w(t) − y(t)) in (3) and usingȳ(t) = y(t). The new reference valuew(t) reads If sent repeatedly to the UAV, the reference governor thus updates the reference value with respect to the current output value y(t) untilw(t) = w(t) holds for y(t) = w(t).
Analogously, a so-called output governor can be implemented by modifying the current output value depending on the current reference value while keeping the reference unmodified (w(t) = w(t)) For the experiments presented in the following section, we chose the reference governor structure given in (4), since the control error is computed onboard by the UAVs controlled here. Thus, the control error is not directly accessible outside the UAV.

III. EXPERIMENTAL SETUP
We use two UAVs of fundamentally different sizes: a Crazyflie 2.1 and a customized variant of the Holybro X500. Figure 2 illustrates the sizes of the UAVs, which are introduced in detail in the following subsections. Both UAVs are shipped with proprietary flight controllers. It is the purpose of the present paper to show that it is not necessary to get acquainted with these proprietary controllers, but governors can be used to change the flight behavior as desired. We use a motion capture system (MCS) tracking the UAVs in real-time. The MCS consists of 10 Vicon Vantage V5 infrared cameras and uses the software Tracker 3 for computing the positions of the UAVs with an error below 1 mm 1 . The UAVs are equipped with a unique and asymmetric arrangement of reflective markers that permits to determine the pose of the UAV. Figure 1 shows a UAV used for validation purposes flying in the flight laboratory with the infrared cameras visible in the background.

A. Crazyflie
The first UAV to be tuned is the Crazyflie 2.1 from bitcraze. The open-source small-scale quadrotor with a takeoff weight of around 27 g and a rotor-to-rotor diameter of approximately 130 mm is based on an STM32F405, and there is a wide range of existing implementations and various extension possibilities [7]. The Crazyflie is a popular choice for testing new control strategies due to the small dimensions and the resulting small damage potential. Recent research deals, e.g., with the implementation of various control methods such as fuzzy control [8], nonlinear model predictive control [9], and reinforcement learning [10], or with the combination of different control frameworks [11]. Figure 3 shows the Crazyflie with reflective markers for the MCS mounted on a 3D-printed expansion deck.
For the control of the Crazyflie in combination with the MCS as positioning feedback, we modify parts of the CrazyFlie-SdGN 2 Github Project. Here, high-level control commands are used, e.g., to realize a point-by-point flight based on pre-specified coordinates. The control structure of the Crazyflie is sketched in Fig. 4. The scheme is a modification of the original figure presented in the bitcraze documentation 3 , extended by the MCS as used by CrazyFlie-SdGN and the Reference Governor proposed in Section II (red components). All control loops of the cascaded PID scheme are shown with the sampling rates and corresponding inputs and outputs. The MCS serves as additional outer position It is evident from the black blocks in Fig. 4 that the Crazyflie is controlled with PID control loops. Thus, the tuning of the overall flight behavior requires the tuning of multiple individual control loops.
We augment the original control scheme by introducing the reference governor shown in red in Fig. 4. The reference governor alters the desired position. This simple extension of the existing scheme suffices to achieve the desired flight behavior without modifying any part of the existing flight controller. As expressed by (4), both, the original reference value as well as the current position are needed for manipulating the reference value. Here, we use the current position of the Crazyflie measured by the MCS.
We chose a sampling rate of 10 Hz for sending manipulated reference values. It will be evident from the results presented in Section IV that this rate is adequate. The communication between the Crazyflie and the guiding PC is established via the Crazyradio PA USB radio dongle using a 2.4 GHz ISM band radio.

B. Holybro X500
We use the customized quadrotor based on the Holybro X500 shown in Fig. 5 as the second UAV to be tuned. This UAV has a rotor-to-rotor diameter of 500 mm and is able to carry an additional load of up to 1 kg, rendering it suitable for transporting objects or carrying various additional sensors and cameras. Consequently, the X500 covers fundamentally different application scenarios than the Crazyflie. The X500 is controlled by a Pixhawk Cube Orange flight controller, running the open-source autopilot software system Ardupilot 4 , which is commonly used for many UAV applications. In our setup, we established the communication to the X500 using the Hex Herelink 1.1 controller, which also operates on a 2.4 GHz ISM band. The X500 is meant to be operated outdoors and uses a top-mounted GPS antenna for position feedback (see Fig. 5).   We replace the GPS position information with the position information provided by the MCS. This way, the controller structure of the X500 does not need to be altered. We claim the proposed governors would also work using GPS information.
We use the MAVProxy 5 software with the associated Vicon module to convert the position information coming from the MCS to GPS information and periodically send it to the X500. The GPS information is sent via an additional WiFi connection deployed using an ESP8266 Microcontroller and the MAVESP8266 firmware 6 . The described setup follows the instructions given in the Ardupilot documentation. 7 Similar to the Crazyflie setup, we manipulate the desired position by using (4), again sending the manipulated reference value with a sampling rate of 10 Hz. The reference governor is implemented in a MAVProxy module and resembles the Crazyflie implementation. This underlines the simple applicability of the reference governor to various controller frameworks without additional implementation effort.
The Crazyflie and the X500 are based on open-source projects. However, the proposed approach also applies to UAVs based on proprietary software if reference values can be transmitted to the UAV.

C. Experiments
We generate step responses for a change in the reference height for the Crazyflie and the X500 to analyze the suitability of a reference governor as a tuning mechanism for different UAVs with different controller hardware. We set the default height to 1 m instead of starting from the ground to exclude disturbances due to the ground effect. The step is a change of the reference value w(t) to a new reference value of 2 m in direction of the z-axis, resulting in a step length of ∆w = 1 m.
Starting with a tuning factor K = 1 (see (4) in Sect. II), we first measure a benchmark step response. Subsequently, we change the factor K to both smaller and larger values, starting with an increase to generate a more aggressive control behavior (K > 1). Afterwards, we chose K < 1 to yield a more conservative flight behavior.
The Crazyflie runs on a single-cell lithium polymer battery and the flight behavior is known to be affected by the battery voltage (see, e.g., [12]). We replace the battery with a fully charged one after each Crazyflie flight and before changing the factor K to minimize the influences of different battery charge levels in our experiments.
The X500 is powered by a four-cell lithium polymer battery. The impact of the voltage on the flight behavior is smaller for the X500. Consequently, all tests are conducted with one battery charge.
We analyze all step responses for both UAVs quantitatively using well-established parameters: • Rise time t r : time span from changing the reference value to entering a tube of 5% tolerance around the reference value for the first time • Settling time t s : time span from changing the reference value to entering a tube of 5% tolerance around the reference value for the last time • Maximum overshoot e max : difference between maximum output y max and new reference value w with respect to the reference change ∆w as in The 5 % tolerance band around the reference value is introduced to ignore the influence of small disturbances that are inevitable during the experiments. The results for both UAVs and their evaluation are presented in Section IV.

IV. EXPERIMENTAL RESULTS
We first analyze the results of the experiments for both UAVs in a qualitative fashion and corroborate the observations using the quantitative parameters introduced in Section III-C afterwards.
A. Results for the Crazyflie Figure 6 shows the step responses of the Crazyflie to a change in the reference height for three different tuning factors K. According to (4), the original reference value results for K = 1 (solid black line). The Crazyflie slightly overshoots the new reference height of 2 m (dashed black line) before minimizing the remaining control error. As expected, a faster rise to the reference, by tolerating a larger overshoot, is observable for a more aggressive controller tuning using a tuning factor of K = 1.5 (yellow line). The reference value is artificially increased according to (4) until the actual reference of 2 m is reached. The tuning towards a less aggressive behavior (K = 0.66, purple line) results in a more damped step response as expected. The resulting controller is more conservative and yields a reduced overshoot, however, by accepting to reach the reference value significantly later.
A more quantified comparison is conducted using the results summarized in Table I. All parameters, the rise time t r , settling time t s , and maximum overshoot e max underline the Step responses of the Crazyflie for the regular controller (black) and a more (yellow) respectively less (purple) aggressive controller tuning. The reference value w is shown by the dashed line. qualitative observations presented before. For a tuning factor of K = 1.5, the rise time decreases by around 6.2 % with respect to the original tuning (K = 1), while both, the settling time and maximum overshoot increase by around 5.9 % and 53 %, respectively. In contrast, for a more conservative controller tuning using the reference governor, an increase of the rise time by almost 110 % can be observed, while the maximum overshoot decreases by around 27 %. However, the conservative controller still overshoots the reference value. Due to the overshoot in combination with the conservative flight behavior, the settling time of the conservative controller increases by around 8.8 %. This is, however, not very intuitive and underlines the fact that the governor enables a simple and relative tuning, that still depends on the internal controller design.

B. Results for the X500
We use the same step function and the same tuning factors for the X500 experiments that we used for the experiments with the Crazyflie. This way, a qualitative comparison between both UAVs is possible in addition to the evaluation of each experiment. Figure 7 shows the step responses of the X500 using K = {0.4, 1, 1.5}. It is evident from Fig. 7 that the qualitative tuning of the controller using the tuning factor K is successful. The reference tuning (K = 1) is depicted as a solid black line in Fig. 7. Similar to the tuning of the Crazyflie, a more aggressive tuning can be achieved with K = 1.5 (yellow Step responses of the X500 for the regular controller (black) and a more (yellow) respectively less (purple) aggressive controller tuning. The reference value w is shown by the dashed line.  Table II. It follows from the results in Table II that the rise time can be reduced by around 18 % in comparison to the reference tuning by tuning the controller with K = 1.5. However, a more detailed quantitative evaluation is not possible for the X500 experiments, because not all values can be obtained from Fig. 7. For instance, all tuning factors yield aperiodic controllers without overshooting the reference value. Additionally, the controller retuned with K = 0.4 does not reach the reference value within the experiment time of 10 s.
Comparing Fig. 6 and Fig. 7 reveals that using the same tuning factors K = {0.4, 1, 1.5} yields fundamentally different control behavior for the tested UAVs. While all measurements with the Crazyflie overshoot the reference value, the experiments performed with the X500 present an aperiodic step response. This underlines the fact that the retuning always occurs relatively to the present controller of the specific UAV. Although this might seem obvious, it must be taken into account when starting the retuning procedure of a UAV. However, tuning the controller even more aggressively and provoking the overshooting of the reference value is also possible for the X500. Figure 8 shows the step responses of the X500 with K = {1, 2}. For K = 2, the tuning is aggressive enough such that the X500 also overshoots the reference Step responses of the X500 for the regular controller (black) and a more aggressive (red) controller tuning. The reference value w is shown by the dashed line.
value. Consequently, similar results can be achieved for the Crazyflie and the X500. Obviously, specific step responses correspond to different tuning factors, and the correct tuning factor yielding the desired flight behavior must be found in an iterative fashion.

V. CONCLUSION
We showed that, despite their complex controller frameworks, the control behavior of different UAVs can suitably be retuned with a single tuning parameter using governors. We implemented a reference governor to tune the controllers of two UAVs of different scales and showed with several experiments that the governor approach yields the desired effect for both systems. Thus, the presented approach is suitable to retune UAVs whenever the detailed retuning of internal control parameters is not possible due to lacking access or prohibitive restrictions.
While this work investigated the tuning for reference changes of the height, future work will focus on validating the retuning for all degrees of freedom of the UAV.