Challenge - 5 Problems
PID Flight Stabilization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of PID controller error calculation
Consider a PID controller for drone pitch stabilization. The error is calculated as the difference between the desired pitch angle and the current pitch angle. Given the following code snippet, what is the output of the error value?
Drone Programming
desired_pitch = 10.0 current_pitch = 7.5 error = desired_pitch - current_pitch print(error)
Attempts:
2 left
💡 Hint
Subtract current pitch from desired pitch to get error.
✗ Incorrect
The error is the difference between desired and current pitch: 10.0 - 7.5 = 2.5.
❓ Predict Output
intermediateIntegral term accumulation in PID controller
In a PID controller, the integral term sums all past errors to reduce steady-state error. Given the code below, what is the value of integral after the loop?
Drone Programming
errors = [0.5, 0.3, -0.2, 0.1] integral = 0.0 for e in errors: integral += e print(round(integral, 2))
Attempts:
2 left
💡 Hint
Add all error values together.
✗ Incorrect
Sum of errors: 0.5 + 0.3 + (-0.2) + 0.1 = 0.7.
🔧 Debug
advancedIdentify the cause of oscillation in PID output
A drone's PID controller code causes oscillations in pitch angle. Which option shows the most likely cause?
Drone Programming
def pid_output(error, integral, derivative, Kp, Ki, Kd): return Kp * error + Ki * integral + Kd * derivative # Given values error = 2.0 integral = 1.0 derivative = -0.5 Kp = 1.5 Ki = 0.0 Kd = 2.0 output = pid_output(error, integral, derivative, Kp, Ki, Kd) print(output)
Attempts:
2 left
💡 Hint
Integral term helps reduce steady oscillations.
✗ Incorrect
Ki is zero, so the integral term does not help correct steady errors, causing oscillations.
📝 Syntax
advancedSyntax error in PID controller update function
Which option contains the correct syntax for updating the integral term in a PID controller in Python?
Drone Programming
integral = 0.0 error = 1.2 dt = 0.1
Attempts:
2 left
💡 Hint
Use += to add the product of error and dt to integral.
✗ Incorrect
Option D correctly adds error * dt to integral. Option D is a syntax error (wrong operator), C divides instead of multiplies, D ends with an operator causing syntax error.
🧠 Conceptual
expertEffect of increasing derivative gain (Kd) in PID controller
In a drone's PID controller for flight stabilization, what is the most likely effect of significantly increasing the derivative gain (Kd)?
Attempts:
2 left
💡 Hint
Derivative gain reacts to how fast error changes.
✗ Incorrect
Increasing Kd helps the controller react to rapid changes in error, reducing overshoot and smoothing the response.
