3 import java
.nio
.ByteBuffer
;
5 /** trapezoidal velocity trajectory */
6 public class trajtrap
{
9 System
.loadLibrary("a");
13 static final native void clinit();
15 final native void init();
18 * get total duration for trapezoidal velocity trajectory
20 * @return total duration
22 public final native double t();
25 * get initial position for trapezoidal velocity trajectory
27 * @return initial position
29 public final native double p0();
32 * get final position for trapezoidal velocity trajectory
34 * @return final position
36 public final native double p1();
39 * get initial velocity for trapezoidal velocity trajectory
41 * @return initial velocity
43 public final native double v0();
46 * get final velocity for trapezoidal velocity trajectory
48 * @return final velocity
50 public final native double v1();
53 * get constant velocity for trapezoidal velocity trajectory
55 * @return constant velocity
57 public final native double vc();
60 * get time before constant velocity for trapezoidal velocity trajectory
62 * @return time before constant velocity
64 public final native double ta();
67 * get time after constant velocity for trapezoidal velocity trajectory
69 * @return time after constant velocity
71 public final native double td();
74 * get position before constant velocity for trapezoidal velocity trajectory
76 * @return position before constant velocity
78 public final native double pa();
81 * get position after constant velocity for trapezoidal velocity trajectory
83 * @return position after constant velocity
85 public final native double pd();
88 * get acceleration before constant velocity for trapezoidal velocity trajectory
90 * @return acceleration before constant velocity
92 public final native double ac();
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
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
);