Research on Scenario Modeling for V-Tail Fixed-Wing UAV Dynamic Obstacle Avoidance

: With the advantages of long-range ﬂight and high payload capacity, large ﬁxed-wing UAVs are often used in anti-terrorism missions, disaster surveillance, and emergency supply delivery. In the existing research, there is little research on the 3D model design of the V-tail ﬁxed-wing UAV and 3D ﬂight environment modeling. The study focuses on designing a comprehensive simulation environment using Gazebo and ROS, referencing existing large ﬁxed-wing UAVs, to design a V-tail aircraft, incorporating realistic aircraft dynamics, aerodynamics, and ﬂight controls. Additionally, we present a simulation environment modeling approach tailored for obstacle avoidance in no-ﬂy zones, and have created a 3D ﬂight environment in Gazebo, generating a large-scale terrain map based on the original grayscale heightmap. This terrain map is used to simulate potential mountainous terrain threats that a ﬁxed-wing UAV might encounter during mission execution. We have also introduced wind disturbances and other speciﬁc no-ﬂy zones. We integrated the V-tail ﬁxed-wing aircraft model into the 3D ﬂight environment in Gazebo and designed PID controllers to stabilize the aircraft’s ﬂight attitude.


Introduction
A V-tail aircraft is a distinct class of aircraft that features a V-shaped tail configuration.This unconventional design replaces the traditional horizontal stabilizer and vertical fin with two surfaces angled to form a V shape, which serve as both elevator and rudder control surfaces [1].The V-tail design offers advantages such as reduced weight, improved maneuverability, and reduced drag [2].Due to these advantages of the V-shaped tail, this tail design is widely used in large fixed-wing UAVs in various countries, such as the CAIG Wing Loong II, CASC Rainbow CH-4, and General Atomics MQ-9 Reaper [3].
The primary objective of this project is to create a realistic simulation framework using Gazebo and ROS for V-tail aircraft, allowing for the accurate modeling of their flight dynamics, control systems, and response to flight threat scenarios.Through leveraging the capabilities of Gazebo, a powerful physics-based simulator, and ROS, a flexible and widely used robotic framework [4][5][6][7], we can create a comprehensive and interactive simulation environment.
In existing research [8][9][10] on fixed-wing aircraft flight simulation, the majority of studies are based on developing flight dynamics models, control algorithms, and trajectory planning using MATLAB software.Scott et al. [11] developed a fixed-wing aircraft simulation tool that incorporates aerodynamics, structural dynamics, kinematics, and kinetics, but has only numerical simulation calculations and no visual scene interface.Deiler et al. [12] Gazebo and ROS are two powerful tools which are widely used in the field of robotics and simulation.Gazebo is an open-source, multi-robot simulator that provides a highly realistic and dynamic environment for simulating robots, UAVs, and complex systems.It allows for the simulation of physics-based interactions, sensor data, and control algorithms.ROS, on the other hand, is a flexible framework for building robotic systems.It provides a collection of software libraries, tools, and conventions that facilitate communication between different components of a robotic system.ROS enables the development of modular and scalable robotic applications through offering features such as message passing, service calls, and parameter management.
When combined, Gazebo and ROS form a powerful simulation environment that allows for the integration of realistic physics-based simulation with sophisticated robot control and interaction.This combination has become a standard in the robotics community for developing and testing robotic systems.
In the context of V-tail aircraft and flight threat scenario modeling, Gazebo provides a platform for creating a realistic simulation environment that accurately models the physics and dynamics of the aircraft.It enables the simulation of aerodynamic forces, environmental factors, and realistic sensor data.Gazebo's visualization capabilities also allow for the real-time monitoring and visualization of the simulation.Through leveraging the capabilities of Gazebo and ROS, researchers and engineers can create comprehensive and interactive simulations of V-tail aircraft and flight threat scenarios.This allows for the in-depth analysis of the aircraft's behavior, performance evaluation, and the testing of control algorithms.The integration of Gazebo and ROS provides a seamless workflow, enabling users to develop and validate their models and algorithms in a realistic virtual environment before deploying them on real aircraft.

Aircraft Aerodynamics
In the V-tail fixed-wing aircraft simulation environment created in this study, the primary reliance is on the aerodynamics plugin provided by Gazebo's official sources to simulate the aircraft's flight lift.Referring to existing literature [28][29][30], the following aerodynamics mathematical model is established.
Wind speed has a significant impact on UAV motion, which can have an impact on flight performance, flight trajectory, and control requirements.Taking the body coordinate system as a reference, the airspeed vector of the UAV is denoted as v b r , the ground speed vector is denoted as v b , and the wind speed vector is denoted as v b ω .Then, the relationship between wind speed, ground speed, and airspeed can be obtained as follows: The relationship between the size of UAV airspeed V a and the airspeed vector v b r of an UAV under the aircraft system is as follows: where R b w is the rotation matrix from the air flow coordinate system to the body coordinate system, α is the angle of attack, β is the sideslip angle, and V a is the magnitude of the airspeed, which can be calculated using the following equation.
The translational kinematic equation of the UAV is given by .
where p n represents the position of the UAV in the inertial frame, v b represents the ground velocity vector of the UAV in the aircraft system, R n b represents the rotation matrix from the aircraft system to the inertial frame, and v n wind represents the wind speed vector in the inertial frame.The wind speed is assumed to be constant or slowly varying.Newton's second law is applied to the UAV in translational motion, and the force and velocity under the UAV system are expressed as where m is the mass of the UAV, d dt b is the time derivative in the body coordinate system, and f b is the sum of all external forces acting on the UAV under the aircraft system, including gravity, aerodynamic force, and thrust.w b n,b is the angular velocity between the machine system and the inertial frame.where f n g = [0 0 mg] T is the heavy force vector under inertial system, and g is the acceleration degree of heavy force.f b thrust = [T 0 0] T is the thrust vector under the aircraft system.Most aircraft are designed with thrust directly along the aircraft body axis i b .f w aero is the aerodynamic force vector under the flow system, which can be expressed as where ρ is air density, S is the plane airfoil area, C(•) is the coefficient of aerodynamics, and k is a constant scalar value that depends on the aircraft configuration.
The quaternion based rotational kinematics equation of aircraft is as follows: .
where q n,b represents the quaternion of rotation from the body coordinate system to the inertial system.Under the body coordinate system, Euler's momentum equation is applied to a rotating aircraft.
where h b is the vector form of angular momentum under body coordinate system.τ b aero is the aerodynamic torque vector of body coordinate system.For a rigid body, angular momentum is defined as the product of the moment of inertia matrix J and the angular velocity vector: Thus, Equation (10) can be rewritten as: .
Aerodynamic torque is defined as: where u = [δ a δ e δ r ] T is a vector consisting of three control quantities used to control the rotation angles of the aileron, elevator, and rudder.f(α, β) is the aerodynamic torque vector function, which can be expressed as: D is a positive definite matrix denoted by: B is the control matrix and is defined as: where b is the wingspan length and c is the average aerodynamic chord.
Drones 2023, 7, 601 5 of 20 In summary, the following dynamic model can be obtained through combining the translational motion and rotational motion of the fixed-wing aircraft.

V-Tail Fixed-Wing UAV 3D Modeling
SolidWorks is a computer-aided design (CAD) software widely used for creating 3D models, assemblies, and drawings of various mechanical and engineering components, including aircraft.In the Gazebo simulation platform, there is no open-source V-tail aircraft available, and the official offering only includes the Cessna C-172 aircraft model.Therefore, we designed a V-tail aircraft using SolidWorks and configured the aerodynamics of our model through referencing the Cessna C-172 aircraft model files.
The aircraft model we built using SolidWorks is shown in Figure 1.This V-tail aircraft is modeled according to our reference to existing mainstream reconnaissance fixed-wing UAVs, such as the CAIG Wing Loong II and CASC Rainbow CH-4.In this project, we use the SDF file format as the aircraft model description file, because using SDF allows us to use the latest plugin provided by Gazebo.Stephen Brawner et al. developed a SolidWorks plugin for converting assembly models made in SolidWorks to URDF format [31].Next, using the command line method provided by Gazebo [32], we can easily convert the model description file in URDF format to SDF format.Figure 2 shows the flow chart of converting a SolidWorks model to SDF format.We rely on the aerodynamic plugin provided by the Gazebo simulator for the flight simulation of our aircraft model, which does not require the aircraft model to have an accurate aerodynamic shape, so we do not consider aerodynamic appearance when modeling in SolidWorks.At the same time, we omit the moving part modeling of the aircraft flaps, and we incorporate the functions of the flaps into the ailerons of the aircraft model.
In the Gazebo simulator, model description files are used to describe the objects in the simulation, including robots, UAVs, buildings, etc.The model description file contains the geometry of the object, physical properties, sensor information, and controllers, among others.Gazebo uses SDF (Simulation Description Format) as the default model description file format.SDF is an XML format used to describe simulation scenarios, which has rich functions and flexibility.In addition, URDF (Unified Robot Description Format) is a model description file format used in ROS.Gazebo can import URDF files with ROS plugin support and use the model in simulations.
In this project, we use the SDF file format as the aircraft model description file, because using SDF allows us to use the latest plugin provided by Gazebo.Stephen Brawner et al. developed a SolidWorks plugin for converting assembly models made in SolidWorks to URDF format [31].Next, using the command line method provided by Gazebo [32], we can easily convert the model description file in URDF format to SDF format.Figure 2 shows the flow chart of converting a SolidWorks model to SDF format.In this project, we use the SDF file format as the aircraft model description file, because using SDF allows us to use the latest plugin provided by Gazebo.Stephen Brawner et al. developed a SolidWorks plugin for converting assembly models made in SolidWorks to URDF format [31].Next, using the command line method provided by Gazebo [32], we can easily convert the model description file in URDF format to SDF format.Figure 2 shows the flow chart of converting a SolidWorks model to SDF format.In the generated aircraft model file, we introduced an open-source aerodynamics plugin provided by Gazebo's official sources [33].This plugin's mathematical model aligns with the aerodynamics mathematical model proposed in Section 3.1.In the generated aircraft model file, we introduced an open-source aerodynamics plugin provided by Gazebo's official sources [33].This plugin's mathematical model aligns with the aerodynamics mathematical model proposed in Section 3.1.Figure 3 shows the aerodynamic plugin used in the SDF model description file.The plugin has the following parameters to configure: shows the aerodynamic plugin used in the SDF model description file.The plugin has following parameters to configure: "a0" is the negative value of the zero-lift angle of attack."cla" is the slope of lift line."cda" is the slope of drag line."cma" is the slope of aerodynamic moment line."alpha_stall" is the stall angle of attack."cla_stall" is the slope of the lift line after stall."cda_stall" is the slope of the drag line after stall."cma_stall" is the slope of the aerodynamic torque line after stall."link_name" is the link applied by the aerodynamic force."cp" is the coordinate of the pressure center (in link coordinate system)."aera" is the reference area of the aerodynamic surface."air_density" is the air density."forward" is the forward-direction vector (in link coordinate system)."upward" is the up-direction vector (in link coordinates system)."control_joint_name" is the name of the joint that controls the rudder axis."control_joint_rad_to_cl" is the rate of change of the lift coefficient with the cont value.If you intend to control models within Gazebo through an external program, th are typically two methods.The first involves creating a Gazebo plugin and embeddin into the model file you wish to control.However, this method lacks flexibility, and mo fying plugin code can be cumbersome.The second method is for the external program utilize Gazebo's provided external interface, combined with ROS for controlling mod "a0" is the negative value of the zero-lift angle of attack."cla" is the slope of lift line."cda" is the slope of drag line."cma" is the slope of aerodynamic moment line."alpha_stall" is the stall angle of attack."cla_stall" is the slope of the lift line after stall."cda_stall" is the slope of the drag line after stall."cma_stall" is the slope of the aerodynamic torque line after stall."link_name" is the link applied by the aerodynamic force."cp" is the coordinate of the pressure center (in link coordinate system)."aera" is the reference area of the aerodynamic surface."air_density" is the air density."forward" is the forward-direction vector (in link coordinate system)."upward" is the up-direction vector (in link coordinates system)."control_joint_name" is the name of the joint that controls the rudder axis."control_joint_rad_to_cl" is the rate of change of the lift coefficient with the control value.If you intend to control models within Gazebo through an external program, there are typically two methods.The first involves creating a Gazebo plugin and embedding it into the model file you wish to control.However, this method lacks flexibility, and modifying plugin code can be cumbersome.The second method is for the external program to utilize Gazebo's provided external interface, combined with ROS for controlling models in Gazebo and managing real-time simulation data for the models.In this study, we are using the second method.To incorporate ROS into the Gazebo simulation, we need to create a ROS launch file following ROS standards.This ROS launch file includes our V-tail aircraft model file, environment model file, and certain initialization parameters for Gazebo.Running this ROS launch file opens our aircraft simulation.We have chosen Gazebo as our aircraft simulator not only due to its capacity for customizing various simulation scenarios, but also for its support of simulating multiple models within a single scene.This feature provides a foundation for researching cooperative control algorithms for multi-agent systems.Figure 5 showcases our addition of nine V-tail aircraft within a single simulation scene.We have chosen Gazebo as our aircraft simulator not only due to its capacity for customizing various simulation scenarios, but also for its support of simulating multiple models within a single

3D Flight Environment Design
Another focus of this study is the simulation modeling method tailored for obstacle avoidance in no-fly zones, providing a 3D flight scenario for aircraft models.The centerpiece of this scene is a large terrain model containing multiple mountain ranges.Custom no-fly zones are added, and wind disturbances are introduced to challenge the aircraft's safe flight.These environmental models pose a challenge to ensuring the aircraft's safe navigation.

Wind Disturbance
Wind disturbances can have significant effects on the behavior of an aircraft during flight, and it is crucial for pilots and control systems to account for these disturbances to ensure safe and stable operations.In this project, we mainly consider wind disturbances as gusts, steady wind, wind shear, and their combination.
Gusts refer to sudden and brief increases in wind speed that occur over a short period of time.These rapid changes in wind velocity can have significant effects on the flight performance and handling characteristics of aircraft.The mathematical representation of a discrete gust is: where  is the gust amplitude,  is the gust length,  is the distance traveled, and  gusts is the resultant wind velocity in the body axis frame.
Steady wind refers to a constant and uniform wind flow with consistent speed and direction over time.In the context of atmospheric conditions, it means that the wind is blowing at a steady rate and maintaining a constant heading for a significant period.

3D Flight Environment Design
Another focus of this study is the simulation modeling method tailored for obstacle avoidance in no-fly zones, providing a 3D flight scenario for aircraft models.The centerpiece of this scene is a large terrain model containing multiple mountain ranges.Custom no-fly zones are added, and wind disturbances are introduced to challenge the aircraft's safe flight.These environmental models pose a challenge to ensuring the aircraft's safe navigation.

Wind Disturbance
Wind disturbances can have significant effects on the behavior of an aircraft during flight, and it is crucial for pilots and control systems to account for these disturbances to ensure safe and stable operations.In this project, we mainly consider wind disturbances as gusts, steady wind, wind shear, and their combination.
Gusts refer to sudden and brief increases in wind speed that occur over a short period of time.These rapid changes in wind velocity can have significant effects on the flight performance and handling characteristics of aircraft.The mathematical representation of a discrete gust is: where V m is the gust amplitude, d m is the gust length, x is the distance traveled, and V gusts is the resultant wind velocity in the body axis frame.Steady wind refers to a constant and uniform wind flow with consistent speed and direction over time.In the context of atmospheric conditions, it means that the wind is blowing at a steady rate and maintaining a constant heading for a significant period.Wind shear refers to the change in wind speed and/or direction with altitude.It is a meteorological phenomenon that occurs in the Earth's atmosphere and can affect aircraft during takeoff and landing.Strong wind shear can create turbulence and sudden changes in airspeed, making it challenging for pilots to maintain control and stability.The magnitude of the wind shear is given by the following equation for the mean wind profile as a function of altitude and the measured wind speed at 20 feet (6 m) above the ground.
where V shear is the mean wind speed, W 20 is the measured wind speed at an altitude of 20 feet, h is the altitude, and z 0 is a constant equal to 0.15 feet for Category C flight phases and 2.0 feet for all other flight phases.Category C flight phases are defined in reference [34] to be terminal flight phases, which include takeoff, approach, and landing.
In Gazebo, SDF plugins are used to extend the functionality of the simulation environment and add custom behavior to models or the world.SDF plugins are written in C++ and are loaded by Gazebo during the simulation startup.
In the simulation, the effect of wind disturbance on the aircraft can be regarded as a continuous external force acting on the body coordinates, and the wind disturbance model is packaged into an SDF plugin to activate it during simulation.To create a wind disturbance SDF plugin and add it to the aircraft flight environment, we typically follow these steps: Step 1: Write the Plugin Code.Create a C++ source file for the plugin and define the desired forces generated by wind disturbances acting on the body coordinate system.
Step 2: Build the Plugin.
Compile the plugin into a shared library (.so file) using CMake.Ensure that the plugin is linked to Gazebo and its required libraries.
Step 3: Load the Plugin.
In the Gazebo SDF file, include a "<plugin>" element that references the compiled plugin library and specifies any necessary parameters.
Figure 6 shows a wind plugin provided by Gazebo, which needs to have the following parameters to configure: phases and 2.0 feet for all other flight phases.Category C flight phases are defined in r erence [34] to be terminal flight phases, which include takeoff, approach, and landing.
In Gazebo, SDF plugins are used to extend the functionality of the simulation en ronment and add custom behavior to models or the world.SDF plugins are written in C and are loaded by Gazebo during the simulation startup.
In the simulation, the effect of wind disturbance on the aircraft can be regarded a continuous external force acting on the body coordinates, and the wind disturbance mod is packaged into an SDF plugin to activate it during simulation.To create a wind distu ance SDF plugin and add it to the aircraft flight environment, we typically follow the steps: Step 1: Write the Plugin Code.Create a C++ source file for the plugin and define the desired forces generated wind disturbances acting on the body coordinate system.
Step 2: Build the Plugin.
Compile the plugin into a shared library (.so file) using CMake.Ensure that t plugin is linked to Gazebo and its required libraries.
Step 3: Load the Plugin.
In the Gazebo SDF file, include a "<plugin>" element that references the compil plugin library and specifies any necessary parameters.
Figure 6 shows a wind plugin provided by Gazebo, which needs to have the follo ing parameters to configure: "linkName" is the link affected by the wind."xyzOffset" is the spatial offset of the link coordinate system to form the new co dinate system, which is the reference coordinate system for the wind.
"windDirection" is the force direction under the wind coordinate system."windForceMean" is the average value of the wind."windGustDirection" is the direction of the gust."windGustDuration" is the duration of the gust."windGustStart" is the start time of the gust."windGustForceMean" is the average value of the gust."linkName" is the link affected by the wind."xyzOffset" is the spatial offset of the link coordinate system to form the new coordinate system, which is the reference coordinate system for the wind.
"windDirection" is the force direction under the wind coordinate system."windForceMean" is the average value of the wind."windGustDirection" is the direction of the gust."windGustDuration" is the duration of the gust.
Drones 2023, 7, 601 10 of 20 "windGustStart" is the start time of the gust."windGustForceMean" is the average value of the gust.

Terrain Model
Mountainous regions pose a threat to the safe flight of aircraft.When large fixed-wing UAVs are engaged in low-altitude penetration missions, their flight altitude is often relatively low.Aircraft must promptly adjust their flight altitude and course based on terrain obstacles to avoid collisions.In this section, we generate a large-scale terrain model using a heightmap.
In Gazebo, a heightmap is a type of terrain representation used to model the elevation and topography of the ground surface in a simulation environment.Heightmaps are an efficient way to create realistic and detailed terrains, especially for large outdoor scenes.A heightmap is essentially a 2D grid of elevation values, where each cell in the grid represents a point on the terrain, and the value in the cell determines the height or elevation of that point above a reference level, typically the ground level (Z = 0).The elevation values can be measured in meters, feet, or other units, depending on the scale of the simulation.
Figure 7 is a heightmap that we utilize.Essentially, it is grayscale image.In the Gazebo environment model file, this heightmap can be configured to automatically generate the terrain model.In order for Gazebo to successfully load the heightmap and generate the terrain model, the original map needs to be cropped to the pixel size of (2n+1, 2n+1).In this project, the original heightmap was cropped to the pixel size of (1025, 1025).and gusts.

Terrain Model
Mountainous regions pose a threat to the safe flight of aircraft.Whe wing UAVs are engaged in low-altitude penetration missions, their flight a relatively low.Aircraft must promptly adjust their flight altitude and cours rain obstacles to avoid collisions.In this section, we generate a large-scale using a heightmap.
In Gazebo, a heightmap is a type of terrain representation used to mode and topography of the ground surface in a simulation environment.Heig efficient way to create realistic and detailed terrains, especially for large o A heightmap is essentially a 2D grid of elevation values, where each cell i resents a point on the terrain, and the value in the cell determines the heig of that point above a reference level, typically the ground level (Z=0).The el can be measured in meters, feet, or other units, depending on the scale of t Figure 7 is a heightmap that we utilize.Essentially, it is a grayscale Gazebo environment model file, this heightmap can be configured to auto erate the terrain model.In order for Gazebo to successfully load the heigh erate the terrain model, the original map needs to be cropped to the pixe 2n+1).In this project, the original heightmap was cropped to the pixel size

No-Fly Zones
There are some areas where the flying of aircraft, drones, or other aerial vehicles is restricted or prohibited due to safety, security, or regulatory concerns.These zones are often established to prevent potential conflicts with other air traffic, protect sensitive areas, maintain privacy, and ensure public safety.
The restricted airspace designed in this study consists of multiple hemisphere models and cylindrical models.In our simulation scenario, the size and coverage of these no-fly zones are not fixed and remain dynamically deployable.The no-fly zone models are dynamically generated based on the terrain model designed in Section 4.2.Prior to launching the simulation program, we have the flexibility to customize the number, type, coverage area, and world coordinates of the no-fly zones.Therefore, a wide variety of different no-fly zone configurations can be applied on the same terrain model.Furthermore, during the aircraft flight simulation, it is possible to dynamically add additional no-fly zones to the original simulation environment.These zones can also be specified to undergo certain changes, such as translation with a fixed speed, based on predefined rules.
For the aircraft, the information about these no-fly zones is known.It can either be known to the aircraft before takeoff, including all the no-fly zones and threat areas, or it can be received in real-time by external perception devices (such as satellite remote sensing) through a data link.Based on this known information about no-fly zones and threat areas, the aircraft can plan its flight path in advance.When encountering newly acquired information about no-fly zones, the aircraft needs to perform dynamic avoidance maneuvers and replan its flight path accordingly.
The hemispherical no-fly zone model is formulated as follows: where the coordinate of the hemispherical no-fly zone i is (x i , y i , z i ), and R R i max is the maximum detection radius of the ground no-fly detector.The Gazebo terrain model includes multiple hemispheres as no-fly zones, which can be customized in position, radius size, and color, as shown by the five red semi-transparent hemispheres in Figure 10.

No-fly Zones
There are some areas where the flying of aircraft, drones, or other aerial vehicles is restricted or prohibited due to safety, security, or regulatory concerns.These zones are often established to prevent potential conflicts with other air traffic, protect sensitive areas, maintain privacy, and ensure public safety.
The restricted airspace designed in this study consists of multiple hemisphere models and cylindrical models.In our simulation scenario, the size and coverage of these no-fly zones are not fixed and remain dynamically deployable.The no-fly zone models are dynamically generated based on the terrain model designed in Section 4.2.Prior to launching the simulation program, we have the flexibility to customize the number, type, coverage area, and world coordinates of the no-fly zones.Therefore, a wide variety of different nofly zone configurations can be applied on the same terrain model.Furthermore, during the aircraft flight simulation, it is possible to dynamically add additional no-fly zones to the original simulation environment.These zones can also be specified to undergo certain changes, such as translation with a fixed speed, based on predefined rules.
For the aircraft, the information about these no-fly zones is known.It can either be known to the aircraft before takeoff, including all the no-fly zones and threat areas, or it can be received in real-time by external perception devices (such as satellite remote sensing) through a data link.Based on this known information about no-fly zones and threat areas, the aircraft can plan its flight path in advance.When encountering newly acquired information about no-fly zones, the aircraft needs to perform dynamic avoidance maneuvers and replan its flight path accordingly.
The hemispherical no-fly zone model is formulated as follows: where the coordinate of the hemispherical no-fly zone  is ( ,  ,  ), and  is the maximum detection radius of the ground no-fly detector.
The Gazebo terrain model includes multiple hemispheres as no-fly zones, which can be customized in position, radius size, and color, as shown by the five red semi-transparent hemispheres in Figure 10.
Figure 10.Hemisphere models in Gazebo.On the foundation of the terrain model, some custom semi-transparent red hemisphere regions are added as no-fly zones.
The cylindrical no-fly zone model is formulated as follows: where L i (x, y, z) represents the hemispherical no-fly zone i, (x i , y i ) represents the center coordinate of the cylinder i, R M i max represents the horizontal threat radius of the cylinder i, and Z ih represents the vertical threat altitude of the cylinder i.
Multiple cylinders are added to the Gazebo terrain model as no-fly zones; these cylinders are customizable in position, radius size, and color, as shown by the five purple translucent cylinders in Figure 11.
where  (, , ) represents the hemispherical no-fly zone , ( ,  ) represents the center coordinate of the cylinder ,  represents the horizontal threat radius of the cylinder , and  represents the vertical threat altitude of the cylinder .
Multiple cylinders are added to the Gazebo terrain model as no-fly zones; these cylinders are customizable in position, radius size, and color, as shown by the five purple translucent cylinders in Figure 11.

Comprehensive Simulation
In this section, we combine the V-tail aircraft designed in Section 3 with the flight threat scenario proposed in Section 4. The aircraft model performs flight simulation in the Gazebo simulator and collects and uses ROS to manage the data of the aircraft, such as position, attitude angle, angular velocity, and angular acceleration.
Figure 12 illustrates the main modules and primary data flow within the comprehensive simulation.Gazebo serves as the simulation platform for comprehensive control experiments of the V-tail aircraft, deployed within a large-scale 3D flight environment.We have designed two Python programs and use ROS for data management.The first program is utilized to retrieve the aircraft model's state data in Gazebo at each simulation time step.It extracts the aircraft's attitude and velocity data from the raw state data.The second program is responsible for controlling the desired state of the aircraft model.It includes attitude angle controllers and a flight speed controller, both employing PID control algorithms.These controllers output the deflection angles of the ailerons and V-tail, as well as the engine thrust magnitude, which are used to control the aircraft model in Gazebo.

Comprehensive Simulation
In this section, we combine the V-tail aircraft designed in Section 3 with the flight threat scenario proposed in Section 4. The aircraft model performs flight simulation in the Gazebo simulator and collects and uses ROS to manage the data of the aircraft, such as position, attitude angle, angular velocity, and angular acceleration.
Figure 12 illustrates the main modules and primary data flow within the comprehensive simulation.Gazebo serves as the simulation platform for comprehensive control experiments of the V-tail aircraft, deployed within a large-scale 3D flight environment.We have designed two Python programs and use ROS for data management.The first program is utilized to retrieve the aircraft model's state data in Gazebo at each simulation time step.It extracts the aircraft's attitude and velocity data from the raw state data.The second program is responsible for controlling the desired state of the aircraft model.It includes attitude angle controllers and a flight speed controller, both employing PID control algorithms.These controllers output the deflection angles of the ailerons and V-tail, as well as the engine thrust magnitude, which are used to control the aircraft model in Gazebo.
The controller program for the V-tail fixed-wing UAV primarily consists of an attitude angle controller, flight speed controller, and altitude controller, as depicted in Figure 13.The attitude angle controller comprises three distinct control programs: pitch, roll, and yaw.The roll controller controls the aircraft's roll angle through adjusting the aileron control surface.Both the pitch and yaw controllers use the deflection angles of the V-tail's two control surfaces as outputs.Consequently, there is coupling between pitch and yaw control in V-tail aircraft.We use the pitch controller's output control surface angle as a baseline, and the control surface angle output from the yaw controller is added to this baseline.This approach allows us to achieve yaw control while maintaining the desired pitch angle.
The flight speed controller adjusts the engine thrust to maintain the desired flight speed.The altitude hold controller is a two-loop controller, where the outer loop takes the desired altitude as input and outputs the pitch angle magnitude.The inner loop is the pitch angle controller.In this study, these controllers all use PID control algorithms.
In order to control the aircraft model in Gazebo from an external program, we established a link between ROS and Gazebo, as shown in Figure 14, where the oval box represents the ROS node and the connecting line represents the ROS topic, "/gazebo_gui" is the visual simulation interface of Gazebo, and "/gazebo" contains a variety of Gazebo simulation data, which is used to obtain and set the state of the model."/object_position_publisher" retrieves multiple state data of the model from "/gazebo/model_states", extracts the position and pose of the model, and publishes them through the topic "/plane_pose"."/aircraft_command" publishes the angle and throttle controls of the aircraft, using three PID controllers to control the angles, corresponding to the pitch, roll, and yaw control of the aircraft.The desired angles are input by the keyboard key, and the controllers output the control values of the aircraft rudder surfaces.The controller program for the V-tail fixed-wing UAV primarily consists of an attitude angle controller, flight speed controller, and altitude controller, as depicted in Figure 13.The attitude angle controller comprises three distinct control programs: pitch, roll, and yaw.The roll controller controls the aircraft's roll angle through adjusting the aileron control surface.Both the pitch and yaw controllers use the deflection angles of the V-tail's two control surfaces as outputs.Consequently, there is coupling between pitch and yaw control in V-tail aircraft.We use the pitch controller's output control surface angle as a baseline, and the control surface angle output from the yaw controller is added to this baseline.This approach allows us to achieve yaw control while maintaining the desired pitch angle.
The flight speed controller adjusts the engine thrust to maintain the desired flight speed.The altitude hold controller is a two-loop controller, where the outer loop takes the desired altitude as input and outputs the pitch angle magnitude.The inner loop is the pitch angle controller.In this study, these controllers all use PID control algorithms.In order to control the aircraft model in Gazebo from an external program, we established a link between ROS and Gazebo, as shown in Figure 14, where the oval box represents the ROS node and the connecting line represents the ROS topic, "/gazebo_gui" is the  The controller program for the V-tail fixed-wing UAV primarily consists of an attitude angle controller, flight speed controller, and altitude controller, as depicted in Figure 13.The attitude angle controller comprises three distinct control programs: pitch, roll, and yaw.The roll controller controls the aircraft's roll angle through adjusting the aileron control surface.Both the pitch and yaw controllers use the deflection angles of the V-tail's two control surfaces as outputs.Consequently, there is coupling between pitch and yaw control in V-tail aircraft.We use the pitch controller's output control surface angle as a baseline, and the control surface angle output from the yaw controller is added to this baseline.This approach allows us to achieve yaw control while maintaining the desired pitch angle.
The flight speed controller adjusts the engine thrust to maintain the desired flight speed.The altitude hold controller is a two-loop controller, where the outer loop takes the desired altitude as input and outputs the pitch angle magnitude.The inner loop is the pitch angle controller.In this study, these controllers all use PID control algorithms.In order to control the aircraft model in Gazebo from an external program, we established a link between ROS and Gazebo, as shown in Figure 14, where the oval box represents the ROS node and the connecting line represents the ROS topic, "/gazebo_gui" is the              We tested the pitch angle controller of the aircraft.In the takeoff phase, the pitch angle was set to −0.3 radians, and the throttle was increased at the same time.The aircraft experienced overshoot and fluctuation in the pitch angle during the climbing phase, and finally stabilized at −0.3 radians as shown in Figure 18. Figure 19 shows the simulation screenshot of the aircraft in the climbing phase, and the PID controller of pitch angle outputs the maximum angular control (0.52 radians) to the tail.A PD controller is employed for the aircraft's roll angle control, with PD controller parameters set as follows: Kp = −5 and Kd = −0.05. Figure 21 displays the roll angle curve of the aircraft, demonstrating that the use of the PD controller effectively stabilizes the aircraft's roll angle.It's important to note that the roll angle control involves a system with significant delays.This is why we opted not to introduce integral control, as it could potentially affect the stability of the control system.Figure 22 depicts a 3D simulation snapshot of the aircraft's roll angle stabilizing at 0.42 radians.A PD controller is employed for the aircraft's roll angle control, with PD controller parameters set as follows: Kp = −5 and Kd = −0.05. Figure 21 displays the roll angle curve of the aircraft, demonstrating that the use of the PD controller effectively stabilizes the aircraft's roll angle.It's important to note that the roll angle control involves a system with significant delays.This is why we opted not to introduce integral control, as it could potentially affect the stability of the control system.Figure 22

Conclusions
Nowadays, large fixed-wing UAVs are being utilized for a variety of tasks.Relevant research indicates that V-tail configurations can effectively reduce aerodynamic drag and enhance flight endurance.However, achieving efficient customized development and various intelligent functionalities in a specific domain remains an unresolved challenge.This

Conclusions
Nowadays, large fixed-wing UAVs are being utilized for a variety of tasks.Relevant research indicates that V-tail configurations can effectively reduce aerodynamic drag and enhance flight endurance.However, achieving efficient customized development and various intelligent functionalities in a specific domain remains an unresolved challenge.This  in Gazebo that encompasses kinematics, dynamics, and collision characteristics.Additionally, a simulation environment modeling approach for obstacle avoidance in no-fly zones is presented, creating a large-scale flight environment model that includes mountains, wind disturbances, and no-fly zones.Data communication and motion control are achieved through ROS, and the aircraft's attitude control is implemented using a PID algorithm.The primary contribution of this research lies in providing a 3D visualization simulation platform for dynamic obstacle avoidance, trajectory planning, and formation flying applications in the context of large-scale fixed-wing unmanned aircraft.

Conclusions
Currently, this research is at the initial stage, and there is still a lot of work to be done.The following outlines the future directions of the study: (1) Develop trajectory planning and tracking algorithms for the research aircraft to achieve obstacle avoidance flight with minimal cost.(2) Investigate multi-aircraft formation flying algorithms, aiming to maintain formation while avoiding threat areas as effectively as possible. Author

22 Figure 1 .
Figure 1.A 3D model of a V-tail fixed-wing UAV created using SolidWorks.The aircraft model has 8 moving parts, which are ① right aileron, ② left aileron, ③ right tail, ④ left tail, ⑤ propeller, ⑥ front wheel, ⑦ right wheel, and ⑧ left wheel.

Figure 1 .
Figure 1.A 3D model of a V-tail fixed-wing UAV created using SolidWorks.The aircraft model has 8 moving parts, which are 1 right aileron, 2 left aileron, 3 right tail, 4 left tail, 5 propeller,

Figure 1 .
Figure 1.A 3D model of a V-tail fixed-wing UAV created using SolidWorks.The aircraft model has 8 moving parts, which are ① right aileron, ② left aileron, ③ right tail, ④ left tail, ⑤ propeller, ⑥ front wheel, ⑦ right wheel, and ⑧ left wheel.

Figure 2 .
Figure 2. Flowchart of converting a SolidWorks model to SDF format.In SolidWorks, individual 3D models of different components of the aircraft are created separately.These components are then assembled to form a complete aircraft.A model format conversion plugin is used to convert this model into URDF format.Finally, the model is converted to the SDF format recommended by Gazebo using the format conversion command in the terminal.

Figure 2 .
Figure 2. Flowchart of converting a SolidWorks model to SDF format.In SolidWorks, individual 3D models of different components of the aircraft are created separately.These components are then assembled to form a complete aircraft.A model format conversion plugin is used to convert this model into URDF format.Finally, the model is converted to the SDF format recommended by Gazebo using the format conversion command in the terminal.

Figure 3 .
Figure 3. Add aerodynamic plugin to the SDF aircraft model description file.Using the official aerodynamics plugin provided by Gazebo, the figure displays the aerodynamic parameters of t left wing.In the aircraft model description file used in this study, the same plugin is also employed for the right wing and tails.

Figure 3 .
Figure 3. Add aerodynamic plugin to the SDF aircraft model description file.Using the official aerodynamics plugin provided by Gazebo, the figure displays the aerodynamic parameters of the left wing.In the aircraft model description file used in this study, the same plugin is also employed for the right wing and tails.

Figure 4
depicts the initialization interface of the successfully opened simulation, where the aircraft model can be observed positioned on the runway.Drones 2023, 7, x FOR PEER REVIEW 8 of 22 initialization interface of the successfully opened simulation, where the aircraft model can be observed positioned on the runway.

Figure 4 .
Figure 4. V-tail aircraft in Gazebo.After successfully launching the simulation program, the aircraft model will appear on the runway scene in Gazebo.

Figure 4 .
Figure 4. V-tail aircraft in Gazebo.After successfully launching the simulation program, the aircraft model will appear on the runway scene in Gazebo.

22 Figure 5 .
Figure 5. Multiple V-tail aircraft in Gazebo.Gazebo supports the simultaneous simulation of multiple aircraft models, which facilitates the research of multi-UAV formation flight algorithms.

Figure 5 .
Figure 5. Multiple V-tail aircraft in Gazebo.Gazebo supports the simultaneous simulation of multiple aircraft models, which facilitates the research of multi-UAV formation flight algorithms.

Figure 6 .
Figure 6.Add wind plugin to the SDF aircraft model description file.Using the officially provided wind disturbance plugin, you can set the wind direction and magnitude for both constant wind and gusts.

Figure 7 .
Figure 7. Original heightmap.Different grayscale values represent different altitudes, where higher grayscale values (whiter pixels) indicate higher elevations.At the same time, in order to make the generated terrain model more realistic, maps are used on the surface of the terrain.In the terrain model shown in Figure8, three maps of water, grass, and sand are used, and different maps are used in different height threshold ranges.Figure9is a partial enlargement of the terrain model in Gazebo.The mountains in the figure are automatically generated terrain, and the height of the mountains can be scaled in the model profile.

Figure 9
is a partial enlargement of the terrain model in Gazebo.The mountains in the figure are automatically generated terrain, and the height of the mountains can be scaled in the model profile.

Figure 8 .
Figure 8. Terrain model in Gazebo.Different textures are applied to different altitudes: blue texture represents ocean areas, green texture represents grassland regions, and brown texture represents mountainous areas.

Figure 9 .
Figure 9. Terrain model in Gazebo (local zoom).The image displays details from Figure 8, where the red dashed box highlights mountains at different altitudes.These mountains pose a threat to low-altitude aircraft flight.

Figure 8 . 22 Figure 8 .
Figure 8. Terrain model in Gazebo.Different textures are applied to different altitudes: blue texture represents ocean areas, green texture represents grassland regions, and brown texture represents mountainous areas.

Figure 9 .
Figure 9. Terrain model in Gazebo (local zoom).The image displays details from Figure 8, where the red dashed box highlights mountains at different altitudes.These mountains pose a threat to low-altitude aircraft flight.

Figure 9 .
Figure 9. Terrain model in Gazebo (local zoom).The image displays details from Figure 8, where the red dashed box highlights mountains at different altitudes.These mountains pose a threat to low-altitude aircraft flight.

Figure 11 .
Figure 11.Cylinder models in Gazebo.On the foundation of the terrain model, some custom semitransparent purple cylindrical regions are added as no-fly zones.

Figure 11 .
Figure 11.Cylinder models in Gazebo.On the foundation of the terrain model, some custom semi-transparent purple cylindrical regions are added as no-fly zones.

Figure 13 .
Figure 13.The block diagram for the V-tail aircraft controller design.

Figure 12 .
Figure 12.The comprehensive simulation system flowchart.

Figure 12 .
Figure 12.The comprehensive simulation system flowchart.

Figure 13 .
Figure 13.The block diagram for the V-tail aircraft controller design.

Figure 13 .
Figure 13.The block diagram for the V-tail aircraft controller design.

Figure 14 .
Figure 14.ROS node graph.Using the official ROS tool, "rqt_graph" generates a ROS node graph, where ellipses represent individual nodes and arrows indicate the direction of data transmission.

Figure 15
Figure 15 depicts the comprehensive simulated flight environment, primarily composed of two terrain models.One is the runway model, utilized for taxiing and takeoff, while the other is the mountainous terrain model, simulating potential mountain obstacles that the aircraft may encounter during flight missions.We have designed an aircraft flight state controller program that enables control over the aircraft's flight attitude angles and throttle through keyboard commands, as shown in Figure 16.The program continuously prints expected and actual flight states in real time.Using this control program, we have accomplished fundamental aircraft maneuvers such as climbing and rolling.

Figure 14 .
Figure 14.ROS node graph.Using the official ROS tool, "rqt_graph" generates a ROS node graph, where ellipses represent individual nodes and arrows indicate the direction of data transmission.

Figure 15
Figure 15 depicts the comprehensive simulated flight environment, primarily composed of two terrain models.One is the runway model, utilized for taxiing and takeoff, while the other is the mountainous terrain model, simulating potential mountain obstacles that the aircraft may encounter during flight missions.We have designed an aircraft flight state controller program that

Figure 14 .
Figure 14.ROS node graph.Using the official ROS tool, "rqt_graph" generates a ROS node graph, where ellipses represent individual nodes and arrows indicate the direction of data transmission.

Figure 15
Figure 15 depicts the comprehensive simulated flight environment, primarily composed of two terrain models.One is the runway model, utilized for taxiing and takeoff, while the other is the mountainous terrain model, simulating potential mountain obstacles that the aircraft may encounter during flight missions.We have designed an aircraft flight state controller program that enables control over the aircraft's flight attitude angles and throttle through keyboard commands, as shown in Figure 16.The program continuously prints expected and actual flight states in real time.Using this control program, we have accomplished fundamental aircraft maneuvers such as climbing and rolling.

Figure 15 . 22 Figure 15 .
Figure 15.Comprehensive simulation flight scenario.The flight environment consists of two parts: one is the runway scene used for taxiing and takeoff of the aircraft, and the other is the terrain model used to simulate obstacles encountered by the aircraft during flight.

Figure 16 .
Figure 16.Keyboard control.The figure displays an aircraft control program we designed, which allows controlling the aircraft's attitude and throttle through keyboard inputs.It also prints the desired and actual values in real time.

Figure 17
Figure 17 illustrates the simulated aircraft's attitude angle data over a period of time.The deep blue line represents the roll angle data, the red line represents the pitch angle data, and the light blue line represents the yaw angle data.During the flight simulation, in conjunction with the flight controller program, the desired aircraft attitude angles are

Figure 16 .
Figure 16.Keyboard control.The figure displays an aircraft control program we designed, which allows controlling the aircraft's attitude and throttle through keyboard inputs.It also prints the desired and actual values in real time.

Figure 17 22 Figure 17 .
Figure 17 illustrates the simulated aircraft's attitude angle data over a period of time.The deep blue line represents the roll angle data, the red line represents the pitch angle data, and the light blue line represents the yaw angle data.During the flight simulation, in conjunction with the flight controller program, the desired aircraft attitude angles are set through keyboard inputs.The attitude angle controller employs a PID control algorithm to manipulate the ailerons and V-tail to achieve the desired angles.Drones 2023, 7, x FOR PEER REVIEW 18 of 22

Figure 18 .
Figure 18.Pitch angle data of the aircraft.Pitch angle data during the aircraft's takeoff phase is recorded.At the moment of takeoff, the desired pitch angle is set to −0.3 radians.After a period of angular fluctuations, the pitch angle eventually stabilizes at −0.3 radians.

Figure 17 .
Figure 17.Attitude angle data of the aircraft.During flight testing, a segment of attitude angle data is recorded.Through configuring different desired attitude angles, the attitude angle controller steers the aircraft to reach the desired angles.

Figure 20 22 Figure 17 .
Figure 17.Attitude angle data of the aircraft.During flight testing, a segment of attitude angle data is recorded.Through configuring different desired attitude angles, the attitude angle controller steers the aircraft to reach the desired angles.

Figure 18 .
Figure 18.Pitch angle data of the aircraft.Pitch angle data during the aircraft's takeoff phase is recorded.At the moment of takeoff, the desired pitch angle is set to −0.3 radians.After a period of angular fluctuations, the pitch angle eventually stabilizes at −0.3 radians.

Figure 18 .
Figure 18.Pitch angle data of the aircraft.Pitch angle data during the aircraft's takeoff phase is recorded.At the moment of takeoff, the desired pitch angle is set to −0.3 radians.After a period of angular fluctuations, the pitch angle eventually stabilizes at −0.3 radians.

Figure 19 .
Figure 19.Aircraft is in the climbing phase.The aircraft's V-tail control surface is set to rotate within the range of −0.52 radians to 0.52 radians.At takeoff, the pitch angle is set to −0.3 radians, at which point the V-tail control surface is at its maximum deflection.

Figure 20 .
Figure 20.The pitch angle of the aircraft is stable at −0.3 radians.When the aircraft's pitch angle stabilizes at −0.3 radians, due to excessive lift, the V-tail control surface needs to rotate downward by a certain angle to maintain pitch stability.

Figure 19 . 22 Figure 19 .
Figure 19.Aircraft is in the climbing phase.The aircraft's V-tail control surface is set to rotate within the range of −0.52 radians to 0.52 radians.At takeoff, the pitch angle is set to −0.3 radians, at which point the V-tail control surface is at its maximum deflection.

Figure 20 .
Figure 20.The pitch angle of the aircraft is stable at −0.3 radians.When the aircraft's pitch angle stabilizes at −0.3 radians, due to excessive lift, the V-tail control surface needs to rotate downward by a certain angle to maintain pitch stability.
depicts a 3D simulation snapshot of the aircraft's roll angle stabilizing at 0.42 radians.

Figure 20 .
Figure 20.The pitch angle of the aircraft is stable at −0.3 radians.When the aircraft's pitch angle stabilizes at −0.3 radians, due to excessive lift, the V-tail control surface needs to rotate downward by a certain angle to maintain pitch stability.A PD controller is employed for the aircraft's roll angle control, with PD controller parameters set as follows: Kp = −5 and Kd = −0.05.Figure21displays the roll angle curve of the aircraft, demonstrating that the use of the PD controller effectively stabilizes the aircraft's roll angle.It's important to note that the roll angle control involves a system with significant delays.This is why we opted not to introduce integral control, as it could potentially affect the stability of the control system.Figure22depicts a 3D simulation snapshot of the aircraft's roll angle stabilizing at 0.42 radians.

Figure 21
displays the roll angle curve of the aircraft, demonstrating that the use of the PD controller effectively stabilizes the aircraft's roll angle.It's important to note that the roll angle control involves a system with significant delays.This is why we opted not to introduce integral control, as it could potentially affect the stability of the control system.
Figure 22 depicts a 3D simulation snapshot of the aircraft's roll angle stabilizing at 0.42 radians.

Figure 21 .
Figure 21.Roll angle data of the aircraft.During the stable flight phase, multiple desired roll angles for the aircraft are set to evaluate the performance of the roll angle controller.

Figure 22 .
Figure 22.The roll angle of the aircraft is stable at 0.42 radians.A screenshot of the aircraft maintaining a roll angle of 0.42 radians is taken.At this moment, the aileron control surface is essentially not deflected.Due to excessive lift generated by the high aircraft speed, the V-tail control surface rotates downward by a certain angle to maintain pitch stability.

Figure 21 . 22 Figure 21 .
Figure 21.Roll angle data of the aircraft.During the stable flight phase, multiple desired roll angles for the aircraft are set to evaluate the performance of the roll angle controller.

Figure 22 .
Figure 22.The roll angle of the aircraft is stable at 0.42 radians.A screenshot of the aircraft maintaining a roll angle of 0.42 radians is taken.At this moment, the aileron control surface is essentially not deflected.Due to excessive lift generated by the high aircraft speed, the V-tail control surface rotates downward by a certain angle to maintain pitch stability.

Figure 22 .
Figure 22.The roll angle of the aircraft is stable at 0.42 radians.A screenshot of the aircraft maintaining a roll angle of 0.42 radians is taken.At this moment, the aileron control surface is essentially not deflected.Due to excessive lift generated by the high aircraft speed, the V-tail control surface rotates downward by a certain angle to maintain pitch stability.
Nowadays, large fixed-wing UAVs are being utilized for a variety of tasks.Relevant research indicates that V-tail configurations can effectively reduce aerodynamic drag and enhance flight endurance.However, achieving efficient customized development and various intelligent functionalities in a specific domain remains an unresolved challenge.This study integrates SolidWorks model design with aircraft simulation technology, establishing a comprehensive aircraft simulation system Drones 2023, 7, 601 19 of 20 Contributions: Conceptualization, P.H. and T.W.; methodology, Y.T. and P.H.; software, P.H.; validation, B.Y. and P.H.; formal analysis, P.H.; investigation, P.H. and T.W.; resources, T.W. and Y.T.; writing-original draft preparation, P.H.; writing-review and editing, P.H. and T.W.; visualization, P.H. and B.Y.; supervision, T.W.; project administration, T.W.; funding acquisition, T.W.All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.