srinivas.siteLearn to FlyLesson 07

Lesson 07 · Part 2 · Control

Altitude hold

Mission: Hold a height with a loop, and see why the integral term removes the steady offset a load causes.

The interactive version of this lesson needs JavaScript. Below are its steps as text.

Steps

1. Height is a loop

Press Run. The drone starts at 0.5 m and the target is 1.0 m. The loop compares them and asks for more or less thrust.

Why it matters: Altitude hold is the same kind of loop as the wobble in Lesson 6, applied to height. The error is the target minus the measured height, and the loop turns it into thrust.

2. Predict a load

Predict first. Then press Run with the integral turned off (ki = 0) and a 0.03 N load (about 3 g of push) from 4 s on.

Why it matters: A steady load needs a steady extra thrust. The proportional part only acts while there is an error, so a steady load leaves one behind.

3. Proportional gain, live

Drag the height kp slider, then press Run for the height step. Watch the overshoot.

Why it matters: Proportional gain sets the speed of the correction. Too much gain overshoots, as in Lesson 6.

4. Integral gain with a load

Set the ki slider to a value you choose, then press Run with the load applied from 4 s on.

Why it matters: The integral term adds up the error over time, so a steady load is corrected however small the error. Too much integral gain makes it slow to settle and can overshoot.

5. Too much integral

Press Run with ki = 6 and the load from 4 s on, then compare it with the ki 3 run.

Why it matters: The integral keeps adding up the error. Too much of it can overshoot, and the slow part of the response can ring.

6. Your reading: write the offset

Open the Notebook tab. Enter the start and target heights, and the height the drone held at the end, from one of your runs.

Why it matters: The end offset under a steady load is the number to read. Entering it with its unit makes the comparison honest.

Go deeper

The maths in this lesson

height target    v_des = kp_z·(z_des − z)
vertical accel  a_z = kp_v·(v_des − v) + ki·∫(v_des − v) dt
thrust          T = m·(g + a_z) / (cos φ · cos θ)

The loop is cascaded: height sets a climb rate, and the climb rate sets an acceleration, which sets thrust. The integral here acts on the climb-rate error.

Model limits