UAV Simulator
|
This repository contains a custom-built UAV simulation framework that models the dynamics and control of a small fixed‑wing aircraft.
It integrates:
The project serves as a foundation for experimenting with guidance, navigation, and control (GNC) algorithms, while providing an educational platform for testing new ideas in flight dynamics.
📖 Project Documentation (Doxygen):
https://msk2000.github.io/UAV-Simulator
Demo footage illustrating path and waypoint generation, real-time state plotting, slider based aircraft control:
https://github.com/user-attachments/assets/8f9a8d6c-32c5-4173-bad0-4a8b659f6ae0
A texture mapped terrain and control demo footage:
https://github.com/user-attachments/assets/9578d49b-d618-4981-91b6-300246770b43
A stall demo footage (old):
https://github.com/user-attachments/assets/97ee1782-feb5-4569-809a-e0d4cac45b3d
Active Development:
The simulator has been rebuilt after an earlier data loss, and a working baseline is already running.
At present you can:
Soon you should be able to provide a path to the UAV and watch it generate waypoints and use an autopilot to navigate itself to the destination autonomously :D
REPEAT
to allow seamless tiling across the terrain surface.pos[0]
, pos[1]
) instead of X and Z, since Z is the up-axis in this simulator.Shadow
class. Pending Implementation.TextRenderer
. The HUD overlays real-time flight data from the aircraft onto the screen during simulation.TestViewer
class derived from Easy3D’s Viewer
. This class handles aircraft HUD rendering, user input for aircraft control, and shadow rendering(incomplete).This project relies on the following libraries:
To build and run UAV-Simulator, you need a system with the required dependencies installed and CMake available.
Make sure these libraries and tools are installed on your system (install paths may vary):
Easy3D_DIR
accordingly in CMakeLists.txt
)3rd_party
)From the root of the project:
From inside the build/
directory:
The following table details the key parameters used in the simulation. These parameters represent the physical properties, control inputs, and initial conditions of the aircraft. This table will help you understand both the class members and the data.txt file that the simulator uses to load a given UAV configuration.
# | Parameter | Description |
---|---|---|
1 | mass | Aircraft mass in kilograms. |
2 | Jx | Moment of inertia about the x-axis (roll) in kg·m². |
3 | Jy | Moment of inertia about the y-axis (pitch) in kg·m². |
4 | Jz | Moment of inertia about the z-axis (yaw) in kg·m². |
5 | Jxz | Product of inertia for coupling between the x and z axes. |
6 | S_wing | Wing surface area in square meters. |
7 | b | Wingspan in meters. |
8 | c | Mean aerodynamic chord length in meters. |
9 | e | Oswald efficiency factor. |
10 | g | Gravitational acceleration constant (9.81 m/s²). |
11 | rho | Air density in kg/m³. |
12 | k_motor | Motor constant representing the relationship between motor speed and thrust. |
13 | S_prop | Propeller surface area in square meters. |
14 | k_T_P | Motor torque constant (to be defined based on propeller efficiency). |
15 | k_Omega | Propeller rotational speed constant (to be defined based on efficiency). |
16 | C_L_0 | Zero-lift coefficient of lift. |
17 | C_L_alpha | Lift curve slope, relating angle of attack to lift. |
18 | C_L_q | Lift coefficient due to pitch rate. |
19 | C_L_delta_e | Lift coefficient due to elevator deflection. |
20 | C_D_0 | Zero-lift drag coefficient (parasitic drag). |
21 | C_D_alpha | Drag coefficient as a function of angle of attack. |
22 | C_D_p | Drag coefficient due to roll rate. |
23 | C_D_q | Drag coefficient due to pitch rate. |
24 | C_D_delta_e | Drag coefficient due to elevator deflection. |
25 | C_m_0 | Zero-lift moment coefficient. |
26 | C_m_alpha | Moment coefficient due to angle of attack. |
27 | C_m_q | Moment coefficient due to pitch rate. |
28 | C_m_delta_e | Moment coefficient due to elevator deflection. |
29 | C_Y_0 | Zero-sideslip yaw force coefficient. |
30 | C_Y_beta | Yaw force coefficient due to sideslip angle (lateral stability). |
31 | C_Y_p | Yaw force coefficient due to roll rate. |
32 | C_Y_r | Yaw force coefficient due to yaw rate. |
33 | C_Y_delta_a | Yaw force coefficient due to aileron deflection. |
34 | C_Y_delta_r | Yaw force coefficient due to rudder deflection. |
35 | C_ell_0 | Roll moment coefficient at zero sidesli |
36 | C_ell_beta | Roll moment coefficient due to sideslip angle. |
37 | C_ell_p | Roll moment coefficient due to roll rate. |
38 | C_ell_r | Roll moment coefficient due to yaw rate. |
39 | C_ell_delta_a | Roll moment coefficient due to aileron deflection. |
40 | C_ell_delta_r | Roll moment coefficient due to rudder deflection. |
41 | C_n_0 | Zero-yaw moment coefficient. |
42 | C_n_beta | Yaw moment coefficient due to sideslip angle (lateral stability). |
43 | C_n_p | Yaw moment coefficient due to roll rate. |
44 | C_n_r | Yaw moment coefficient due to yaw rate. |
45 | C_n_delta_a | Yaw moment coefficient due to aileron deflection. |
46 | C_n_delta_r | Yaw moment coefficient due to rudder deflection. |
47 | C_prop | Propeller thrust coefficient. |
48 | M | Transition Rate used for Stall Characteristic modelling |
49 | epsilon | Downwash gradient coefficient. |
50 | alpha0 | Zero-lift angle of attack. |
51 | pn0 | Initial position in the North direction (in meters). |
52 | pe0 | Initial position in the East direction (in meters). |
53 | pd0 | Initial position in the Down direction (negative altitude, in meters). |
54 | u0 | Initial velocity along the body x-axis (forward velocity). |
55 | v0 | Initial velocity along the body y-axis (side-slip velocity). |
56 | w0 | Initial velocity along the body z-axis (vertical velocity). |
57 | phi0 | Initial roll angle (in radians). |
58 | theta0 | Initial pitch angle (in radians). |
59 | psi0 | Initial yaw angle (in radians). |
60 | p0 | Initial roll rate (body frame). |
61 | q0 | Initial pitch rate (body frame). |
62 | r0 | Initial yaw rate (body frame). |
63 | delta_t | Throttle input (ranging from 0 to 1). |
64 | delta_a | Aileron deflection (control surface input for roll control). |
65 | delta_e | Elevator deflection (control surface input for pitch control). |
66 | delta_r | Rudder deflection (control surface input for yaw control). |
67 | delta_t_max | Maximum throttle setting. |
68 | delta_t_min | Minimum throttle setting. |
69 | delta_a_max | Maximum aileron deflection. |
70 | delta_a_min | Minimum aileron deflection. |
71 | delta_e_max | Maximum elevator deflection. |
72 | delta_e_min | Minimum elevator deflection. |
73 | delta_r_max | Maximum rudder deflection. |
74 | delta_r_min | Minimum rudder deflection. |
Each of these parameters is used to model the dynamics of the aircraft in simulation, ensuring that the response to control inputs and environmental factors is accurate. For more details, refer to the implementation in aircraft.h
. Additional details about how to obtain these parameters for a given UAV will be provided in the future.
Contributions to the project are welcome. If you'd like to help improve the project, please fork the repository and submit a pull request with your changes.