From 8ec0eed74908daa7e3c6e32b0ff3e2e6d006b907 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 4 Mar 2022 14:29:46 +1100 Subject: [PATCH] AP_Landing: stop libraries including AP_Logger.h in .h files AP_Logger.h is a nexus of includes; while this is being improved over time, there's no reason for the library headers to include AP_Logger.h as the logger itself is access by singleton and the structures are in LogStructure.h This necessitated moving The PID_Info structure out of AP_Logger's namespace. This cleans up a pretty nasty bit - that structure is definitely not simply used for logging, but also used to pass pid information around to controllers! There are a lot of patches in here because AP_Logger.h, acting as a nexus, was providing transitive header file inclusion in many (some unlikely!) places. --- libraries/AP_Landing/AP_Landing.cpp | 2 +- libraries/AP_Landing/AP_Landing.h | 2 +- libraries/AP_Landing/AP_Landing_Deepstall.cpp | 5 +++-- libraries/AP_Landing/AP_Landing_Deepstall.h | 2 +- libraries/AP_Landing/AP_Landing_Slope.cpp | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/AP_Landing/AP_Landing.cpp b/libraries/AP_Landing/AP_Landing.cpp index 588f92977e..2ceb1d2b37 100644 --- a/libraries/AP_Landing/AP_Landing.cpp +++ b/libraries/AP_Landing/AP_Landing.cpp @@ -408,7 +408,7 @@ bool AP_Landing::override_servos(void) { // returns a PID_Info object if there is one available for the selected landing // type, otherwise returns a nullptr, indicating no data to be logged/sent -const AP_Logger::PID_Info* AP_Landing::get_pid_info(void) const +const AP_PIDInfo* AP_Landing::get_pid_info(void) const { switch (type) { #if HAL_LANDING_DEEPSTALL_ENABLED diff --git a/libraries/AP_Landing/AP_Landing.h b/libraries/AP_Landing/AP_Landing.h index 1715bb3b50..6b7d1621e6 100644 --- a/libraries/AP_Landing/AP_Landing.h +++ b/libraries/AP_Landing/AP_Landing.h @@ -109,7 +109,7 @@ public: void set_initial_slope(void) { initial_slope = slope; } bool is_expecting_impact(void) const; void Log(void) const; - const AP_Logger::PID_Info * get_pid_info(void) const; + const AP_PIDInfo * get_pid_info(void) const; // landing altitude offset (meters) float alt_offset; diff --git a/libraries/AP_Landing/AP_Landing_Deepstall.cpp b/libraries/AP_Landing/AP_Landing_Deepstall.cpp index 8d77174122..fe49370897 100644 --- a/libraries/AP_Landing/AP_Landing_Deepstall.cpp +++ b/libraries/AP_Landing/AP_Landing_Deepstall.cpp @@ -26,6 +26,7 @@ #include #include #include +#include // table of user settable parameters for deepstall const AP_Param::GroupInfo AP_Landing_Deepstall::var_info[] = { @@ -448,13 +449,13 @@ bool AP_Landing_Deepstall::send_deepstall_message(mavlink_channel_t chan) const return true; } -const AP_Logger::PID_Info& AP_Landing_Deepstall::get_pid_info(void) const +const AP_PIDInfo& AP_Landing_Deepstall::get_pid_info(void) const { return ds_PID.get_pid_info(); } void AP_Landing_Deepstall::Log(void) const { - const AP_Logger::PID_Info& pid_info = ds_PID.get_pid_info(); + const AP_PIDInfo& pid_info = ds_PID.get_pid_info(); struct log_DSTL pkt = { LOG_PACKET_HEADER_INIT(LOG_DSTL_MSG), time_us : AP_HAL::micros64(), diff --git a/libraries/AP_Landing/AP_Landing_Deepstall.h b/libraries/AP_Landing/AP_Landing_Deepstall.h index b8b90686b8..b668054855 100644 --- a/libraries/AP_Landing/AP_Landing_Deepstall.h +++ b/libraries/AP_Landing/AP_Landing_Deepstall.h @@ -100,7 +100,7 @@ private: bool send_deepstall_message(mavlink_channel_t chan) const; - const AP_Logger::PID_Info& get_pid_info(void) const; + const AP_PIDInfo& get_pid_info(void) const; //private helpers void build_approach_path(bool use_current_heading); diff --git a/libraries/AP_Landing/AP_Landing_Slope.cpp b/libraries/AP_Landing/AP_Landing_Slope.cpp index 4f624af2e9..657dedb19d 100644 --- a/libraries/AP_Landing/AP_Landing_Slope.cpp +++ b/libraries/AP_Landing/AP_Landing_Slope.cpp @@ -23,6 +23,7 @@ #include #include #include +#include void AP_Landing::type_slope_do_land(const AP_Mission::Mission_Command& cmd, const float relative_altitude) {