diff options
author | Julian Oes <joes@student.ethz.ch> | 2012-12-19 17:54:18 -0800 |
---|---|---|
committer | Julian Oes <joes@student.ethz.ch> | 2012-12-19 17:54:18 -0800 |
commit | 06407b166f262c40b9e1887e6b4b71466fe4e57a (patch) | |
tree | 1fa45c19d0ccccbb55945b1cbaad200663af50d6 /apps/multirotor_att_control/multirotor_attitude_control.c | |
parent | 28b3ecd9c6c3c64d5f6d6a7cb04f8a9bb5dcb27a (diff) | |
download | px4-firmware-06407b166f262c40b9e1887e6b4b71466fe4e57a.tar.gz px4-firmware-06407b166f262c40b9e1887e6b4b71466fe4e57a.tar.bz2 px4-firmware-06407b166f262c40b9e1887e6b4b71466fe4e57a.zip |
My PID integral part fixes
Diffstat (limited to 'apps/multirotor_att_control/multirotor_attitude_control.c')
-rw-r--r-- | apps/multirotor_att_control/multirotor_attitude_control.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/multirotor_att_control/multirotor_attitude_control.c b/apps/multirotor_att_control/multirotor_attitude_control.c index e94d7c55d..b98736cee 100644 --- a/apps/multirotor_att_control/multirotor_attitude_control.c +++ b/apps/multirotor_att_control/multirotor_attitude_control.c @@ -197,7 +197,7 @@ void multirotor_control_attitude(const struct vehicle_attitude_setpoint_s *att_s } /* load new parameters with lower rate */ - if (motor_skip_counter % 1000 == 0) { + if (motor_skip_counter % 500 == 0) { /* update parameters from storage */ parameters_update(&h, &p); @@ -206,6 +206,13 @@ void multirotor_control_attitude(const struct vehicle_attitude_setpoint_s *att_s pid_set_parameters(&roll_controller, p.att_p, p.att_i, p.att_d, 1000.0f, 1000.0f); } + /* reset integral if on ground */ + if(att_sp->thrust < 0.1f) { + pid_reset_integral(&pitch_controller); + pid_reset_integral(&roll_controller); + } + + /* calculate current control outputs */ /* control pitch (forward) output */ |