herolic / aeroquad

Automatically exported from code.google.com/p/aeroquad
0 stars 0 forks source link

PID dTerm calculation does not use delay since last call #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. See 
http://aeroquad.com/showthread.php?1299-All-integrations-updates-based-on-wrong-
and-inaccurate-delta-t-G_Dt-values&p=12722&viewfull=1#post12722

Please provide any additional information below.
The D of the PID depends on the spent time, which is missing in the 
calculation. It should be
dTerm = PIDparameters->D * (currentPosition - PIDparameters->lastPosition) / 
G_Dt;
Fixing this bug requires that all users multiply there current PIDparameters->D 
parameter value (kD) before next takeoff by their current loop time, which 
probably is ~ 0.002-0.003ms. This value may differ a bit in different setups. 
The current D calculation only works when the loop() runtime is constant, but 
it is not constant.
I am aware that forcing the users to adapt and then retune their kD value is a 
problem, but this is a major bug requiring major action.

Original issue reported on code.google.com by al...@arcor.de on 13 Nov 2010 at 12:46

GoogleCodeExporter commented 9 years ago
Implemented this with Honk/Lokling's fixes.

Original comment by CaranchoEngineering@gmail.com on 28 Nov 2010 at 10:42