Arduplane: Autoflaps
I was wondering if I could get Autoflaps to work in all modes as a percentage of true speed between v1 and v2?
Original code?
// Auto flap deployment
if(control_mode < FLY_BY_WIRE_B) {
RC_Channel_aux::copy_radio_in_out(RC_Channel_aux::k_flap_auto);
} else if (control_mode >= FLY_BY_WIRE_B) {
int16_t flapSpeedSource = 0;
// FIXME: use target_airspeed in both FBW_B and g.airspeed_enabled cases - Doug?
if (control_mode == FLY_BY_WIRE_B) {
flapSpeedSource = target_airspeed_cm * 0.01;
} else if (airspeed.use()) {
flapSpeedSource = g.airspeed_cruise_cm * 0.01;
} else {
flapSpeedSource = aparm.throttle_cruise;
}
if ( g.flap_1_speed != 0 && flapSpeedSource > g.flap_1_speed) {
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_flap_auto, 0);
} else if (g.flap_2_speed != 0 && flapSpeedSource > g.flap_2_speed) {
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_flap_auto, g.flap_1_percent);
} else {
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_flap_auto, g.flap_2_percent);
}
}
I was thinking the same thing myself, I think this would give a smooth transition and allow the pitch controller plenty of time to compensate which would make for nice controlled landings on heavier planes.
I can't get my head around the syntax of c++ but the code should look something like this,
If Autoflaps=selected and airspeed=valid then let flaps=((airspeed-v1)/(v2-v1)*100 limited 0-100)
Should we let it come in on ground speed if there is no airspeed sensor?
Would it be worth throwing in auto landing gear at v1?
Sent from my iPad
On 20/08/2013, at 7:58 AM, "t0mmg" [email protected] wrote:
I was thinking the same thing myself, I think this would give a smooth transition and allow the pitch controller plenty of time to compensate which would make for nice controlled landings on heavier planes.
— Reply to this email directly or view it on GitHub.
Autoflaps is in and working and the doco has been recently updated. I'm closing this out. If anyone has any objections please let me know. Thanks, Grant.