Development and Verification of a ROS-Based Multi-DOF Flight Test System for Unmanned Aerial Vehicles

Unmanned aerial vehicles (UAVs) are used in many research fields for diverse operations, requiring the system to be safe and efficient. Therefore, the UAV system’s robustness and integrity are paramount in its design and operation. For these design and operational requirements, we propose a robot operating system (ROS) based multi-degree of freedom (DOF) flight test framework for the safe development, verification, and validation of UAVs. The developed flight test system includes a test bench capable of moving freely in 4 DOF, an electronic control unit (ECU) for collecting data from sensors and running the operation software, a power supply unit (PSU) to power up each device, an operation software tools developed in ROS for seamless integration of the software and hardware systems, and a wind tunnel for simulating the flight environment. The fidelity of the flight test framework was verified through experimental tests conducted on a rocket-propelled foldable unmanned aerial vehicle under development.

on the characteristics of the flight equipment and the diversity of missions [4].
This study presents a multi-degree of freedom (multi-DOF) flight test system that uses robot operating system (ROS) utilities to shorten the development period of modifying the test system configuration according to requirements. This flight test system is also an inspection tool that allows groundbased tests that simulate an actual flight to find and confirm anomalies in key components. System testing, firmware validation, and data gathering may all be done with the multi-DOF flight test system before the real test.
Verification methods of the test bench performance, based on a mathematical model, often include software-in-theloop (SIL) and hardware-in-the-loop (HIL) [5], [6], [7]. In the case of SIL, although it is relatively free from the physical constraints of hardware, the operation and results of the actual flight may differ depending on the modeling characteristics. In the case of HIL, due to physical constraints, an error may occur in the motion characteristics due to interaxis interference and friction, depending on the method of assembling test bench components to acquire multi-DOF [8].
To reduce the error caused by this static method, only the moving range of the UAV in a free-flight state is limited [9]. The weight error in the test system is corrected using different means, such as counterweights and belts [10] or additional actuators [11]. For the test system proposed in this work, the UAV is mounted on the test system through a spherical joint or a linear bearing to achieve multi-DOF.
The DOF of a flight test system can vary from 4-DOF (or 6-DOF) for complex position control tests to the simplest one with 1-DOF. Table 1 compares the design approaches of preexisting flight test benches.
Jin et al. [8] of Suncheon National University developed a flight test system with 6-DOF using bearings and wheels without installing additional motors other than UAVs. However, rather than testing with an actual UAV, it is a 6-DOF motion test device for developing a small quadrotor drone and aims to verify the controller's performance. In addition, errors may occur in the system due to friction or vibration, and no device exists for correcting them.
Mukras and Omar [9] of Qassim University connected the target UAV with a cable in a cage that can protect the UAV and implemented 6-DOF to allow free flight within a limited range. This method has a simple structure and may have little effect on mechanical friction or vibration. However, if the target UAV leaves the test rig, the actuation of the safety device may affect the UAV flight dynamics.
Inspired by the gyroscope, Yuzgec et al. [10] of Bilecik University realized 4-DOF with a 3-DOF device consisting of three rings and a vertical axis 1-DOF device using a belt, pulley, and weight. However, according to the position of the ring during 3-DOF rotation in this method, the gimbal lock phenomenon may occur in the same way as in the gyroscope, and as the vertical axis also operates without a motor, error may occur due to friction and inertia.
Ding et al. [11] of the New Jersey Institute of Technology implemented 6-DOF using a vehicle equipped with a robot arm and Omni wheel. In this study, the actual flying device was mounted on the end of the robot arm and tested. The multi-axis force sensor mounted on the part connecting the UAV measures the thrust error and controls the flight trajectory through the robot arm and the driving motor of the vehicle to realize free-flight motion. A software algorithm was used to restrict the movement of the cart and robot arm to ensure safety during the flight test. For these devices, the system's flight trajectory or vibration analysis can be complicated in proportion to the number of controllable motors and DOF.
Jatsun et al. [12] of Southwestern State University implemented a 3-DOF test bench for a simple vertical take-off and landing (VTOL) tiltrotor UAV flight test. The test bench is capable of rotational motion of 2-DOF and translation motion of 1-DOF. The translational motion has 1-DOF in the direction of gravity. A counterweight connected by a cable and a pulley is installed to offset the UAV's gravitational acceleration error. However, this increases the weight of the translating system and may also increase friction and inertia errors compared to free flight. It further revealed that additional error control through the motor is required.
ROS, utilized in robot control, provides services for various computing tools, such as hardware abstraction and message passing between processes [13], [14]. Moreover, ROS is commonly used with PX4: an open-source UAV autopilot [15] used as a flight control unit in this work. The flight test system consists of a test environment that integrates ROS-based UAVs and other ROS systems through an inter-process message-passing protocol of ROS. Because it is an open-sourced software with many useful features, ROS remains prevalent in its implementation in various works. This software tool greatly shortens the developmental period of modifying the flight system configuration according to the test environment [16], [17], [18], [19].
This study proposes a test system and method that provides an interim step between the flight test phase and the software simulation test phase of small unmanned aerial vehicles to deliver the following: 1) Save the cost of modifying the flight test platform based on aerodynamic theory each time according to the diversifying UAV geometry.
2) Conduct realistic flight tests of UAVs while avoiding the threat of damage or accidents.
3) To verify the operation of the developed flight test system through flight testing of the UAV under actual development.
In addition, we solve the following problems that arise in achieving the above objectives in this paper: 1) We show how we used ROS to solve the problem of complex functions and data processing required to achieve the above objectives.  2) Introduce the Z-axis translator that can simulate motion and ground effects during take-off and landing and how to operate it.
3) Introduce a method to generate appropriate INS data for a stationary flying device assuming a flight test.
The remaining works in this paper are organized as follows. Section II presents the overview of the main subject describing the overall flight test system design and organization with a proper introduction of its subsystems, such as the test bench, electronic equipment, and operating software tools. In section III, we present experiments and results to evaluate the performance of the fabricated flight test system. Lastly, the conclusion and future directions are given in section IV.

II. EQUIPMENT DESIGN A. SYSTEM OVERVIEW
The ROS-based flight test system is a multi-DOF test bench consisting of a safe platform for mounting a target UAV, electronic control unit (ECU) that collects data and runs part of the operation software, and a system driving device. It also houses a power supply unit (PSU) that supplies appropriate power to the target UAV, ROS-based operation software, and a wind tunnel for simulating the flight environment, as shown in Fig. 1 and 2.
The target UAV corresponding to the system's external device and the external system are indicated by dotted lines in Fig. 2. The test bench consists of a head and a Z-axis translator. The head consists of a ground simulator, a 3-axis force sensor, and a spherical joint. This arrangement makes 4-DOF movement possible through the head's spherical bearing and the Z-axis translator. The ECU oversees the hardware data processing of the attached sensors to the test bench, the operation software tool that runs on the main server computer, and a network adapter to provide access to the ROS operating environment.
Most of the background computation by the operating software is processed on the ECU's server computer.
The result display, data acquisition, and graphical user interface (GUI) console programs can be operated on any computer, such as desktops and tablets, connected to the flight test system through a network adapter. In this system, a monitor and a tablet PC are configured to run the display program of the software and the GUI console program. Similarly, when testing a ROS-based UAV, it can be connected to the appropriate network adapter to form an integrated test environment.
A total of 15 fans are individually controlled in the wind tunnel, and it is designed to simulate various flight environments such as laminar, gust, and turbulent flow. A fan control unit controls each fan's motor controller, and a monitor is connected to the pen control unit to check the pen control status. The fan control device is connected to the network adapter and configured to be controlled in the ROS environment.

B. DESIGN
The standard mass of the target UAV that can be tested was selected based on the classification of small UAVs [20]. Accordingly, the maximum allowable mass of the target UAV was set to 30 kg and based on this, the structure of the flight test system was designed.
The configuration was in the form of a shelf for easy access to the attached PC. The target UAV is fixed to the head of the test bench. The design geometry of the system is shown in Fig. 1. The main functions of the flight test system consist of the implementation of ROS-based operating software, multi-DOF, and simulation of the flight environment, which is made possible through the configuration of the communication system, as shown in Fig. 2.

1) TEST BENCH
The test bench is shown in Fig. 3. Its configuration is designed for intuitive control through a tablet with a touch input device. The Z-axis translator device is fixed at the center, and the head unit and the target UAV are connected at the top.
To easily transport the test bench to various environments, it is not permanently fixed to the floor but configured to be movable with a mounted caster on the lower part. The width of the test bench was set to 0.8 m to ensure movement in narrow spaces such as doors and elevators with a width of less than 0.9 m. The deployable and foldable legs of the test bench are shown in Fig. 3. The PSU and ECU are fixed to the lower part of the test bench to minimize the effect of the load applied from the target UAV during the flight test. This design can help to shift the center of gravity of the flight test system to the ground. The overall specifications of the test bench are presented in Table 2.

2) HEAD
The head is designed to have a spherical bearing for the realization of 3-DOF rotation of the target UAV fixed to the head through a grinding rod connected to the Z-axis translator, which enables the flight test system to have a total of 4-DOF. As shown in Fig. 4, a 3-axis force measuring sensor is installed between the spherical bearing and the abrasive rod. The operating software collects the flight data of the target UAV through the corresponding sensor (3-axis force sensor updater). It estimates the actual thrust and error (position and force estimator) used as inputs to compensate for the Zaxis error through a motor. In addition, to correct the vertical translation error, a lidar Z-axis distance sensor is installed to measure the elevation of the Z-axis. The specifications of the head parts are given in Table 3.

3) GROUND SIMULATOR
The ground simulator, one of the main functions of the head, simulates the actual landing environment by limiting the  movement of the spherical joint when the UAV is on the ground before take-off ( Fig. 4a and 4b). At the lower end of the spherical joint, a spherical joint latch is located, and this spherical joint latch is moved by a motor and pushes up the spherical joint from the upper part, acting as the ground surface.

4) Z-AXIS TRANSLATOR
The Z-axis translator (a device enabling the vertical motion of a target UAV) is a part of the flight test system for simulating 37072 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply. vertical flight conditions. The assembly of the device is shown in Fig. 5, with two motors mounted at the bottom of the assembly to reduce vertical translation error. The maximum displacement of the device translating along the Z-axis is 0.8 m. The head and the rod of the device installed for vertical axis translation incur additional weight on the mounted UAV. It is necessary to compensate for these extra loads using the motors and other means, such as the counterweight shown in Fig. 5. The maximum combined load of the head and the rod is 16 kg. Therefore, the counterweight eliminates the extra load applied to the motor. The specifications of the Z-axis translator are shown in Table 4. The schematic diagram shown in Fig. 6 describes the weight distribution of the Z-axis translator. The weight and mass variables used in the following equations are described in Table 5.
The combined weight of the counterweight and carrier is denoted with w 1 while w 0 is the sum of the weight of the target UAV and the combined weight of the head and rod, as shown in Eq. (1) and (2),  The belt and the pulley weights are considered negligible in the above model. A change in the mass of the counterweight system changes the w net , and m transys , as shown in Eq. (3) and Eq. (4), when w net equals m uav g, the extra load applied to the motor is eliminated. But also w net can be changed referring to test purposes. m head and m carrier are fixed values, and m cw can be determined by the number of installed counterweights before the flight. The dynamic model can be defined when the UAV is mounted on a vertical axis, as shown in Eq. (5), where f uav is the force applied to the UAV, f motor denotes the force generated by the motor, f fric is the frictional force generated by the vertical axis translator. UAV flying without being mounted on a test bench environment can be expressed as: Referring to Eq. (6), the Z-axis translator simulates the specific mass of the UAV to m target , as shown in Eq. (7), When the acceleration error is zero, a transys should be the same with a target , f motor can be determined using equations of the form given in Eq. (5) and Eq. (7), as shown in Eq. (8),

5) ELECTRONIC CONTROL UNIT (ECU)
The main functions of the ECU are to collect sensor data, provide a local network for ROS, and control the flight test system actuators. In addition, a separate power supply for the built-in device is provided, which is operated separately from the PSU for the driving device. The ECU (shown in Fig. 7) is mounted on the lower part of the test bench.  The main server computer is connected to a data processing unit, a universal serial bus (USB) hub, a lidar sensor, and a network adapter. The data processing device converts the analog signal measured by the 3-axis force sensor into a digital signal through an analog-digital converter, processes a low pass filter (LPF), and finally delivers it to the main server compute through UART communication.
The motor controller installed on the test bench is connected to the USB hub, and the data measured by the lidar sensor is transmitted to the main server computer through a serial peripheral interface (SPI) bus communication. The network adapter is directly connected to the main server computer and supports the ROS communication network (Publication/Subscription Message Bus).
The ECU's power supply receives ac single-phase (220V) and supplies 18V power to the DC-DC converter and the main server computer. At this time, the DC-DC converter converts the supplied power to a 9V voltage and supplies power to the tablet PC connected outside the ECU. The main server computer has a built-in DC-DC converter. It converts the supplied power into 5V to supply power to USB devices, lidar sensors, and data processing devices connected to each system part ( Table 6).

6) POWER SUPPLY UNIT (PSU)
The PSU provides power to the drivetrain of the target UAV and test bench. Four 1.5kW power supplies are installed in parallel to support long-term flight tests in place of the target UAV's battery, and the 0 60V power supply can be controlled by program control. But it is possible to supply power to the target UAV for consistent flight test results regardless of battery voltage enhancement or internal resistance. It is possible to implement the target UAV's constant flight test environment. The PSU is mounted with the ECU at the bottom of the test bench. Fig. 8 is a diagram showing only the PSU, and the designed specification is given in Table 7.

7) OPERATION SOFTWARE
Th operating software that collects the sensor data of the flight test system and controls the actuator consists of an independent program that utilizes the ROS-based message transmission protocol.  The message bus (ROS Publication/Subscription) exchanges data between programs through a local network. It is a program that parses and posts data collected by UART, SPI communication, etc., from various sensors mounted on the test bench and sub-components. It processes the posted data to predict the target altitude of the vertical axis translator and determine the position of the virtual INS sensor. These include a program to update and publish, a GUI console program for the test operator to control the flight test system, a demonstration program for the test operator to check the flight test status, and a data collection program for the test operator to collect flight test results.
In addition, programs created and added, according to the test purpose to be performed, were connected to the message bus on the same network, enabling integrated operation in the flight test system. For example, as shown in Fig. 9, it can receive the launch message announcing the start of the flight test from the GUI console and use it as an automatic control take-off signal of the target UAV.
The main function of the GUI console is to monitor the sensor data connected to the flight test system and test bench, control the ground simulator and Z-axis translator, and manage the power supply of connected devices such as drive motors and network connection. In addition, the flight test start signal of the flight test system is transmitted, and additional functions can be assigned according to the configuration of the test operator.

8) WIND TUNNEL
The wind tunnel was deployed to simulate the flight environment of the flight test system. The wind tunnel  The fan control device of the wind tunnel is connected to the ECU and operated as an integrated ROS environment. It can be controlled with a GUI console. It is configured to check and control the operation status directly from the device using a touch-type monitor. The wind tunnel device consists of a nozzle part, a test part, and a diffuser part. The fan mounted on the nozzle can change the wind's direction to blow or suck air into the wind tunnel device. The airflow generated by the device circulates through the open space.
However, the wind tunne's test and diffuser parts have not been completed, so it uses a method in which wind is generated from the nozzle part by blowing air into the wind tunnel. Table 8 gives its design specification.
All th major components of the designed flight test system (which were fabricated and assembled in accordance with the design specifications) are shown in Fig. 11.

C. OPERATING PROCEDURE
The flight test system has test procedures for various specific flight test purposes, but as a general test device, the test procedures shown in Table 9 are as follows.
Step 1 is the procedure for mounting the UAV subject of the flight test to the spherical joint with an appropriate fixing jig. Steps 2 and 3 are the procedure for inputting the power to the flight test system and the independent PSU. Step 4 is the procedure for automatically establishing ROS communication and checks for each sub-device connected to the local network.
Step 5 is the procedure for the flight test operator to check the main function of the test bench directly, step 6 is the maximum output of the wind tunnel device and the procedure to check individual fan operation, step 7 is the check for whether data from various sensors such as 3-axis force sensor and lidar sensor are collected and displayed on the display program, and step 8 is to press the Launch button on the GUI console procedure to give a command to the flight test system so that it can perform flight tests according to the preentered automatic test execution procedure.
Step 9 is the test procedure.
Step 10 is the procedure to save the test result data in an appropriate storage device. Steps 11 and 12 consist of the procedure for shutting down the flight test system and the PSU.

III. EXPERIMENT
Experiments were conducted using a rocket-based foldable UAV to evaluate the flight test system performance. We used easy to deploy yet dependable controller for attitude control to confirm the suitability of the built system as a flight test bed. The flight test system is complex in terms of accurate representation of its dynamics analytically. Because of this, a proportional integral derivative (PID) controller was used with a simplified mathematical model and intuition. The controller's goal is to maintain the rocket's stability at a specific horizontal position and altitude in the presence of external wind disturbance when the rocket starts ascent.  As shown in Fig. 12, the rocket-based foldable UAV performs its mission by supplying high energy to the aircraft for a short time through the rocket propulsion device aft. The upper and lower parts of the UAV are detached after reaching the launch target and are then recovered through self-flight. According to this flight method, the UAV requires attitude control through fin control in the rocket propulsion and recovery phases. The UAV is composed of ROS-based control software, the status information is checked through the display program of the flight test system without a separate development process, and the results necessary for the test are stored with the data collection program [21].
The experiment was conducted in two cases. Aerodynamic force, velocity, and position are measured and estimated by the flight test system using the 3-axis force sensor. The experimental setup is shown in Fig. 13. In the first experiment, the rocket's stability in the presence of 10 m/s wind along the x-axis using the attitude controller was evaluated.
The average tracking errors for the UAV's roll, pitch, and yaw (ϕ, θ, ψ) angles were calculated. These angles represent the attitude of the UAV in the geographic coordinate system,  as shown in Fig. 14b. The roll angle (for simplification) was maintained at zero to rid the UAV of vibration. The value of (ϕ, θ, ψ) at the start of the experiment is (0, 0, 0). The target angles can be expressed as a 2D space consisting of axes of pitch -5 degrees to 5 degrees and yaw -5 degrees to 5 degrees with an interval of 1 degree each. After each target angle input, the experiment was initialized, and the flight test was performed.
The evaluation of the Z-axis translator was done in the second experiment. To confirm the operation of the Zaxis translator, the state of vertical movement was observed assuming a zero-gravity state with the UAV subject to 10m/s wind disturbance, maintaining a stable attitude. This was compared with the height of the Z-axis translator controlled through the flight test system, the value calculated by the IMU, and the value measured by the lidar sensor.
The experiment was carried out under the conditions given in Table 10.

A. PID CONTROLLER
The PID controller Eq. (9) is implemented to control the rocket-based foldable UAV attitude on the flight test system experiment environment. The input commands of the PID are the rocket's roll, pitch, and yaw angles. The control is executed through the four fin control surfaces.
The outputs are the controlled attitude positions (roll φ, pitch θ, yaw ψ) and the respective errors. The mathematical modeling stated in Eq. (9) is the general PID representation, where e is the tracking error term, u is the control input term, x represents the current term of interest, x d represents the desired term, K p , K i , and K d represent the adjustable controller gain for each proportional, integral, and differential term, respectively, K pid represents the sets. The rocket-based UAV uses this to get the necessary angular acceleration. This allows for determining the necessary moment (M), as shown in Eq.  The PID controller parameters were determined by experimental methods based on trial and error. The details of this VOLUME 11, 2023 process will be presented in a future paper. In this paper, we focus on the verification of the flight test system using the PID controller.

B. ERROR CALCULATION
The error between the setpoint and measured signal angles is calculated using the rotation quaternion q defined in Eq. (12), where r denotes the rotation axis as a unit vector, and δ denotes the rotation angle as a scalar. In this case, δ is the total error calculated for the rotation quaternion from three Euler angle errors into rotation quaternion, as shown in Fig. 15. In other cases, attitude error for each axis (e ϕ , e θ , e ψ ) and total error (δ), is also shown in Fig. 16b.

C. RESULTS
The result of the first experiment is shown in Fig. 15. It is a graph showing the tracking error according to the θ and ψ axes. Each graph shows the maximum overshooting error for each maintained control angle (pitch and yaw) and the average deviation during settling. As a result, the attitude controller has a constant maximum error angle in all targets, and there is no difference from the maximum error after settling. This means the attitude controller stably guides the rocket-based UAV to reach the control target. Fig. 16 and Table 11 show the result of the second experiment. The UAV target pitch was set to -10 degrees at t=3 sec and 10 degrees at t=18 sec for the evaluation of the Z-axis translator. At the time, t=33 sec, we end the test and turn off the function of the Z-axis translator. The results showed that the z-axis translator gave a good response.
These results confirmed that the flight test system's sensor data and the target UAV's flight data were displayed through the ROS message bus. In addition, it was confirmed that the control command input from the GUI console during the flight test was transmitted to the target UAV through the flight test system and that the controller operates. Figure 16f shows the height (h) and velocity (h speed ) of the Z-axis translator, indicating that the velocity follows Eq. (7) embedded in the position and force estimator (Fig. 2), which is the result of integrating the acceleration a target calculated by the measured force f uav with m target , the value set for the experiment. The height results from the measured actual movement of the Z-axis translator with the distance sensor. The verification of this function signifies that it is possible to generate virtual velocity and position information, which can be used as a proxy for the INS of the UAV, which is fixed to the test bench and cannot change its actual position.
The position and force estimator can generate a flight path, as shown in Fig. 17. This estimator is driven by a simple Newtonian equation, like the one we used for the z-axis translator, as shown in Eq. (2). When its initial velocity  shows the comparison with the experiment, and UAV hold pitch is zero degrees without maneuvering and under the effect of drag. During this maneuver, the UAV changes trajectory to the target from the initial trajectory. VOLUME 11, 2023 37079 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply. Furthermore, our flight test system can securely hold the UAV. This allows us to simulate the real flight environment without risking the UAV crashing due to functional failures during the flight test. Table 11 shows the actual movement of the Z-axis translator. When UAV pitches down at t = 9 sec, the height of the head is h = 0.48 m decrease to h = 0.37 m at t = 24 sec, as shown in Fig. 16f. Based on this experiment, the function of the flight test system was verified, and the possibility of future application was reviewed.

IV. CONCLUSION AND FUTURE PLANS
Unmanned aerial vehicle development is currently in high demand, necessitating research into safe flight tests; yet, because diverse flight test devices are needed for various mission purposes, it is challenging to create a standardized device.
In this study, we presented a ROS-based multi-DOF flight test system that can be applied to these various mission purposes and confirmed its utility through flight tests. This system integrates various components into the ROS-based system and communicates with the ROS-based UAV and message bus to perform flight tests, which is judged to be helpful for various flight tests.
As a limitation of this study, the development of the test chamber and diffuser of the wind tunnel was not completed. In addition, although the PSU configuration has been completed, it is not currently installed on the test bench.However, the development of the device will be completed in the future. This flight test system can be utilized for studies into several UAV topics, including control, navigation design and development, kinematics and dynamics analysis, flight stability, power management, and autonomous control. Also, in the future, the development of the device will be completed, and flight tests will be conducted through the configured device. We plan to test and verify the Z-axis translator's control algorithm and use it with SIL and HIL to build an integrated flight test system.