PX4 Firmware
PX4 Autopilot Software http://px4.io
pid.cpp File Reference
#include "pid.h"
#include <math.h>
#include <px4_platform_common/defines.h>
Include dependency graph for pid.cpp:

Go to the source code of this file.

Macros

#define SIGMA   0.000001f
 

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)
 

Macro Definition Documentation

◆ SIGMA

#define SIGMA   0.000001f

Definition at line 55 of file pid.cpp.

Referenced by pid_calculate().

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: