APM: use ahrs.airspeed_estimate() in two more places

this applies the wind constraint
This commit is contained in:
Andrew Tridgell 2012-09-08 11:31:55 +10:00
parent 8f70a24fd4
commit 4219cb55ce
2 changed files with 9 additions and 8 deletions

View File

@ -1091,12 +1091,15 @@ static void update_current_flight_mode(void)
nav_pitch_cd = constrain(nav_pitch_cd, 500, takeoff_pitch_cd); nav_pitch_cd = constrain(nav_pitch_cd, 500, takeoff_pitch_cd);
} }
// don't use a pitch/roll integrators during takeoff if we are
// below minimum speed
#if APM_CONTROL == DISABLED #if APM_CONTROL == DISABLED
if (airspeed.use() && airspeed.get_airspeed() < g.flybywire_airspeed_min) { float aspeed;
g.pidServoPitch.reset_I(); if (ahrs.airspeed_estimate(&aspeed)) {
g.pidServoRoll.reset_I(); // don't use a pitch/roll integrators during takeoff if we are
// below minimum speed
if (aspeed < g.flybywire_airspeed_min) {
g.pidServoPitch.reset_I();
g.pidServoRoll.reset_I();
}
} }
#endif #endif

View File

@ -220,9 +220,7 @@ static void calc_nav_roll()
// Use airspeed_cruise as an analogue for airspeed if we don't have airspeed. // Use airspeed_cruise as an analogue for airspeed if we don't have airspeed.
float speed; float speed;
if(airspeed.use()) { if (!ahrs.airspeed_estimate(&speed)) {
speed = airspeed.get_airspeed();
} else {
speed = g.airspeed_cruise_cm*0.01; speed = g.airspeed_cruise_cm*0.01;
// Floor the speed so that the user can't enter a bad value // Floor the speed so that the user can't enter a bad value