Cool program. It took a tick to figure out how to invoke it.
drf@V51292 home % ./drone_pid ./drone_opts.txt
./drone_pid: ./drone_opts.txt
msec 50
targ 30
pid 200
title Pitch 0.0
res msec targ deg out err dErr
res 0.00 30.00 0.15 60.00 30.00 0.00
res 0.05 30.00 0.45 59.70 29.85 -0.15
res 0.10 30.00 0.90 59.10 29.55 -0.30
res 0.15 30.00 1.49 58.21 29.10 -0.45
res 0.20 30.00 2.22 57.02 28.51 -0.59
res 0.25 30.00 3.10 55.55 27.78 -0.74
res 0.30 30.00 4.11 53.80 26.90 -0.87
res 0.35 30.00 5.24 51.79 25.89 -1.01
res 0.40 30.00 6.51 49.51 24.76 -1.14
res 0.45 30.00 7.89 46.99 23.49 -1.26
res 0.50 30.00 9.37 44.23 22.11 -1.38
res 0.55 30.00 10.97 41.25 20.63 -1.49
res 0.60 30.00 12.66 38.06 19.03 -1.59
res 0.65 30.00 14.43 34.69 17.34 -1.69
...
I might adopt your drone 'motion()
' simulation into one of my demos on PID with simulated heater or motor