mirror of https://github.com/ArduPilot/ardupilot
Copter: Tradheli - make new integrator scheme selectable
This commit is contained in:
parent
cd3ee597c7
commit
b1bd77f19f
|
@ -73,13 +73,18 @@ void Copter::check_dynamic_flight(void)
|
||||||
// should be run between the rate controller and the servo updates.
|
// should be run between the rate controller and the servo updates.
|
||||||
void Copter::update_heli_control_dynamics(void)
|
void Copter::update_heli_control_dynamics(void)
|
||||||
{
|
{
|
||||||
// Use Leaky_I if we are not moving fast
|
|
||||||
// attitude_control->use_leaky_i(!heli_flags.dynamic_flight);
|
|
||||||
attitude_control->use_leaky_i(false);
|
|
||||||
|
|
||||||
if (ap.land_complete || ap.land_complete_maybe) {
|
if (!motors->using_leaky_integrator()) {
|
||||||
motors->set_land_complete(true);
|
//turn off leaky_I
|
||||||
|
attitude_control->use_leaky_i(false);
|
||||||
|
if (ap.land_complete || ap.land_complete_maybe) {
|
||||||
|
motors->set_land_complete(true);
|
||||||
|
} else {
|
||||||
|
motors->set_land_complete(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Use Leaky_I if we are not moving fast
|
||||||
|
attitude_control->use_leaky_i(!heli_flags.dynamic_flight);
|
||||||
motors->set_land_complete(false);
|
motors->set_land_complete(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,13 +51,13 @@ void ModeAcro_Heli::run()
|
||||||
case AP_Motors::SpoolState::GROUND_IDLE:
|
case AP_Motors::SpoolState::GROUND_IDLE:
|
||||||
// If aircraft is landed, set target heading to current and reset the integrator
|
// If aircraft is landed, set target heading to current and reset the integrator
|
||||||
// Otherwise motors could be at ground idle for practice autorotation
|
// Otherwise motors could be at ground idle for practice autorotation
|
||||||
if (copter.ap.land_complete) {
|
if ((motors->init_targets_on_arming() && motors->using_leaky_integrator()) || (copter.ap.land_complete && !motors->using_leaky_integrator())) {
|
||||||
attitude_control->set_attitude_target_to_current_attitude();
|
attitude_control->set_attitude_target_to_current_attitude();
|
||||||
attitude_control->reset_rate_controller_I_terms();
|
attitude_control->reset_rate_controller_I_terms();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
|
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
|
||||||
if (copter.ap.land_complete) {
|
if (copter.ap.land_complete && !motors->using_leaky_integrator()) {
|
||||||
attitude_control->reset_rate_controller_I_terms();
|
attitude_control->reset_rate_controller_I_terms();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -56,13 +56,13 @@ void ModeStabilize_Heli::run()
|
||||||
case AP_Motors::SpoolState::GROUND_IDLE:
|
case AP_Motors::SpoolState::GROUND_IDLE:
|
||||||
// If aircraft is landed, set target heading to current and reset the integrator
|
// If aircraft is landed, set target heading to current and reset the integrator
|
||||||
// Otherwise motors could be at ground idle for practice autorotation
|
// Otherwise motors could be at ground idle for practice autorotation
|
||||||
if (copter.ap.land_complete) {
|
if ((motors->init_targets_on_arming() && motors->using_leaky_integrator()) || (copter.ap.land_complete && !motors->using_leaky_integrator())) {
|
||||||
attitude_control->set_yaw_target_to_current_heading();
|
attitude_control->set_yaw_target_to_current_heading();
|
||||||
attitude_control->reset_rate_controller_I_terms();
|
attitude_control->reset_rate_controller_I_terms();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
|
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
|
||||||
if (copter.ap.land_complete) {
|
if (copter.ap.land_complete && !motors->using_leaky_integrator()) {
|
||||||
attitude_control->reset_rate_controller_I_terms();
|
attitude_control->reset_rate_controller_I_terms();
|
||||||
}
|
}
|
||||||
case AP_Motors::SpoolState::SPOOLING_UP:
|
case AP_Motors::SpoolState::SPOOLING_UP:
|
||||||
|
|
Loading…
Reference in New Issue