Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86482070
pid.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Oct 6, 18:26
Size
1 KB
Mime Type
text/x-c
Expires
Tue, Oct 8, 18:26 (2 d)
Engine
blob
Format
Raw Data
Handle
21428636
Attached To
R2671 HHRI-software
pid.h
View Options
#ifndef __PID_H
#define __PID_H
#include "../main.h"
/** @defgroup PID Lib / PID regulator
* @brief Proportionnal-integral-derivative regulator with integrator
* saturation capability.
*
* First, instantiate a pid_Pid structure (e.g. "pid_Pid pid;"), then
* initialize it once with pid_Init(). Then, every time a new command needs to
* be computed (typically when a new measurement arrives), call pid_Step().
*
* @addtogroup PID
* @{
*/
/**
*@brief PID regulator structure
*/
typedef struct
{
float32_t kp, ///< Proportional coefficient.
ki, ///< Integral coefficient. Disabled if negative or zero.
kd, ///< Derivative coefficient.
arw, ///< Max value of the integrator ("anti-reset windup"). Disabled if negative or zero.
previousErr, ///< Error (current-target) at the previous timestep, for derivative computation.
integrator, ///< Integrator value for the integral part of the PID.
command, ///< Output command computed by the PID regulator.
feedforward; ///< Feedforward coefficient.
} pid_Pid;
void pid_Init(pid_Pid *pid, float32_t kp, float32_t ki, float32_t kd,
float32_t arw, float32_t feedforward);
float32_t pid_Step(pid_Pid *pid, float32_t current, float32_t target, float32_t dt);
/**
* @}
*/
#endif
Event Timeline
Log In to Comment