AP_Math: added fixedwing_turn_rate() helper

This commit is contained in:
Andrew Tridgell 2021-02-27 13:36:36 +11:00
parent b450740fb0
commit e884e4c5ac
2 changed files with 15 additions and 0 deletions

View File

@ -404,3 +404,13 @@ void fill_nanf(float *f, uint16_t count)
}
}
#endif
/*
calculate turn rate in deg/sec given a bank angle and airspeed for a
fixed wing aircraft
*/
float fixedwing_turn_rate(float bank_angle_deg, float airspeed)
{
bank_angle_deg = constrain_float(bank_angle_deg, -80, 80);
return degrees(GRAVITY_MSS*tanf(radians(bank_angle_deg))/MAX(airspeed,1));
}

View File

@ -297,3 +297,8 @@ float calc_lowpass_alpha_dt(float dt, float cutoff_freq);
void fill_nanf(float *f, uint16_t count);
#endif
/*
calculate turn rate in deg/sec given a bank angle and airspeed for a
fixed wing aircraft
*/
float fixedwing_turn_rate(float bank_angle_deg, float airspeed);