multirotor_pos_control: fixes for AUTO mode, minor cleanup

This commit is contained in:
Anton Babushkin 2013-07-17 22:22:51 +04:00
parent c4248c055f
commit 17366c4b0d
1 changed files with 3 additions and 3 deletions

View File

@ -340,14 +340,14 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[])
}
}
if (reset_sp_alt) {
if (status.flag_control_manual_enabled && reset_sp_alt) {
reset_sp_alt = false;
local_pos_sp.z = local_pos.z;
z_vel_pid.integral = -manual.throttle; // thrust PID uses Z downside
mavlink_log_info(mavlink_fd, "reset alt setpoint: z = %.2f, throttle = %.2f", local_pos_sp.z, manual.throttle);
}
if (status.manual_sas_mode == VEHICLE_MANUAL_SAS_MODE_SIMPLE && reset_sp_pos) {
if (status.flag_control_manual_enabled && status.manual_sas_mode == VEHICLE_MANUAL_SAS_MODE_SIMPLE && reset_sp_pos) {
reset_sp_pos = false;
local_pos_sp.x = local_pos.x;
local_pos_sp.y = local_pos.y;