mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-13 02:54:09 +08:00
Plane: move to airspeed_estimate with pointer
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
float Plane::get_speed_scaler(void)
|
||||
{
|
||||
float aspeed, speed_scaler;
|
||||
if (ahrs.airspeed_estimate(&aspeed)) {
|
||||
if (ahrs.airspeed_estimate(aspeed)) {
|
||||
if (aspeed > auto_state.highest_airspeed) {
|
||||
auto_state.highest_airspeed = aspeed;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ float GCS_MAVLINK_Plane::vfr_hud_airspeed() const
|
||||
|
||||
// airspeed estimates are OK:
|
||||
float aspeed;
|
||||
if (AP::ahrs().airspeed_estimate(&aspeed)) {
|
||||
if (AP::ahrs().airspeed_estimate(aspeed)) {
|
||||
return aspeed;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ struct PACKED log_Control_Tuning {
|
||||
void Plane::Log_Write_Control_Tuning()
|
||||
{
|
||||
float est_airspeed = 0;
|
||||
ahrs.airspeed_estimate(&est_airspeed);
|
||||
ahrs.airspeed_estimate(est_airspeed);
|
||||
|
||||
struct log_Control_Tuning pkt = {
|
||||
LOG_PACKET_HEADER_INIT(LOG_CTUN_MSG),
|
||||
|
||||
@@ -24,7 +24,7 @@ void Plane::update_is_flying_5Hz(void)
|
||||
|
||||
// airspeed at least 75% of stall speed?
|
||||
const float airspeed_threshold = MAX(aparm.airspeed_min,2)*0.75f;
|
||||
bool airspeed_movement = ahrs.airspeed_estimate(&aspeed) && (aspeed >= airspeed_threshold);
|
||||
bool airspeed_movement = ahrs.airspeed_estimate(aspeed) && (aspeed >= airspeed_threshold);
|
||||
|
||||
if (gps.status() < AP_GPS::GPS_OK_FIX_2D && arming.is_armed() && !airspeed_movement && isFlyingProbability > 0.3) {
|
||||
// when flying with no GPS, use the last airspeed estimate to
|
||||
|
||||
@@ -104,7 +104,7 @@ void Plane::calc_airspeed_errors()
|
||||
|
||||
// we use the airspeed estimate function not direct sensor as TECS
|
||||
// may be using synthetic airspeed
|
||||
ahrs.airspeed_estimate(&airspeed_measured);
|
||||
ahrs.airspeed_estimate(airspeed_measured);
|
||||
|
||||
// FBW_B/cruise airspeed target
|
||||
if (!failsafe.rc_failsafe && (control_mode == &mode_fbwb || control_mode == &mode_cruise)) {
|
||||
|
||||
@@ -1408,7 +1408,7 @@ float QuadPlane::assist_climb_rate_cms(void) const
|
||||
float QuadPlane::desired_auto_yaw_rate_cds(void) const
|
||||
{
|
||||
float aspeed;
|
||||
if (!ahrs.airspeed_estimate(&aspeed) || aspeed < plane.aparm.airspeed_min) {
|
||||
if (!ahrs.airspeed_estimate(aspeed) || aspeed < plane.aparm.airspeed_min) {
|
||||
aspeed = plane.aparm.airspeed_min;
|
||||
}
|
||||
if (aspeed < 1) {
|
||||
@@ -1538,7 +1538,7 @@ void QuadPlane::update_transition(void)
|
||||
}
|
||||
|
||||
float aspeed;
|
||||
bool have_airspeed = ahrs.airspeed_estimate(&aspeed);
|
||||
bool have_airspeed = ahrs.airspeed_estimate(aspeed);
|
||||
|
||||
// tailsitters use angle wait, not airspeed wait
|
||||
if (is_tailsitter() && transition_state == TRANSITION_AIRSPEED_WAIT) {
|
||||
@@ -1919,7 +1919,7 @@ void QuadPlane::update_throttle_hover()
|
||||
// calc average throttle if we are in a level hover and low airspeed
|
||||
if (throttle > 0.0f && fabsf(inertial_nav.get_velocity_z()) < 60 &&
|
||||
labs(ahrs_view->roll_sensor) < 500 && labs(ahrs_view->pitch_sensor) < 500 &&
|
||||
ahrs.airspeed_estimate(&aspeed) && aspeed < plane.aparm.airspeed_min*0.3) {
|
||||
ahrs.airspeed_estimate(aspeed) && aspeed < plane.aparm.airspeed_min*0.3) {
|
||||
// Can we set the time constant automatically
|
||||
motors->update_throttle_hover(0.01f);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void Plane::read_airspeed(void)
|
||||
|
||||
// update smoothed airspeed estimate
|
||||
float aspeed;
|
||||
if (ahrs.airspeed_estimate(&aspeed)) {
|
||||
if (ahrs.airspeed_estimate(aspeed)) {
|
||||
smoothed_airspeed = smoothed_airspeed * 0.8f + aspeed * 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user