TradHeli: Create new function to move data between AP_MotorsHeli and AP_AttitudeControl.

This commit is contained in:
Robert Lefebvre 2014-05-09 17:07:52 -04:00 committed by Randy Mackay
parent 1aa3961151
commit ff71b0fa35
2 changed files with 14 additions and 4 deletions

View File

@ -988,6 +988,10 @@ static void fast_loop()
// run low level rate controllers that only require IMU data
attitude_control.rate_controller_run();
#if FRAME_CONFIG == HELI_FRAME
update_heli_control_dynamics();
#endif //HELI_FRAME
// write out the servo PWM values
// ------------------------------

View File

@ -68,8 +68,6 @@ static void check_dynamic_flight(void)
if (heli_dynamic_flight_counter >= 100) {
heli_flags.dynamic_flight = true;
heli_dynamic_flight_counter = 100;
// update attitude control's leaky i term setting
attitude_control.use_leaky_i(!heli_flags.dynamic_flight);
}
}
}else{
@ -79,13 +77,21 @@ static void check_dynamic_flight(void)
heli_dynamic_flight_counter--;
}else{
heli_flags.dynamic_flight = false;
// update attitude control's leaky i term setting
attitude_control.use_leaky_i(!heli_flags.dynamic_flight);
}
}
}
}
// update_heli_control_dynamics - pushes several important factors up into AP_MotorsHeli.
// should be run between the rate controller and the servo updates.
static void update_heli_control_dynamics(void)
{
// Use Leaky_I if we are not moving fast
attitude_control.use_leaky_i(!heli_flags.dynamic_flight);
// To-Do: Update dynamic phase angle of swashplate
}
// heli_update_landing_swash - sets swash plate flag so higher minimum is used when landed or landing
// should be called soon after update_land_detector in main code
static void heli_update_landing_swash()