mirror of https://github.com/ArduPilot/ardupilot
git-svn-id: https://arducopter.googlecode.com/svn/trunk@859 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
f622222f4a
commit
391e4268c4
|
@ -21,11 +21,7 @@ PID::get_pid(long err, long dt, float scaler)
|
||||||
if(_kd != 0){
|
if(_kd != 0){
|
||||||
// Compute derivative component
|
// Compute derivative component
|
||||||
//derivative = (error - previous_error)/dt
|
//derivative = (error - previous_error)/dt
|
||||||
float derivative = (error - _last_error) / dt;
|
float derivative = 1000 * (error - _last_error) / dt;
|
||||||
|
|
||||||
//Serial.print("d: ");
|
|
||||||
//Serial.println(derivative,DEC);
|
|
||||||
|
|
||||||
_last_error = error;
|
_last_error = error;
|
||||||
output += _kd * derivative; // Sum the derivative component
|
output += _kd * derivative; // Sum the derivative component
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue