From 82cbc214047ff0294a23b376a53f926cf11b437a Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 6 Jan 2023 16:57:16 +0900 Subject: [PATCH] Copter: replace get_rate_bf_targets with get_rate_ef_targets --- ArduCopter/Copter.cpp | 11 ++++++++--- ArduCopter/Copter.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index 2ebdf63263..808c8065ee 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -750,10 +750,15 @@ bool Copter::get_wp_crosstrack_error_m(float &xtrack_error) const return true; } -// get the target body-frame angular velocities in rad/s (Z-axis component used by some gimbals) -bool Copter::get_rate_bf_targets(Vector3f& rate_bf_targets) const +// get the target earth-frame angular velocities in rad/s (Z-axis component used by some gimbals) +bool Copter::get_rate_ef_targets(Vector3f& rate_ef_targets) const { - rate_bf_targets = attitude_control->rate_bf_targets(); + // always returns zero vector if landed or disarmed + if (copter.ap.land_complete) { + rate_ef_targets.zero(); + } else { + rate_ef_targets = attitude_control->get_rate_ef_targets(); + } return true; } diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 039f28c674..cee5e405c0 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -687,7 +687,7 @@ private: bool get_wp_distance_m(float &distance) const override; bool get_wp_bearing_deg(float &bearing) const override; bool get_wp_crosstrack_error_m(float &xtrack_error) const override; - bool get_rate_bf_targets(Vector3f& rate_bf_targets) const override; + bool get_rate_ef_targets(Vector3f& rate_ef_targets) const override; // Attitude.cpp void update_throttle_hover();