liba
0.1.15
An algorithm library based on C/C++
Toggle main menu visibility
Loading...
Searching...
No Matches
pid.h
Go to the documentation of this file.
1
28
29
#ifndef LIBA_PID_H
30
#define LIBA_PID_H
31
32
#include "
a.h
"
33
39
40
typedef
struct
a_pid
a_pid
;
41
42
#if defined(__cplusplus)
43
extern
"C"
{
44
#endif
/* __cplusplus */
45
50
#define a_pid_init(ctx) a_pid_zero(ctx)
51
59
A_EXTERN
void
a_pid_set_kpid
(
a_pid
*ctx,
a_real
kp
,
a_real
ki
,
a_real
kd
);
60
68
A_EXTERN
a_real
a_pid_run
(
a_pid
*ctx,
a_real
set,
a_real
fdb
);
69
77
A_EXTERN
a_real
a_pid_pos
(
a_pid
*ctx,
a_real
set,
a_real
fdb
);
78
86
A_EXTERN
a_real
a_pid_inc
(
a_pid
*ctx,
a_real
set,
a_real
fdb
);
87
92
A_EXTERN
void
a_pid_zero
(
a_pid
*ctx);
93
94
#if defined(__cplusplus)
95
}
/* extern "C" */
96
namespace
a
97
{
98
typedef
struct
a_pid pid;
99
}
/* namespace a */
100
#endif
/* __cplusplus */
101
105
struct
a_pid
106
{
107
a_real
kp
;
108
a_real
ki
;
109
a_real
kd
;
110
a_real
summax
;
111
a_real
summin
;
112
a_real
sum
;
113
a_real
outmax
;
114
a_real
outmin
;
115
a_real
out
;
116
a_real
var
;
117
a_real
fdb
;
118
a_real
err
;
119
#if defined(__cplusplus)
120
A_INLINE
void
init() {
a_pid_init
(
this
); }
121
A_INLINE
void
set_kpid(
a_real
kp_,
a_real
ki_,
a_real
kd_)
122
{
123
a_pid_set_kpid
(
this
, kp_, ki_, kd_);
124
}
125
A_INLINE
a_real
run(
a_real
set,
a_real
fdb_)
126
{
127
return
a_pid_run
(
this
, set, fdb_);
128
}
129
A_INLINE
a_real
pos(
a_real
set,
a_real
fdb_)
130
{
131
return
a_pid_pos
(
this
, set, fdb_);
132
}
133
A_INLINE
a_real
inc(
a_real
set,
a_real
fdb_)
134
{
135
return
a_pid_inc
(
this
, set, fdb_);
136
}
137
A_INLINE
void
zero() {
a_pid_zero
(
this
); }
138
#endif
/* __cplusplus */
139
};
140
142
143
#endif
/* a/pid.h */
a.h
algorithm library
a_pid_init
#define a_pid_init(ctx)
initialize for PID controller
Definition
pid.h:50
a_pid_run
a_real a_pid_run(a_pid *ctx, a_real set, a_real fdb)
compute for PID controller
a_pid_pos
a_real a_pid_pos(a_pid *ctx, a_real set, a_real fdb)
compute for positional PID controller
a_pid_set_kpid
void a_pid_set_kpid(a_pid *ctx, a_real kp, a_real ki, a_real kd)
set proportional integral derivative constant for PID controller
a_pid_zero
void a_pid_zero(a_pid *ctx)
zeroing for PID controller
a_pid_inc
a_real a_pid_inc(a_pid *ctx, a_real set, a_real fdb)
compute for incremental PID controller
a_real
double a_real
compiler built-in floating-point number type
Definition
a.h:1012
a_pid
instance structure for PID controller
Definition
pid.h:106
a_pid::fdb
a_real fdb
Definition
pid.h:117
a_pid::kp
a_real kp
Definition
pid.h:107
a_pid::sum
a_real sum
Definition
pid.h:112
a_pid::outmax
a_real outmax
Definition
pid.h:113
a_pid::ki
a_real ki
Definition
pid.h:108
a_pid::outmin
a_real outmin
Definition
pid.h:114
a_pid::out
a_real out
Definition
pid.h:115
a_pid::kd
a_real kd
Definition
pid.h:109
a_pid::var
a_real var
Definition
pid.h:116
a_pid::err
a_real err
Definition
pid.h:118
a_pid::summin
a_real summin
Definition
pid.h:111
a_pid::summax
a_real summax
Definition
pid.h:110
pid.h
Generated by
1.17.0