Browse Source

Plane: move to airspeed_estimate with pointer

c415-sdk
Peter Hall 5 years ago committed by WickedShell
parent
commit
a2e72de5ae
  1. 2
      ArduPlane/Attitude.cpp
  2. 2
      ArduPlane/GCS_Mavlink.cpp
  3. 2
      ArduPlane/Log.cpp
  4. 2
      ArduPlane/is_flying.cpp
  5. 2
      ArduPlane/navigation.cpp
  6. 6
      ArduPlane/quadplane.cpp
  7. 2
      ArduPlane/sensors.cpp

2
ArduPlane/Attitude.cpp

@ -8,7 +8,7 @@ @@ -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;
}

2
ArduPlane/GCS_Mavlink.cpp

@ -247,7 +247,7 @@ float GCS_MAVLINK_Plane::vfr_hud_airspeed() const @@ -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;
}

2
ArduPlane/Log.cpp

@ -96,7 +96,7 @@ struct PACKED log_Control_Tuning { @@ -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),

2
ArduPlane/is_flying.cpp

@ -24,7 +24,7 @@ void Plane::update_is_flying_5Hz(void) @@ -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

2
ArduPlane/navigation.cpp

@ -104,7 +104,7 @@ void Plane::calc_airspeed_errors() @@ -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)) {

6
ArduPlane/quadplane.cpp

@ -1408,7 +1408,7 @@ float QuadPlane::assist_climb_rate_cms(void) const @@ -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) @@ -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() @@ -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);
}

2
ArduPlane/sensors.cpp

@ -66,7 +66,7 @@ void Plane::read_airspeed(void) @@ -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;
}
}

Loading…
Cancel
Save