diff options
author | Julian Oes <julian@oes.ch> | 2013-06-19 12:01:22 +0200 |
---|---|---|
committer | Julian Oes <julian@oes.ch> | 2013-06-19 12:24:14 +0200 |
commit | ece93ab62834be7f46501b1d31733cf58b5b1188 (patch) | |
tree | ae88cc835bd9d537060a4b41e7a98911375e37ea /src/modules | |
parent | 53eb76f4d558d345cc85b8f30e232b9bca2f0e51 (diff) | |
download | px4-firmware-ece93ab62834be7f46501b1d31733cf58b5b1188.tar.gz px4-firmware-ece93ab62834be7f46501b1d31733cf58b5b1188.tar.bz2 px4-firmware-ece93ab62834be7f46501b1d31733cf58b5b1188.zip |
Added integral reset for rate controller
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/multirotor_att_control/multirotor_rate_control.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/multirotor_att_control/multirotor_rate_control.c b/src/modules/multirotor_att_control/multirotor_rate_control.c index e37ede3e0..a0266e1b3 100644 --- a/src/modules/multirotor_att_control/multirotor_rate_control.c +++ b/src/modules/multirotor_att_control/multirotor_rate_control.c @@ -199,6 +199,12 @@ void multirotor_control_rates(const struct vehicle_rates_setpoint_s *rate_sp, pid_set_parameters(&roll_rate_controller, p.attrate_p, p.attrate_i, p.attrate_d, 1.0f, 1.0f, 0.2f); } + /* reset integral if on ground */ + if (rate_sp->thrust < 0.01f) { + pid_reset_integral(&pitch_rate_controller); + pid_reset_integral(&roll_rate_controller); + } + /* control pitch (forward) output */ float pitch_control = pid_calculate(&pitch_rate_controller, rate_sp->pitch , rates[1], rates_acc[1], deltaT, &control_debug->pitch_rate_p, &control_debug->pitch_rate_i, &control_debug->pitch_rate_d); |