diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2013-10-24 18:34:22 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2013-10-24 18:34:22 +0200 |
commit | 01d8ca1fbaf579534c0faca264bd458d20997f13 (patch) | |
tree | df6447fb35a343923981db0ccc9f0922738cbfd8 /src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp | |
parent | bff3bf8d87a2496bf6f1857287200926a4b21e0a (diff) | |
parent | 1e89f30120f30f0cac9c4bdd7b81ee2da96bcc8f (diff) | |
download | px4-firmware-01d8ca1fbaf579534c0faca264bd458d20997f13.tar.gz px4-firmware-01d8ca1fbaf579534c0faca264bd458d20997f13.tar.bz2 px4-firmware-01d8ca1fbaf579534c0faca264bd458d20997f13.zip |
manual merge fw_integrator_fix_ouputlimit into fw_staging_ouputlimit
Diffstat (limited to 'src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp')
-rw-r--r-- | src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp b/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp index 626812288..4e27de45c 100644 --- a/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp +++ b/src/lib/ecl/attitude_fw/ecl_pitch_controller.cpp @@ -160,10 +160,11 @@ float ECL_PitchController::control_bodyrate(float roll, float pitch, } /* integrator limit */ - _integrator = math::constrain(_integrator, -_integrator_max, _integrator_max); + //xxx: until start detection is available: integral part in control signal is limited here + float integrator_constrained = math::constrain(_integrator * _k_i, -_integrator_max, _integrator_max); /* Apply PI rate controller and store non-limited output */ - _last_output = (_rate_error * _k_p + _integrator * _k_i + _rate_setpoint * k_ff) * scaler * scaler; //scaler is proportional to 1/airspeed + _last_output = (_rate_error * _k_p + integrator_constrained + _rate_setpoint * k_ff) * scaler * scaler; //scaler is proportional to 1/airspeed // warnx("pitch: _integrator: %.4f, _integrator_max: %.4f, airspeed %.4f, _k_i %.4f, _k_p: %.4f", (double)_integrator, (double)_integrator_max, (double)airspeed, (double)_k_i, (double)_k_p); // warnx("roll: _last_output %.4f", (double)_last_output); return math::constrain(_last_output, -1.0f, 1.0f); |