First files added
This commit is contained in:
41
firmware/Core/Inc/pid.h
Normal file
41
firmware/Core/Inc/pid.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* pid.h
|
||||
*
|
||||
* Created on: Jan 18, 2022
|
||||
* Author: mcfly
|
||||
*/
|
||||
|
||||
#ifndef INC_PID_H_
|
||||
#define INC_PID_H_
|
||||
|
||||
|
||||
typedef struct {
|
||||
//Controller gains
|
||||
float Kp;
|
||||
float Ki;
|
||||
float Kd;
|
||||
|
||||
//Derivative low-pass filter time constant
|
||||
float tau;
|
||||
|
||||
//Output limits
|
||||
float limMin;
|
||||
float limMax;
|
||||
|
||||
//Sample time in seconds
|
||||
float T;
|
||||
|
||||
//Controller "memory"
|
||||
float integrator;
|
||||
float prevError; //required for integrator
|
||||
float differentiator;
|
||||
float prevMeasurement; //required for differentiator
|
||||
|
||||
//Controller output
|
||||
float out;
|
||||
} PIDController;
|
||||
|
||||
void PID_Init(PIDController *pid);
|
||||
float PID_Update(PIDController *pid, float setpoint, float measurement);
|
||||
|
||||
#endif /* INC_PID_H_ */
|
Reference in New Issue
Block a user