Browse Source

AC_PID: use set_and_defualt to set defualt values

apm_2208
Iampete1 3 years ago committed by Andrew Tridgell
parent
commit
3f84ba12c0
  1. 2
      libraries/AC_PID/AC_P.h
  2. 6
      libraries/AC_PID/AC_PI.cpp
  3. 20
      libraries/AC_PID/AC_PID.cpp
  4. 14
      libraries/AC_PID/AC_PID_2D.cpp
  5. 14
      libraries/AC_PID/AC_PID_Basic.cpp
  6. 7
      libraries/AC_PID/AC_PI_2D.cpp
  7. 2
      libraries/AC_PID/AC_P_1D.cpp
  8. 2
      libraries/AC_PID/AC_P_2D.cpp

2
libraries/AC_PID/AC_P.h

@ -23,7 +23,7 @@ public: @@ -23,7 +23,7 @@ public:
AC_P(const float &initial_p = 0.0f)
{
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_kp.set_and_default(initial_p);
}
CLASS_NO_COPY(AC_P);

6
libraries/AC_PID/AC_PI.cpp

@ -30,9 +30,9 @@ AC_PI::AC_PI(float initial_p, float initial_i, float initial_imax) @@ -30,9 +30,9 @@ AC_PI::AC_PI(float initial_p, float initial_i, float initial_imax)
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
kP.set(initial_p);
kI.set(initial_i);
imax.set(initial_imax);
kP.set_and_default(initial_p);
kI.set_and_default(initial_i);
imax.set_and_default(initial_imax);
}
float AC_PI::update(float measurement, float target, float dt)

20
libraries/AC_PID/AC_PID.cpp

@ -75,16 +75,16 @@ AC_PID::AC_PID(float initial_p, float initial_i, float initial_d, float initial_ @@ -75,16 +75,16 @@ AC_PID::AC_PID(float initial_p, float initial_i, float initial_d, float initial_
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_ki = initial_i;
_kd = initial_d;
_kff = initial_ff;
_kimax = fabsf(initial_imax);
filt_T_hz(initial_filt_T_hz);
filt_E_hz(initial_filt_E_hz);
filt_D_hz(initial_filt_D_hz);
_slew_rate_max.set(initial_srmax);
_slew_rate_tau.set(initial_srtau);
_kp.set_and_default(initial_p);
_ki.set_and_default(initial_i);
_kd.set_and_default(initial_d);
_kff.set_and_default(initial_ff);
_kimax.set_and_default(initial_imax);
_filt_T_hz.set_and_default(initial_filt_T_hz);
_filt_E_hz.set_and_default(initial_filt_E_hz);
_filt_D_hz.set_and_default(initial_filt_D_hz);
_slew_rate_max.set_and_default(initial_srmax);
_slew_rate_tau.set_and_default(initial_srtau);
// reset input filter to first value received
_flags._reset_filter = true;

14
libraries/AC_PID/AC_PID_2D.cpp

@ -56,13 +56,13 @@ AC_PID_2D::AC_PID_2D(float initial_kP, float initial_kI, float initial_kD, float @@ -56,13 +56,13 @@ AC_PID_2D::AC_PID_2D(float initial_kP, float initial_kI, float initial_kD, float
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_kP;
_ki = initial_kI;
_kd = initial_kD;
_kff = initial_kFF;
_kimax = fabsf(initial_imax);
filt_E_hz(initial_filt_E_hz);
filt_D_hz(initial_filt_D_hz);
_kp.set_and_default(initial_kP);
_ki.set_and_default(initial_kI);
_kd.set_and_default(initial_kD);
_kff.set_and_default(initial_kFF);
_kimax.set_and_default(initial_imax);
_filt_E_hz.set_and_default(initial_filt_E_hz);
_filt_D_hz.set_and_default(initial_filt_D_hz);
// reset input filter to first value received
_reset_filter = true;

14
libraries/AC_PID/AC_PID_Basic.cpp

@ -58,13 +58,13 @@ AC_PID_Basic::AC_PID_Basic(float initial_p, float initial_i, float initial_d, fl @@ -58,13 +58,13 @@ AC_PID_Basic::AC_PID_Basic(float initial_p, float initial_i, float initial_d, fl
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_ki = initial_i;
_kd = initial_d;
_kff = initial_ff;
_kimax = fabsf(initial_imax);
filt_E_hz(initial_filt_E_hz);
filt_D_hz(initial_filt_D_hz);
_kp.set_and_default(initial_p);
_ki.set_and_default(initial_i);
_kd.set_and_default(initial_d);
_kff.set_and_default(initial_ff);
_kimax.set_and_default(initial_imax);
_filt_E_hz.set_and_default(initial_filt_E_hz);
_filt_D_hz.set_and_default(initial_filt_D_hz);
// reset input filter to first value received
_reset_filter = true;

7
libraries/AC_PID/AC_PI_2D.cpp

@ -36,9 +36,10 @@ AC_PI_2D::AC_PI_2D(float initial_p, float initial_i, float initial_imax, float i @@ -36,9 +36,10 @@ AC_PI_2D::AC_PI_2D(float initial_p, float initial_i, float initial_imax, float i
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_ki = initial_i;
_imax = fabsf(initial_imax);
_kp.set_and_default(initial_p);
_ki.set_and_default(initial_i);
_imax.set_and_default(initial_imax);
_filt_hz.set_and_default(initial_filt_hz);
filt_hz(initial_filt_hz);
// reset input filter to first value received

2
libraries/AC_PID/AC_P_1D.cpp

@ -19,7 +19,7 @@ AC_P_1D::AC_P_1D(float initial_p, float dt) : @@ -19,7 +19,7 @@ AC_P_1D::AC_P_1D(float initial_p, float dt) :
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_kp.set_and_default(initial_p);
}
// update_all - set target and measured inputs to P controller and calculate outputs

2
libraries/AC_PID/AC_P_2D.cpp

@ -19,7 +19,7 @@ AC_P_2D::AC_P_2D(float initial_p, float dt) : @@ -19,7 +19,7 @@ AC_P_2D::AC_P_2D(float initial_p, float dt) :
// load parameter values from eeprom
AP_Param::setup_object_defaults(this, var_info);
_kp = initial_p;
_kp.set_and_default(initial_p);
}
// update_all - set target and measured inputs to P controller and calculate outputs

Loading…
Cancel
Save