## 2 Materials and Methods
### Flight Controller Software  
We chose the Kakute F7 AIO as the primary FC because the ArduPilot [43] software can be compiled and installed on that board. The ArduPilot is a leading open-source autopilot software. It is well tested and greatly supported by a broad community of UAV enthusiasts. We compiled the ArduCopter subset of the ArduPilot stack. Figures 21 and 22 show a high-level overview of the ArduCopter software components. The structure of ArduCopter attitude controllers is shown in Figure 23. The original attitude controller is a cascade of Proportional (P) and Proportional-Integral-Derivative (PID) controllers [44] (for each axis separately). Although the original diagram mentions a Feed-Forward (FF) component, it was eventually disabled in our build of the ArduCopter software. We investigated the overall agility of the attitude controller and eventually implemented a novel variant of the Model Predictive Controller (MPC) [44,45] as described in [46]. The control law of the attitude PID controller (see Figure 23) is simple enough that the embedded microcontroller can compute it efficiently in the main control loop at 400 Hz. However, our MPC controller was computationally heavy and barely fit into the main control loop. An interesting control scheme optimization (event-triggered control scheme) was proposed in [47,48]--future research could check how much processor time could be saved without losing attitude stability. We implemented two new flight modes [49]: the FixedTestTrajectory and the Elka1Q mode. The former was helpful for model identification and controller tuning (described in detail in our other papers [42,50]), and the latter was entirely dedicated to the plane-like flight phase. Let us consider the flight dynamics of a fixed-wing plane with symmetric eleven control surfaces. When elevons deflect, the plane starts to rotate over its roll or pitch axis, depending on the direction of the elevons' deflection (to recap: the same direction of deflection leads to pitch rotation, and differential deflection leads to roll rotation). A simplified fixed-wing model can safely assume that the angle of the elevons' deflection is  
Figure 20: Axes of rotation and control forces produced by the drone’s motors and elevons (at the rear wing). proportional to the plane rotation speed. Based on that statement, we eventually simplified the Elka1Q mode. When activated, the main quadcopter motors are slowed down to a constant idle speed and no longer actuated. The pitch and roll control signals from the rate controllers (see Figure 23) are directly translated into the desired elevons' deflection angles. Such a simplification has advantages: the ArduCopter stabilize mode implements the attitude position and rate (i.e., rotation speed) controllers. Still, it allows control of the target roll and pitch angles via the human pilot's RC transmitter. Since the drone has not been tested in a wind tunnel, we were not sure how big we should allow for the deflection angles to be for controlling the drone safely. Due to that concern, we implemented a live-tuning (via RC transmitter knobs) of scale coefficients for the output pitch and roll signals, which were fed into the elevons' mixer. We decided to intentionally not implement any transition phase--a flip of an RC transmitter switch turns the Elka1Q mode on and off immediately. In our reasoning, we assumed it is safe to accelerate the drone in the regular quadcopter mode because the ArduCopter's stabilize mode maintains the drone's attitude in the air (i.e., it keeps the roll, pitch, and yaw tilt angles fixed). When the drone flies fast enough (faster than the estimated stall speed), disabling the quadcopter motors and enabling the elevons should (at least in theory) let it keep roughly the same attitude in the air in an actual on-wing level flight. Similarly, going back to quadcopter mode in a fast forward flight should not be a problem. The autopilot will just use different actuators to maintain the target attitude--the quadcopter motors instead of elevons.