APM:Libraries
Classes | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AC_PID Class Reference

Copter PID control class. More...

#include <AC_PID.h>

Inheritance diagram for AC_PID:
[legend]
Collaboration diagram for AC_PID:
[legend]

Classes

struct  ac_pid_flags
 

Public Member Functions

 AC_PID (float initial_p, float initial_i, float initial_d, float initial_imax, float initial_filt_hz, float dt, float initial_ff=0)
 
void set_dt (float dt)
 
void set_input_filter_all (float input)
 
void set_input_filter_d (float input)
 
float get_pid ()
 
float get_pi ()
 
float get_p ()
 
float get_i ()
 
float get_d ()
 
float get_ff (float requested_rate)
 
void reset_I ()
 
void reset_filter ()
 
void load_gains ()
 
void save_gains ()
 
void operator() (float p, float i, float d, float imaxval, float input_filt_hz, float dt, float ffval=0)
 operator function call for easy initialisation More...
 
AP_Float & kP ()
 
AP_Float & kI ()
 
AP_Float & kD ()
 
AP_Float & filt_hz ()
 
float imax () const
 
float get_filt_alpha () const
 
float ff () const
 
void kP (const float v)
 
void kI (const float v)
 
void kD (const float v)
 
void imax (const float v)
 
void filt_hz (const float v)
 
void ff (const float v)
 
float get_integrator () const
 
void set_integrator (float i)
 
void set_desired_rate (float desired)
 
const DataFlash_Class::PID_Infoget_pid_info (void) const
 

Static Public Attributes

static const struct AP_Param::GroupInfo var_info []
 

Protected Attributes

AP_Float _kp
 
AP_Float _ki
 
AP_Float _kd
 
AP_Float _imax
 
AP_Float _filt_hz
 
AP_Float _ff
 
struct AC_PID::ac_pid_flags _flags
 
float _dt
 
float _integrator
 
float _input
 
float _derivative
 
DataFlash_Class::PID_Info _pid_info
 

Detailed Description

Copter PID control class.

Definition at line 17 of file AC_PID.h.

Constructor & Destructor Documentation

◆ AC_PID()

AC_PID::AC_PID ( float  initial_p,
float  initial_i,
float  initial_d,
float  initial_imax,
float  initial_filt_hz,
float  dt,
float  initial_ff = 0 
)

Definition at line 46 of file AC_PID.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ ff() [1/2]

float AC_PID::ff ( ) const
inline

Definition at line 66 of file AC_PID.h.

◆ ff() [2/2]

void AC_PID::ff ( const float  v)
inline

Definition at line 74 of file AC_PID.h.

◆ filt_hz() [1/2]

AP_Float& AC_PID::filt_hz ( )
inline

Definition at line 63 of file AC_PID.h.

Referenced by AC_PID(), and imax().

Here is the caller graph for this function:

◆ filt_hz() [2/2]

void AC_PID::filt_hz ( const float  v)

Definition at line 76 of file AC_PID.cpp.

Here is the call graph for this function:

◆ get_d()

float AC_PID::get_d ( )

◆ get_ff()

float AC_PID::get_ff ( float  requested_rate)

◆ get_filt_alpha()

float AC_PID::get_filt_alpha ( ) const

Definition at line 217 of file AC_PID.cpp.

Referenced by imax(), AC_AttitudeControl::max_rate_step_bf_pitch(), AC_AttitudeControl::max_rate_step_bf_roll(), AC_AttitudeControl::max_rate_step_bf_yaw(), set_input_filter_all(), and set_input_filter_d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_i()

float AC_PID::get_i ( )

Definition at line 140 of file AC_PID.cpp.

Referenced by get_pi(), get_pid(), AR_AttitudeControl::get_steering_out_rate(), AR_AttitudeControl::get_throttle_out_speed(), loop(), AC_AttitudeControl_Heli::rate_bf_to_motor_roll_pitch(), AC_AttitudeControl::rate_target_to_motor_pitch(), AC_AttitudeControl::rate_target_to_motor_roll(), AC_AttitudeControl_Heli::rate_target_to_motor_yaw(), AC_AttitudeControl::rate_target_to_motor_yaw(), AC_PosControl::run_z_controller(), and AP_Winch_Servo::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_integrator()

float AC_PID::get_integrator ( ) const
inline

◆ get_p()

float AC_PID::get_p ( )

◆ get_pi()

float AC_PID::get_pi ( )

Definition at line 169 of file AC_PID.cpp.

Here is the call graph for this function:

◆ get_pid()

float AC_PID::get_pid ( )

Definition at line 174 of file AC_PID.cpp.

Here is the call graph for this function:

◆ get_pid_info()

const DataFlash_Class::PID_Info& AC_PID::get_pid_info ( void  ) const
inline

Definition at line 82 of file AC_PID.h.

Referenced by AC_AttitudeControl::control_monitor_update().

Here is the caller graph for this function:

◆ imax() [1/2]

float AC_PID::imax ( ) const
inline

Definition at line 64 of file AC_PID.h.

Referenced by loop(), and AC_PosControl::run_z_controller().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ imax() [2/2]

void AC_PID::imax ( const float  v)
inline

Definition at line 72 of file AC_PID.h.

Here is the call graph for this function:

◆ kD() [1/2]

AP_Float& AC_PID::kD ( )
inline

Definition at line 62 of file AC_PID.h.

Referenced by loop(), AC_AttitudeControl::max_rate_step_bf_pitch(), AC_AttitudeControl::max_rate_step_bf_roll(), and AC_AttitudeControl::max_rate_step_bf_yaw().

Here is the caller graph for this function:

◆ kD() [2/2]

void AC_PID::kD ( const float  v)
inline

Definition at line 71 of file AC_PID.h.

◆ kI() [1/2]

AP_Float& AC_PID::kI ( )
inline

Definition at line 61 of file AC_PID.h.

Referenced by loop().

Here is the caller graph for this function:

◆ kI() [2/2]

void AC_PID::kI ( const float  v)
inline

Definition at line 70 of file AC_PID.h.

◆ kP() [1/2]

AP_Float& AC_PID::kP ( )
inline

Definition at line 60 of file AC_PID.h.

Referenced by loop(), AC_AttitudeControl::max_rate_step_bf_pitch(), AC_AttitudeControl::max_rate_step_bf_roll(), and AC_AttitudeControl::max_rate_step_bf_yaw().

Here is the caller graph for this function:

◆ kP() [2/2]

void AC_PID::kP ( const float  v)
inline

Definition at line 69 of file AC_PID.h.

◆ load_gains()

void AC_PID::load_gains ( )

Definition at line 184 of file AC_PID.cpp.

Referenced by reset_filter().

Here is the caller graph for this function:

◆ operator()()

void AC_PID::operator() ( float  p,
float  i,
float  d,
float  imaxval,
float  input_filt_hz,
float  dt,
float  ffval = 0 
)

operator function call for easy initialisation

Overload the function call operator to permit easy initialisation.

Definition at line 205 of file AC_PID.cpp.

Referenced by reset_filter().

Here is the caller graph for this function:

◆ reset_filter()

void AC_PID::reset_filter ( )
inline

Definition at line 48 of file AC_PID.h.

Referenced by AR_AttitudeControl::get_steering_out_rate(), and AR_AttitudeControl::get_throttle_out_speed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_I()

void AC_PID::reset_I ( )

Definition at line 179 of file AC_PID.cpp.

Referenced by AC_AttitudeControl::relax_attitude_controllers(), and AC_AttitudeControl::reset_rate_controller_I_terms().

Here is the caller graph for this function:

◆ save_gains()

void AC_PID::save_gains ( )

Definition at line 195 of file AC_PID.cpp.

Referenced by reset_filter().

Here is the caller graph for this function:

◆ set_desired_rate()

void AC_PID::set_desired_rate ( float  desired)
inline

◆ set_dt()

void AC_PID::set_dt ( float  dt)

Definition at line 69 of file AC_PID.cpp.

Referenced by AR_AttitudeControl::get_steering_out_rate(), AR_AttitudeControl::get_throttle_out_speed(), and AC_PosControl::set_dt().

Here is the caller graph for this function:

◆ set_input_filter_all()

void AC_PID::set_input_filter_all ( float  input)

Definition at line 87 of file AC_PID.cpp.

Referenced by AR_AttitudeControl::get_steering_out_rate(), AR_AttitudeControl::get_throttle_out_speed(), loop(), AC_AttitudeControl_Heli::rate_bf_to_motor_roll_pitch(), AC_AttitudeControl_Heli::rate_target_to_motor_yaw(), AC_AttitudeControl::rate_target_to_motor_yaw(), AC_PosControl::run_z_controller(), and AP_Winch_Servo::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_input_filter_d()

void AC_PID::set_input_filter_d ( float  input)

Definition at line 112 of file AC_PID.cpp.

Referenced by AC_AttitudeControl::rate_target_to_motor_pitch(), and AC_AttitudeControl::rate_target_to_motor_roll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_integrator()

void AC_PID::set_integrator ( float  i)
inline

Definition at line 77 of file AC_PID.h.

Referenced by AC_PosControl::init_takeoff(), AC_AttitudeControl_Heli::rate_bf_to_motor_roll_pitch(), and AC_PosControl::relax_alt_hold_controllers().

Here is the caller graph for this function:

Member Data Documentation

◆ _derivative

float AC_PID::_derivative
protected

Definition at line 106 of file AC_PID.h.

Referenced by get_d(), set_input_filter_all(), and set_input_filter_d().

◆ _dt

float AC_PID::_dt
protected

◆ _ff

AP_Float AC_PID::_ff
protected

Definition at line 95 of file AC_PID.h.

Referenced by AC_PID(), ff(), get_ff(), and operator()().

◆ _filt_hz

AP_Float AC_PID::_filt_hz
protected

Definition at line 94 of file AC_PID.h.

Referenced by filt_hz(), get_filt_alpha(), load_gains(), operator()(), and save_gains().

◆ _flags

struct AC_PID::ac_pid_flags AC_PID::_flags
protected

◆ _imax

AP_Float AC_PID::_imax
protected

Definition at line 93 of file AC_PID.h.

Referenced by AC_PID(), get_i(), AC_HELI_PID::get_leaky_i(), imax(), load_gains(), operator()(), and save_gains().

◆ _input

float AC_PID::_input
protected

◆ _integrator

float AC_PID::_integrator
protected

Definition at line 104 of file AC_PID.h.

Referenced by get_i(), get_integrator(), AC_HELI_PID::get_leaky_i(), reset_I(), and set_integrator().

◆ _kd

AP_Float AC_PID::_kd
protected

Definition at line 92 of file AC_PID.h.

Referenced by AC_PID(), get_d(), kD(), load_gains(), operator()(), and save_gains().

◆ _ki

AP_Float AC_PID::_ki
protected

Definition at line 91 of file AC_PID.h.

Referenced by AC_PID(), get_i(), AC_HELI_PID::get_leaky_i(), kI(), load_gains(), operator()(), and save_gains().

◆ _kp

AP_Float AC_PID::_kp
protected

Definition at line 90 of file AC_PID.h.

Referenced by AC_PID(), get_p(), kP(), load_gains(), operator()(), and save_gains().

◆ _pid_info

DataFlash_Class::PID_Info AC_PID::_pid_info
protected

◆ var_info

const AP_Param::GroupInfo AC_PID::var_info
static

Definition at line 85 of file AC_PID.h.

Referenced by AC_PID().


The documentation for this class was generated from the following files: