From 9412075b9c447103b9614d6bcd4c7a73ba21335a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 9 Jul 2019 16:05:42 +1000 Subject: [PATCH] Copter: avoidance no longer takes ahrs in constructor --- ArduCopter/Copter.h | 2 +- ArduCopter/avoidance_adsb.cpp | 2 +- ArduCopter/avoidance_adsb.h | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 7727338abc..1dd4d988d8 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -545,7 +545,7 @@ private: AP_ADSB adsb; // avoidance of adsb enabled vehicles (normally manned vehicles) - AP_Avoidance_Copter avoidance_adsb{ahrs, adsb}; + AP_Avoidance_Copter avoidance_adsb{adsb}; #endif // last valid RC input time diff --git a/ArduCopter/avoidance_adsb.cpp b/ArduCopter/avoidance_adsb.cpp index 7eaffe81be..6e90d79d77 100644 --- a/ArduCopter/avoidance_adsb.cpp +++ b/ArduCopter/avoidance_adsb.cpp @@ -169,7 +169,7 @@ bool AP_Avoidance_Copter::handle_avoidance_vertical(const AP_Avoidance::Obstacle // decide on whether we should climb or descend bool should_climb = false; Location my_loc; - if (_ahrs.get_position(my_loc)) { + if (AP::ahrs().get_position(my_loc)) { should_climb = my_loc.alt > obstacle->_location.alt; } diff --git a/ArduCopter/avoidance_adsb.h b/ArduCopter/avoidance_adsb.h index 0ca023f241..d646d1303a 100644 --- a/ArduCopter/avoidance_adsb.h +++ b/ArduCopter/avoidance_adsb.h @@ -8,10 +8,8 @@ // functionality - for example, not doing anything while landed. class AP_Avoidance_Copter : public AP_Avoidance { public: - AP_Avoidance_Copter(AP_AHRS &ahrs, class AP_ADSB &adsb) - : AP_Avoidance(ahrs, adsb) - { - } + + using AP_Avoidance::AP_Avoidance; /* Do not allow copies */ AP_Avoidance_Copter(const AP_Avoidance_Copter &other) = delete;