dror balbul
/
pidtaurd
taurd for noam
Diff: PID.h
- Revision:
- 2:fd1023193cc4
diff -r c48bef0d5d3c -r fd1023193cc4 PID.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PID.h Fri Dec 20 16:29:33 2019 +0000 @@ -0,0 +1,48 @@ + +#ifndef PID_H +#define PID_H + +#include <stdbool.h> +#include <stdint.h> + +typedef struct +{ // Input, output and setpoint + float * input; + float * output; + float * setpoint; + // Tuning parameters + float Kp; + float Ki; + float Kd; + // Output minimum and maximum values + float minOutput; + float maxOutput; + // Variables for PID algorithm + float sumError; + float lastInput; + float lastError; +}pid; + +#ifdef __cplusplus +extern "C" { +#endif + + pid* pid_create(pid* pid, float* input, float* output, float* setoint, float kp, float ki, float kd); + + void pid_compute(pid* pid); + + + void pid_tune(pid* pid, float kp, float ki, float kd); + + + void pid_limits(pid* pid, float min, float max); + + + +#ifdef __cplusplus +} +#endif + +#endif +// End of Header file +