create regress_simple for Java
[liba.git] / java / src / liba / pid.java
blob28c11f58909e091dc0099455f3c3478841f98cd2
1 package liba;
3 import java.nio.ByteBuffer;
5 /** proportional integral derivative controller */
6 public class pid {
7 ByteBuffer ctx;
8 static {
9 System.loadLibrary("a");
10 clinit();
13 static final native void clinit();
15 final native void init();
17 /**
18 * construct a new {@link pid} object
20 public pid() {
21 init();
24 /**
25 * get proportional constant for PID controller
27 * @return proportional constant
29 public final native double kp();
31 /**
32 * set proportional constant for PID controller
34 * @param kp proportional constant
35 * @return {@link pid}
37 public final native pid set_kp(double kp);
39 /**
40 * get integral constant for PID controller
42 * @return integral constant
44 public final native double ki();
46 /**
47 * set integral constant for PID controller
49 * @param ki integral constant
50 * @return {@link pid}
52 public final native pid set_ki(double ki);
54 /**
55 * get derivative constant for PID controller
57 * @return derivative constant
59 public final native double kd();
61 /**
62 * set derivative constant for PID controller
64 * @param kd derivative constant
65 * @return {@link pid}
67 public final native pid set_kd(double kd);
69 /**
70 * get maximum integral output for PID controller
72 * @return maximum integral output
74 public final native double summax();
76 /**
77 * set maximum integral output for PID controller
79 * @param max maximum integral output
80 * @return {@link pid}
82 public final native pid set_summax(double max);
84 /**
85 * get minimum integral output for PID controller
87 * @return minimum integral output
89 public final native double summin();
91 /**
92 * set minimum integral output for PID controller
94 * @param min minimum integral output
95 * @return {@link pid}
97 public final native pid set_summin(double min);
99 /**
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();