UAT 104 Computer Programming
Worksheet 1 A mission calculator
Objective
Set up a Python environment and write a first program comparing available flight time with the time the mission needs
Equipment and materials
- Computer with Python 3.12–3.14
- requirements.txt and example code at /downloads/uat-104/
- VS Code or Jupyter Notebook
- Battery specification of the group's chosen drone
Safety
- Desk work only; no flying
Steps
- Install Python, create .venv and install requirements.txt
- Screenshot python --version and pip list
- Write mission_calc.py storing voltage, capacity, usable fraction, average power and distance as variables
- Print available and required flight time; test against Example 1 to get 24.4 minutes
- Switch to the group's drone and check whether the mission fits
- Open Jupyter, run Example 2 and explain the result in a text cell
Record of results
| Item checked | Command used | Result | Pass? |
|---|---|---|---|
| Data set | Voltage (V) and capacity (Ah) | Usable energy (Wh) | Available time (min) | Required time (min) | Mission fits? |
|---|---|---|---|---|---|
Questions
Why must the program give 24.4 minutes for Example 1 before you enter your group's drone? If it printed 0.41 or 1461.4 instead, which line of the code would you suspect?
How many minutes of margin does your group's drone have over the time the mission needs? If the usable fraction drops from 0.8 to 0.7, how much does the result change, and does the mission still fit?
Why does total == 1.0 in Example 2 give False while math.isclose(total, 1.0) gives True? What would happen if a program checked sensor values with ==?
Give two variable names from your group's mission_calc.py and explain which unit mistake each name helps prevent.
Check before you hand in
What to hand in
- Environment screenshots
- mission_calc.py
- Notebook explaining Example 2