3 import java
.nio
.ByteBuffer
;
5 /** proportional integral derivative controller */
9 System
.loadLibrary("a");
13 static final native void clinit();
15 final native void init();
18 * construct a new {@link pid} object
25 * get proportional constant for PID controller
27 * @return proportional constant
29 public final native double kp();
32 * set proportional constant for PID controller
34 * @param kp proportional constant
37 public final native pid
set_kp(double kp
);
40 * get integral constant for PID controller
42 * @return integral constant
44 public final native double ki();
47 * set integral constant for PID controller
49 * @param ki integral constant
52 public final native pid
set_ki(double ki
);
55 * get derivative constant for PID controller
57 * @return derivative constant
59 public final native double kd();
62 * set derivative constant for PID controller
64 * @param kd derivative constant
67 public final native pid
set_kd(double kd
);
70 * get maximum integral output for PID controller
72 * @return maximum integral output
74 public final native double summax();
77 * set maximum integral output for PID controller
79 * @param max maximum integral output
82 public final native pid
set_summax(double max
);
85 * get minimum integral output for PID controller
87 * @return minimum integral output
89 public final native double summin();
92 * set minimum integral output for PID controller
94 * @param min minimum integral output
97 public final native pid
set_summin(double min
);
100 * get cached integral output for PID controller
102 * @return cached integral output
104 public final native double sum();
107 * get maximum final output for PID controller
109 * @return maximum final output
111 public final native double outmax();
114 * set maximum final output for PID controller
116 * @param max maximum final output
117 * @return {@link pid}
119 public final native pid
set_outmax(double max
);
122 * get minimum final output for PID controller
124 * @return minimum final output
126 public final native double outmin();
129 * set minimum final output for PID controller
131 * @param min minimum final output
132 * @return {@link pid}
134 public final native pid
set_outmin(double min
);
137 * get cached output for PID controller
139 * @return cached output
141 public final native double out();
144 * get cached feedback for PID controller
146 * @return cached feedback
148 public final native double fdb();
151 * get cached error for PID controller
153 * @return cached error
155 public final native double err();
158 * set proportional integral derivative constant for PID controller
160 * @param kp proportional constant
161 * @param ki integral constant
162 * @param kd derivative constant
163 * @return {@link pid}
165 public final native pid
set_kpid(double kp
, double ki
, double kd
);
168 * calculate for PID controller
170 * @param set setpoint value
171 * @param fdb feedback value
172 * @return setpoint value
174 public final native double run(double set
, double fdb
);
177 * calculate for positional PID controller
179 * @param set setpoint value
180 * @param fdb feedback value
181 * @return output value
183 public final native double pos(double set
, double fdb
);
186 * calculate for incremental PID controller
188 * @param set setpoint value
189 * @param fdb feedback value
190 * @return output value
192 public final native double inc(double set
, double fdb
);
195 * zeroing for PID controller
197 * @return {@link pid}
199 public final native pid
zero();