Project carried out in Godot in an educational setting, in a pair with Elisa MARCHAND.
This project aims to design a drone simulator that allows students to learn real-time programming in an interactive environment. The simulator replaces an older car simulator used in teaching and offers a richer system, integrating realistic physical simulation as well as communication with an external programme.
The simulator is developed using the Godot game engine, while drone control is handled via an external Python programme. The application relies on a client–server architecture enabling real-time data exchange between the simulation and the control programme. The user can thus pilot a virtual drone, retrieve its state information and implement their own control algorithms.
The project had to meet several main objectives. First, a simulator capable of representing a drone evolving in a 3D environment had to be created. This drone needed to exhibit realistic physical behaviour, in particular through the simulation of forces applied to its motors.
Next, the application had to allow communication with an external programme so that students could write their own control algorithms. This communication had to be non-blocking in order to guarantee sufficient responsiveness for a real-time application.
Finally, the whole system had to allow the execution of educational scenarios in which the drone must move to various positions while avoiding obstacles.
The application is organised into three main components:
the graphical simulator developed with Godot;
a server embedded in the Godot application;
a Python client responsible for piloting the drone.
The simulator represents the 3D environment in which the drone operates. The embedded server receives commands sent by the Python programme and updates the drone’s state in the simulation. The Python client implements the control algorithms and sends commands to the simulator.
Communication between the client and server uses the UDP protocol. This protocol was chosen for its lightness and speed, which is particularly suited to real-time systems. The exchanged messages use the JSON format to facilitate their structuring and interpretation.
Each message contains in particular a client identifier, a message identifier and a character indicating the type of action requested (drone initialisation, speed modification or status request).
The simulated drone is a quadrotor composed of four motors and a central body. In Godot, this drone is modelled as a scene containing several physical objects.
Each motor is represented by a RigidBody3D in order to
benefit from Godot’s physics engine. These motors also have a visual
model (MeshInstance3D) and a collision shape
(CollisionShape3D). Mechanical joints connect the motors to
the drone’s main body to form a coherent structure.
The drone is also equipped with a simulated sensor using a
Raycast. This sensor detects the presence of obstacles on
the drone’s trajectory and transmits this information to the control
programme.
This modular architecture facilitates manipulation of the different drone elements and makes it easy to add new behaviours or sensors.
One of the main challenges of the project was setting up a physical model capable of correctly simulating the drone’s behaviour. Unlike a simplified approach where forces would be applied directly to the drone body, each motor here generates an independent thrust force.
Drone control relies on a regulation system based on PID controllers (Proportional–Integral–Derivative). These controllers dynamically adjust the force applied by each motor to reach a target speed.
The regulation system is organised as a double PID:
a first PID computes the tilt required by the drone to reach the desired speed;
a second PID adjusts the motor forces to achieve this tilt.
At each simulation step, the programme reads the current state of the drone, including its speed and orientation. The error between the current speed and the target speed is then calculated, providing the proportional, integral and derivative components of the correction.
These values are used to determine the forces to apply to each motor. The combination of forces allows the drone to tilt in the desired direction or change its altitude.
This method produces stable and realistic behaviour while remaining flexible enough for use in different scenarios.
The simulator’s user interface is intentionally simple. It mainly consists of several sliders for adjusting the PID controller coefficients.
These parameters can be modified in real time to observe their influence on the drone’s behaviour. The coefficient values are transmitted to the control scripts via Godot’s signal system.
This approach facilitates experimentation and helps students understand the impact of regulation parameters on system stability.