mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 12:40:35 +08:00
Derivative fix: Comments and code style
This commit is contained in:
@@ -293,10 +293,16 @@ int blockIntegralTrapTest()
|
||||
|
||||
float BlockDerivative::update(float input)
|
||||
{
|
||||
float output = 0.0f;
|
||||
float output;
|
||||
if (_initialized) {
|
||||
output = _lowPass.update((input - getU()) / getDt());
|
||||
} else {
|
||||
// if this is the first call to update
|
||||
// we have no valid derivative
|
||||
// and so we use the assumption the
|
||||
// input value is not changing much,
|
||||
// which is the best we can do here.
|
||||
output = 0.0f;
|
||||
_initialized = true;
|
||||
}
|
||||
setU(input);
|
||||
|
||||
Reference in New Issue
Block a user