UAT 305 Autopilot and Control Technology
Worksheet 1 Exploring timing in the autopilot
Objective
Assess scheduler load and loop delay and link them to the phase lost
Equipment and materials
- ArduCopter source for the version in use
- ArduPilot SITL and a log viewer
- Python and the module 1 example code
- PX4 uORB documentation
- Manufacturer documents of the lab's flight controller board (and the board itself, shown in class by the lecturer)
Safety
- Simulation and desk work only; no real flights
- A board shown in class must be unpowered and have no propellers fitted
Steps
- In class: read scheduler_tasks and pick 10 tasks
- Self-study: compute the load of the 10 tasks with Example 1 and build the table of tasks, rates and expected times
- In class: run SITL and compare PM messages in the log with the expected loop time
- Self-study: change SCHED_LOOP_RATE in SITL, observe, then restore
- In class: estimate total delay from Figure 1 and compute the phase lost with Example 2
- In class: compare with PX4's structure from the uORB documentation
- Self-study: draw how the board connects IMUs, GPS, ESCs and buses from the manufacturer documents, check MOT_PWM_TYPE and EK3_IMU_MASK, and compute output delay with Example 3
Record of results
| Task name | Rate (Hz) | Expected time (µs) | Share of CPU time (%) | PM in log (if any) |
|---|---|---|---|---|
| Step or case | Delay (ms) | Phase lost (°) | Remaining phase margin (°) |
|---|---|---|---|
| Item (IMU, bus, ESC, GPS) | Value or parameter found | Update rate (Hz) | Average delay (ms) | Phase at 8 Hz (°) |
|---|---|---|---|---|
Questions
From Table 1, which task uses the most processing time and why? If SCHED_LOOP_RATE were doubled, what would that task's load become?
How much phase margin is left with the total delay your group estimated from Figure 1, and how much delay would remove it entirely? What does this say about lowering filter cutoffs?
If the board sent ESC commands as 50 Hz PWM instead of DShot, how different would the phase lost be? Why is the difference between DShot150 and DShot600 so small?
How does a board with three IMUs and EK3_IMU_MASK set to use all of them tolerate faults? How do ArduPilot and PX4 differ in passing data between parts of the software?
Check before you hand in
What to hand in
- Task load table
- Loop timing comparison from the log
- Phase calculation
- ArduPilot versus PX4 comparison
- Board hardware diagram and output-delay table