diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-23 20:23:05 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-23 20:23:05 +0200 |
commit | 542cc7d7fbf67499a172efdd52542b517ec0dc21 (patch) | |
tree | 4a73c4ae5031587fb2964db11375eae9aebe3db8 /src/drivers/px4fmu/fmu.cpp | |
parent | 287973da2837584e5f52c21ce599db913d1685c7 (diff) | |
download | px4-firmware-542cc7d7fbf67499a172efdd52542b517ec0dc21.tar.gz px4-firmware-542cc7d7fbf67499a172efdd52542b517ec0dc21.tar.bz2 px4-firmware-542cc7d7fbf67499a172efdd52542b517ec0dc21.zip |
fmu: Rely on pwm_limit() call for band limits, do constrain instead of altering the direction / value
Diffstat (limited to 'src/drivers/px4fmu/fmu.cpp')
-rw-r--r-- | src/drivers/px4fmu/fmu.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index fd69cf795..8a4bfa18c 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -648,11 +648,9 @@ PX4FMU::task_main() /* iterate actuators */ for (unsigned i = 0; i < num_outputs; i++) { - /* last resort: catch NaN, INF and out-of-band errors */ - if (i >= outputs.noutputs || - !isfinite(outputs.output[i]) || - outputs.output[i] < -1.0f || - outputs.output[i] > 1.0f) { + /* last resort: catch NaN and INF */ + if ((i >= outputs.noutputs) || + !isfinite(outputs.output[i])) { /* * Value is NaN, INF or out of band - set to the minimum value. * This will be clearly visible on the servo status and will limit the risk of accidentally @@ -664,6 +662,7 @@ PX4FMU::task_main() uint16_t pwm_limited[num_outputs]; + /* the PWM limit call takes care of out of band errors and constrains */ pwm_limit_calc(_servo_armed, num_outputs, _disarmed_pwm, _min_pwm, _max_pwm, outputs.output, pwm_limited, &_pwm_limit); /* output to the servos */ |