Complete the code to set the proportional gain of the PID controller.
pid_controller.Kp = [1];The proportional gain (Kp) controls how strongly the controller reacts to the current speed error. Setting it to 0.8 provides a balanced response.
Complete the code to set the integral gain of the PID controller.
pid_controller.Ki = [1];The integral gain (Ki) helps eliminate steady-state error by accumulating past errors. A small value like 0.1 is typical to avoid instability.
Fix the error in setting the derivative gain of the PID controller.
pid_controller.Kd = [1];The derivative gain (Kd) predicts future error and smooths the response. It should be a small positive number like 0.05. Negative values cause instability.
Fill both blanks to create a dictionary of PID gains and check if the proportional gain is greater than 1.
pid_gains = {'P': [1], 'I': [2]
if pid_gains['P'] [3] 1:
print('High proportional gain')The dictionary stores the proportional and integral gains. The condition checks if the proportional gain is greater than 1 to print a warning.
Fill all three blanks to create a dictionary comprehension that maps each gain name to its value if the value is greater than zero.
filtered_gains = {name: value for name, value in pid_gains.items() if value [1] 0 and name != [2] and name != [3]This dictionary comprehension filters gains with positive values and excludes derivative ('D') and integral ('I') gains from the result.