rename dt to x
[liba.git] / java / src / liba / trajtrap.java
blob4edcec38646711fd12b90235291155ec06411086
1 package liba;
3 import java.nio.ByteBuffer;
5 /** trapezoidal velocity trajectory */
6 public class trajtrap {
7 ByteBuffer ctx;
8 static {
9 System.loadLibrary("a");
10 clinit();
13 static final native void clinit();
15 final native void init();
17 /**
18 * get total duration for trapezoidal velocity trajectory
20 * @return total duration
22 public final native double t();
24 /**
25 * get initial position for trapezoidal velocity trajectory
27 * @return initial position
29 public final native double p0();
31 /**
32 * get final position for trapezoidal velocity trajectory
34 * @return final position
36 public final native double p1();
38 /**
39 * get initial velocity for trapezoidal velocity trajectory
41 * @return initial velocity
43 public final native double v0();
45 /**
46 * get final velocity for trapezoidal velocity trajectory
48 * @return final velocity
50 public final native double v1();
52 /**
53 * get constant velocity for trapezoidal velocity trajectory
55 * @return constant velocity
57 public final native double vc();
59 /**
60 * get time before constant velocity for trapezoidal velocity trajectory
62 * @return time before constant velocity
64 public final native double ta();
66 /**
67 * get time after constant velocity for trapezoidal velocity trajectory
69 * @return time after constant velocity
71 public final native double td();
73 /**
74 * get position before constant velocity for trapezoidal velocity trajectory
76 * @return position before constant velocity
78 public final native double pa();
80 /**
81 * get position after constant velocity for trapezoidal velocity trajectory
83 * @return position after constant velocity
85 public final native double pd();
87 /**
88 * get acceleration before constant velocity for trapezoidal velocity trajectory
90 * @return acceleration before constant velocity
92 public final native double ac();
94 /**
95 * get acceleration after constant velocity for trapezoidal velocity trajectory
97 * @return acceleration after constant velocity
99 public final native double de();
102 * construct a new {@link trajtrap} object
104 public trajtrap() {
105 init();
109 * generate for trapezoidal velocity trajectory
111 * @param vm defines the maximum velocity during system operation
112 * @param ac defines the acceleration before constant velocity
113 * @param de defines the acceleration after constant velocity
114 * @param p0 defines the initial position
115 * @param p1 defines the final position
116 * @param v0 defines the initial velocity
117 * @param v1 defines the final velocity
118 * @return total duration
120 public final native double gen(double vm, double ac, double de, double p0, double p1, double v0, double v1);
123 * calculate position for trapezoidal velocity trajectory
125 * @param x difference between current time and initial time
126 * @return position output
128 public final native double pos(double x);
131 * calculate velocity for trapezoidal velocity trajectory
133 * @param x difference between current time and initial time
134 * @return velocity output
136 public final native double vel(double x);
139 * calculate acceleration for trapezoidal velocity trajectory
141 * @param x difference between current time and initial time
142 * @return acceleration output
144 public final native double acc(double x);