Large Model-Driven UAV Drone Simulation Python Teaching Platform

In the era of artificial intelligence, programming skills have become increasingly vital in university education. Different disciplines have varying demands for programming expertise. For instance, computer science focuses on system architecture, software engineering emphasizes large-scale program development, business and management relies on data processing and analysis, humanities prioritize text analysis, and media arts center on graphical rendering. During the early years of university, students take general education courses to build a foundation for their future specialized studies. Therefore, introductory programming courses should cultivate general computational thinking rather than merely conveying computer knowledge.

Computational thinking refers to a series of mental activities in which individuals apply ideas from computer science to formulate problem-solving solutions. Its essence lies in abstraction and automation. Abstraction involves factor analysis to select and eliminate unnecessary parts, simplifying and formalizing complex problems for better comprehension and resolution. Automation enables systems to execute tasks automatically according to predefined steps or rules without human intervention, thereby solving problems.

Compared to C, Python shields low-level computer details and focuses on functionality implementation. With less code and easier debugging, Python is more suitable for introductory programming courses. However, traditional Python teaching methods suffer from several issues, such as outdated pedagogy, lack of engagement, insufficient teaching materials and exercise banks, and neglect of computational thinking development. These limitations hinder students’ problem-solving ability and reduce their learning interest. To address these challenges, educators have started exploring online judging platforms and problem-driven teaching models, integrating specific application scenarios to enhance interactivity, fun, and effectiveness in Python education.

Teaching Approach: Large Model-Driven UAV Drone Simulation Python Platform

Our large model-driven UAV drone simulation Python teaching platform aims to build a code judging system that facilitates collective intelligence in Python education. It guides students to improve computational thinking by solving problems. The platform allows multiple instructors to collaboratively design and implement courses, and to share teaching materials and exercise banks, mitigating the shortage of educational resources. A key feature is the UAV drone simulation module, which uses drone control tasks as a thread to let students solve real-world control problems through Python programming, thereby boosting their interest in learning programming.

UAV drones, as remotely piloted aircraft, have crucial applications in remote sensing, meteorology, land management, forestry, maritime surveillance, and natural disaster investigation. Their high-precision monitoring capability surpasses that of remote sensing satellites. However, educational use of UAV drones faces challenges such as funding constraints, regulatory restrictions, and privacy concerns. Computer simulation technology effectively overcomes these limitations. Large language models can parse submitted code logic via natural language processing, provide syntax corrections and algorithm optimization suggestions, and generate task guidance prompts and instructional feedback tailored to learners’ cognitive levels.

Our platform provides an interactive learning environment where students enhance their programming skills by solving UAV drone control problems under simulated conditions. The specific implementation pathway includes:

  • Code judging platform: Students write Python code to generate UAV drone control commands and submit online judging assignments.
  • UAV drone simulation module: Simulates real-world drone behavior, compatible with Tello drone commands.
  • Real-time tutoring module: Leverages large model interaction to correct code errors, provide guidance, and offer learning suggestions.

Platform Design

Code Judging Platform

The code judging platform embedded in our teaching system allows students to edit code directly in the browser with syntax highlighting and auto-completion. After submission, the code is dispatched to a sandbox for asynchronous execution. The sandbox ensures safe operation of user-submitted Python code, preventing dangerous privileged operations, and measures runtime, memory usage, and other metrics. The platform polls for results and displays the output on the page. The simulation module automatically reads the output, parses UAV drone control commands, and runs the simulation, enabling students to visually inspect the logic flow.

UAV Drone Simulation Module

The simulation module is developed using Unity framework and C# language, then compiled to WebGL via Unity’s engine, allowing it to run in the browser without additional plugins. WebGL, combined with JavaScript and WebAssembly, delivers performance close to native applications, ensuring efficient access and high-quality 3D rendering. Students can either run Python code that outputs UAV drone control commands or directly input commands to control the simulated drone. All commands are derived from real DJI Tello drone instructions. After debugging in the simulation, students can export the command set and send it to a physical drone.

The simulation workflow is as follows: when the simulation starts, it sequentially reads commands sent from the browser, and for each command updates the target state of the drone, defined as:

$$ S = (x, y, z, \omega) $$

where \(x, y, z\) are the coordinates in a three-dimensional Cartesian system, and \(\omega\) is the yaw angle. The control commands and their physical meanings are listed in the table below.

Table 1: Control Commands and Their Physical Meanings
Command Physical Meaning
takeoff Take off, set z-axis target to 30
forward a Move forward, y increases by a
backward a Move backward, y decreases by a
up a Move up, z increases by a
down a Move down, z decreases by a
left a Move left, x decreases by a
right a Move right, x increases by a
cw a Clockwise rotation, yaw ω increases by a
ccw a Counterclockwise rotation, yaw ω decreases by a
land Land, set z to 0

Let the current state be \(C\) and the target state be \(T\). The deviation \(e(t)\) is computed as:

$$ e(t) = T – C $$

Then we use a PID algorithm to compute the next acceleration and angular acceleration. Since the simulation samples at discrete time steps, we adopt the incremental form of the PID algorithm:

$$ u(t) = K_P e(t) + K_I \sum_{i=1}^{t} e(i) \Delta t + K_D \frac{e(t) – e(t-1)}{\Delta t} $$

where \(u(t)\) is the rate of change of state \(S\) (with \(u(0)=0\)), \(K_P\) is proportional gain, \(K_I\) is integral gain, \(K_D\) is derivative gain, and \(t\) is the sample index (t=1,2,…). The incremental form reduces computational complexity from \(O(n)\) to \(O(1)\):

$$ \Delta u(t) = K_P [e(t) – e(t-1)] + K_I e(t) \Delta t + K_D [e(t) – 2e(t-1) + e(t-2)] / \Delta t $$

For \(x, y, z\), \(\Delta u(t)\) represents the linear acceleration; for \(\omega\), it represents angular acceleration. After calculating the acceleration, we compute the rotor speeds and lift forces. The drone flight principle is illustrated conceptually: by adjusting the speeds of four rotors (M1 to M4), the drone can move, ascend, descend, hover, and rotate. For example, increasing M1 and M4 while decreasing M2 and M3 causes counterclockwise rotation; increasing M2 and M3 while decreasing M1 and M4 causes clockwise rotation; increasing M1 and M3 while decreasing M2 and M4 causes rightward movement.

Real-Time Tutoring Module

Our real-time tutoring module is powered by a large language model. When submitted code fails to run or produces unexpected results, the platform automatically invokes the LLM interface, sending the code and error information for analysis. The LLM, combined with preset prompts, provides immediate correction suggestions and guides students to modify their code. It also offers knowledge point reviews and learning recommendations to support self-study.

Teaching Implementation

We have deployed the UAV drone simulation Python teaching platform in a general programming course. The course content is organized around UAV drone control tasks, covering Python fundamentals, control flow, strings and collections, algorithm basics, mathematical operations, file handling and exception management, Numpy scientific computing, and drone control techniques. The course spans 16 class hours over eight sessions, each two hours long. A typical class time allocation is shown below.

Table 2: Course Content and Sessions
Session UAV Drone Operation Topic Knowledge Points Experimental Tasks
1 Basic drone control Python history, drone usage, Tello commands Combine commands (takeoff, forward, left, rotate, up) to fly a specified trajectory and reach a target position.
2 Complex trajectory flight Variables, data types, operators, expressions, control flow (if, for, while) Use loops and control statements to draw symmetric trajectories like triangles, squares, pentagons, circles, and petals.
3 Simulation log printing Strings, lists, tuples, dictionaries, sets Perform operations like append, indexing, slicing, reversal; output sorted information to simulation log.
4 Path optimization Dynamic programming basics, 1D/2D DP, Fibonacci sequence Given target points, compute number of route types; given map scores, find maximum score path; fly distances following Fibonacci sequence.
5 Drone treasure hunt Mathematical operations: series sum, GCD, LCM, chicken-and-rabbit problem, prime numbers Solve mathematical problems to determine treasure locations and control the drone to reach them.
6 Command composition Definition and invocation of functions, recursion Use loops, control statements, or direct combination to achieve complex flights; solve Tower of Hanoi and GCD recursively.
7 Command loading from files File read/write, exception handling Redirect standard I/O, read/write files to load, save, merge commands; resume flight from last state.
8 Drone attitude control Numpy matrix operations Compute direction vectors using rotation matrices to control drone attitude.

Over two semesters, we offered the course with a capacity of 30 students per semester. In each class, the first half was dedicated to Python and drone knowledge, and the second half to online judging programming problems. Most problems were set in the context of UAV drone missions. When students executed code, they could open the simulation module and visualize the drone’s behavior, helping them identify logic errors. The teaching assistant team provided on-site guidance. When TAs were insufficient, students used the real-time tutoring module to ask the LLM for help with common issues such as problem understanding, programming knowledge, and code checking.

Teaching Effectiveness

We collected data on knowledge point coverage per session. Starting from session 3, programming problems exhibited higher comprehensive coverage, indicating increased difficulty. However, with platform support and the teaching team, students’ correctness rates did not decline significantly; instead, they recovered in later sessions. The following table summarizes the correctness trends and simulation usage.

Table 3: Correctness Rates and Simulation Invocations
Session Knowledge Points Covered Correctness Rate (%) Avg. Simulation Invocations per Student
1 5 92 5.2
2 8 88 6.8
3 12 85 9.4
4 15 81 12.1
5 18 83 11.3
6 20 87 8.7
7 22 89 7.5
8 25 91 6.2

Figure shows that the average number of simulation invocations per student per week was at least 5, peaking at 16.25. Invocations were negatively correlated with correctness rates: when correctness was low, students turned to the simulation more frequently to visualize and debug their code logic. This indicates that the UAV drone simulation module effectively aids in understanding control flows and identifying errors.

Overall, the UAV drone simulation platform not only provides online code judging capabilities but also offers a realistic physical simulation using PID algorithms to mimic real drone behavior. Our teaching approach, centered on drone control tasks, organizes Python knowledge in a coherent sequence and presents students with engaging programming challenges. The presence of teaching assistants and the LLM-powered tutoring module ensures timely support. As the course progresses, students’ problem-solving correctness improves, their problem-analyzing ability strengthens, and their interest in interacting with the UAV drone simulation module increases.

Conclusion

Our large model-driven UAV drone simulation Python teaching platform represents an innovative step toward making programming education more collective, engaging, and effective. By integrating real-world drone control tasks with a high-fidelity simulator, we bridge the gap between abstract programming concepts and tangible outcomes. The use of PID control equations and physics-based simulation deepens students’ understanding of both Python and drone mechanics. The platform also paves the way for combining drone simulation with block-based programming in K-12 education. In the future, we plan to further leverage large AI models for intelligent tutoring, automated grading, and personalized feedback, exploring additional strategies to enhance Python teaching outcomes.

Scroll to Top