-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpid.h
More file actions
33 lines (27 loc) · 729 Bytes
/
pid.h
File metadata and controls
33 lines (27 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef PID_H
#define PID_H
//C++から呼び出すため
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pid{
double input;//入力値
double setpoint;//目標値
int output; //操作量(milliseconds) -100~100
unsigned int lastTime;//前回の時間
double Kp;//propotional constant
double Ki; //integral constant
double Kd;//differential constant
double integral;
double differential;
double prev_error;//前の偏差
} Pid;
int pid_limiter(Pid* pid_limits);
int compute_output(Pid* pid_comp);
int pid_initialize(Pid* pid_init);
int pid_const_initialize(Pid* pid_init, double setpoint,
double kp_value, double ki_value, double kd_value);
#ifdef __cplusplus
}
#endif
#endif