Elective: simulation and control
A control experiment needs a hypothesis, a baseline and variables held constant. A one-dimensional model helps show the effect of gain, but it does not include the motors, wind, latency or sensors of a real drone, so it is used to learn experimental design.
A04 · Exercises and case studies
A control experiment needs a hypothesis, a baseline and variables held constant. A one-dimensional model helps show the effect of gain, but it does not include the motors, wind, latency or sensors of a real drone, so it is used to learn experimental design.
Before you start
Use a Windows or Linux computer, read CSV files with a spreadsheet program or text editor, and save your own work files separately from the originals. The basic Python set uses only the standard library; AI programs and real simulators have separate installation steps.
By the end of this lesson
- Design an experiment that changes a single factor, with a baseline
- Report results and the limitations of transferring from simulation to a real system
Task and hands-on steps
Model: next x = x + gain × (target − x), starting at x=0 with a target of 1. Try gain 0.2 and 0.8 for 10 steps using the same initial value. These values have no meaning as drone tuning values.
Extract the ZIP, then open A04-guide.md and A04-worksheet.csv . Keep hypotheses separate from verified results. A blank in the worksheet means data still has to be collected, not that it has passed.
- Run python practice.py control and record the sequence of x for both gains
- State a hypothesis before changing the value, choose a metric such as the error at step 10, and specify the time step in abstract terms
- Repeat with the same input to confirm the program's repeatability, then design noise/seed as the next experiment
- Write the limitations and a test plan in a simulator with realistic dynamics, without copying this gain to real equipment
Deliverables and assessment criteria
Submit: control experiment report
Key criteria: includes a baseline, controlled variables, seed/version and repetition; does not claim sim-to-real success
Attach files that can be opened and checked, the date, the data version, and your reasoning when no conclusion can yet be drawn. Completing the worksheet does not replace experimental results with a real model, real equipment or a real skills assessment.
Open the answer guide after completing the worksheet
The final error for gain 0.2 is 0.8^10 and for gain 0.8 it is 0.2^10. This program is deterministic and needs no seed; a gain that reaches the target quickly in this equation does not prove drone stability.
Activity plan for instructors
This 5-hour elective lies outside the 40-hour core AI course. Have students design a follow-on experiment in ArduPilot/PX4 and record the factors that the small model leaves out.
Review question: What in the real world does this simulator not model?
| Learning set | Explain | Practise | Assess | Total equipment stations |
|---|
An additional 300-minute elective: explanation 60 minutes, practice 180 minutes and assessment/review 60 minutes, outside the 40-hour AI course.
Equipment-station time is part of the total time in the plan and is not added twice. Instructors separate PC results from observed tasks and have each student explain their own work before the answer guide is opened.
See the full sequence of activities and the foundation extensions →Bibliography and citation scope
Additional sources checked 9 September B.E. 2569 (2026). The hypothetical cases, figures, worksheets and activity criteria were newly compiled by PK-Research.
- ArduPilot, Software In The Loop
A real simulator source; our state-machine example does not simulate flight dynamics
- ArduPilot, SITL on Windows using WSL
Windows/WSL installation guidance; versions and run results must be recorded separately