PX4 Firmware
PX4 Autopilot Software http://px4.io
pid.h File Reference

Definition of generic PID controller. More...

#include <stdint.h>
Include dependency graph for pid.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PID_t
 

Typedefs

typedef __BEGIN_DECLS enum PID_MODE pid_mode_t
 

Enumerations

enum  PID_MODE { PID_MODE_DERIVATIV_NONE = 0, PID_MODE_DERIVATIV_CALC, PID_MODE_DERIVATIV_CALC_NO_SP, PID_MODE_DERIVATIV_SET }
 

Functions

__EXPORT void pid_init (PID_t *pid, pid_mode_t mode, float dt_min)
 
__EXPORT int pid_set_parameters (PID_t *pid, float kp, float ki, float kd, float integral_limit, float output_limit)
 
__EXPORT float pid_calculate (PID_t *pid, float sp, float val, float val_dot, float dt)
 
__EXPORT void pid_reset_integral (PID_t *pid)
 

Detailed Description

Typedef Documentation

◆ pid_mode_t

Enumeration Type Documentation

◆ PID_MODE

enum PID_MODE
Enumerator
PID_MODE_DERIVATIV_NONE 
PID_MODE_DERIVATIV_CALC 
PID_MODE_DERIVATIV_CALC_NO_SP 
PID_MODE_DERIVATIV_SET 

Definition at line 58 of file pid.h.

Function Documentation

◆ pid_calculate()

__EXPORT float pid_calculate ( PID_t pid,
float  sp,
float  val,
float  val_dot,
float  dt 
)

Definition at line 113 of file pid.cpp.

References dt, PID_t::dt_min, PID_t::error_previous, PID_t::integral, PID_t::integral_limit, PID_t::kd, PID_t::ki, PID_t::kp, PID_t::last_output, PID_t::mode, PID_t::output_limit, PID_MODE_DERIVATIV_CALC, PID_MODE_DERIVATIV_CALC_NO_SP, PID_MODE_DERIVATIV_SET, and SIGMA.

Referenced by RoverPositionControl::control_position(), and RoverPositionControl::control_velocity().

Here is the caller graph for this function:

◆ pid_init()

__EXPORT void pid_init ( PID_t pid,
pid_mode_t  mode,
float  dt_min 
)

Definition at line 57 of file pid.cpp.

References PID_t::dt_min, PID_t::error_previous, PID_t::integral, PID_t::integral_limit, PID_t::kd, PID_t::ki, PID_t::kp, PID_t::last_output, PID_t::mode, and PID_t::output_limit.

Referenced by RoverPositionControl::~RoverPositionControl().

Here is the caller graph for this function:

◆ pid_reset_integral()

__EXPORT void pid_reset_integral ( PID_t pid)

Definition at line 182 of file pid.cpp.

References PID_t::integral.

◆ pid_set_parameters()

__EXPORT int pid_set_parameters ( PID_t pid,
float  kp,
float  ki,
float  kd,
float  integral_limit,
float  output_limit 
)

Definition at line 71 of file pid.cpp.

References PID_t::integral_limit, PID_t::kd, PID_t::ki, PID_t::kp, and PID_t::output_limit.

Referenced by RoverPositionControl::~RoverPositionControl().

Here is the caller graph for this function: