mirror of https://github.com/ArduPilot/ardupilot
APM_Control: 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.
This commit is contained in:
parent
0c32eeca2e
commit
dd589934cc
|
@ -163,7 +163,7 @@ const char *AP_AutoTune::axis_string(void) const
|
|||
/*
|
||||
one update cycle of the autotuner
|
||||
*/
|
||||
void AP_AutoTune::update(AP_Logger::PID_Info &pinfo, float scaler, float angle_err_deg)
|
||||
void AP_AutoTune::update(AP_PIDInfo &pinfo, float scaler, float angle_err_deg)
|
||||
{
|
||||
if (!running) {
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <AP_Param/AP_Param.h>
|
||||
#include <AP_Vehicle/AP_Vehicle.h>
|
||||
#include <AC_PID/AC_PID.h>
|
||||
#include <Filter/ModeFilter.h>
|
||||
|
||||
class AP_AutoTune
|
||||
{
|
||||
|
@ -54,7 +55,7 @@ public:
|
|||
|
||||
// update called whenever autotune mode is active. This is
|
||||
// called at the main loop rate
|
||||
void update(AP_Logger::PID_Info &pid_info, float scaler, float angle_err_deg);
|
||||
void update(AP_PIDInfo &pid_info, float scaler, float angle_err_deg);
|
||||
|
||||
// are we running?
|
||||
bool running;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <AP_Common/AP_Common.h>
|
||||
#include <AP_Vehicle/AP_Vehicle.h>
|
||||
#include "AP_AutoTune.h"
|
||||
#include <AP_Logger/AP_Logger.h>
|
||||
#include <AP_Math/AP_Math.h>
|
||||
#include <AC_PID/AC_PID.h>
|
||||
|
||||
|
@ -34,7 +33,7 @@ public:
|
|||
void autotune_start(void);
|
||||
void autotune_restore(void);
|
||||
|
||||
const AP_Logger::PID_Info& get_pid_info(void) const
|
||||
const AP_PIDInfo& get_pid_info(void) const
|
||||
{
|
||||
return _pid_info;
|
||||
}
|
||||
|
@ -59,7 +58,7 @@ private:
|
|||
AC_PID rate_pid{0.04, 0.15, 0, 0.345, 0.666, 3, 0, 12, 0.02, 150, 1};
|
||||
float angle_err_deg;
|
||||
|
||||
AP_Logger::PID_Info _pid_info;
|
||||
AP_PIDInfo _pid_info;
|
||||
|
||||
float _get_rate_out(float desired_rate, float scaler, bool disable_integrator, float aspeed, bool ground_mode);
|
||||
float _get_coordination_rate_offset(float &aspeed, bool &inverted) const;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <AP_Common/AP_Common.h>
|
||||
#include <AP_Vehicle/AP_Vehicle.h>
|
||||
#include "AP_AutoTune.h"
|
||||
#include <AP_Logger/AP_Logger.h>
|
||||
#include <AP_Math/AP_Math.h>
|
||||
#include <AC_PID/AC_PID.h>
|
||||
|
||||
|
@ -34,7 +33,7 @@ public:
|
|||
void autotune_start(void);
|
||||
void autotune_restore(void);
|
||||
|
||||
const AP_Logger::PID_Info& get_pid_info(void) const
|
||||
const AP_PIDInfo& get_pid_info(void) const
|
||||
{
|
||||
return _pid_info;
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ private:
|
|||
AC_PID rate_pid{0.08, 0.15, 0, 0.345, 0.666, 3, 0, 12, 0.02, 150, 1};
|
||||
float angle_err_deg;
|
||||
|
||||
AP_Logger::PID_Info _pid_info;
|
||||
AP_PIDInfo _pid_info;
|
||||
|
||||
float _get_rate_out(float desired_rate, float scaler, bool disable_integrator, bool ground_mode);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <AP_Common/AP_Common.h>
|
||||
#include <AP_Vehicle/AP_Vehicle.h>
|
||||
#include <AP_Logger/AP_Logger.h>
|
||||
#include <AC_PID/AP_PIDInfo.h>
|
||||
|
||||
class AP_SteerController {
|
||||
public:
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
|
||||
const AP_Logger::PID_Info& get_pid_info(void) const { return _pid_info; }
|
||||
const class AP_PIDInfo& get_pid_info(void) const { return _pid_info; }
|
||||
|
||||
void set_reverse(bool reverse) {
|
||||
_reverse = reverse;
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
AP_Float _deratefactor;
|
||||
AP_Float _mindegree;
|
||||
|
||||
AP_Logger::PID_Info _pid_info {};
|
||||
AP_PIDInfo _pid_info {};
|
||||
|
||||
bool _reverse;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <AP_Common/AP_Common.h>
|
||||
#include <AP_Vehicle/AP_Vehicle.h>
|
||||
#include <AP_Logger/AP_Logger.h>
|
||||
#include <AC_PID/AC_PID.h>
|
||||
#include "AP_AutoTune.h"
|
||||
|
||||
|
@ -36,7 +35,7 @@ public:
|
|||
_pid_info.I *= 0.995f;
|
||||
}
|
||||
|
||||
const AP_Logger::PID_Info& get_pid_info(void) const
|
||||
const AP_PIDInfo& get_pid_info(void) const
|
||||
{
|
||||
return _pid_info;
|
||||
}
|
||||
|
@ -69,5 +68,5 @@ private:
|
|||
AP_AutoTune *autotune;
|
||||
bool failed_autotune_alloc;
|
||||
|
||||
AP_Logger::PID_Info _pid_info;
|
||||
AP_PIDInfo _pid_info;
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
AC_PID& get_steering_rate_pid() { return _steer_rate_pid; }
|
||||
AC_PID& get_pitch_to_throttle_pid() { return _pitch_to_throttle_pid; }
|
||||
AC_PID& get_sailboat_heel_pid() { return _sailboat_heel_pid; }
|
||||
const AP_Logger::PID_Info& get_throttle_speed_pid_info() const { return _throttle_speed_pid_info; }
|
||||
const AP_PIDInfo& get_throttle_speed_pid_info() const { return _throttle_speed_pid_info; }
|
||||
|
||||
// get forward speed in m/s (earth-frame horizontal velocity but only along vehicle x-axis). returns true on success
|
||||
bool get_forward_speed(float &speed) const;
|
||||
|
@ -143,7 +143,7 @@ private:
|
|||
uint32_t _stop_last_ms; // system time the vehicle was at a complete stop
|
||||
bool _throttle_limit_low; // throttle output was limited from going too low (used to reduce i-term buildup)
|
||||
bool _throttle_limit_high; // throttle output was limited from going too high (used to reduce i-term buildup)
|
||||
AP_Logger::PID_Info _throttle_speed_pid_info; // local copy of throttle_speed controller's PID info to allow reporting of unusual FF
|
||||
AP_PIDInfo _throttle_speed_pid_info; // local copy of throttle_speed controller's PID info to allow reporting of unusual FF
|
||||
|
||||
// balancebot pitch control
|
||||
uint32_t _balance_last_ms = 0;
|
||||
|
|
Loading…
Reference in New Issue