liba 0.1.15
An algorithm library based on C/C++
|
Data Structures | |
struct | a_trajtrap |
instance structure for trapezoidal velocity trajectory More... | |
Typedefs | |
typedef struct a_trajtrap | a_trajtrap |
Functions | |
double | a_trajtrap_gen (a_trajtrap *ctx, double vm, double ac, double de, double p0, double p1, double v0, double v1) |
generate for trapezoidal velocity trajectory | |
double | a_trajtrap_pos (a_trajtrap const *ctx, double x) |
calculate position for trapezoidal velocity trajectory | |
double | a_trajtrap_vel (a_trajtrap const *ctx, double x) |
calculate velocity for trapezoidal velocity trajectory | |
double | a_trajtrap_acc (a_trajtrap const *ctx, double x) |
calculate acceleration for trapezoidal velocity trajectory | |
double a_trajtrap_acc | ( | a_trajtrap const * | ctx, |
double | x ) |
calculate acceleration for trapezoidal velocity trajectory
\[ \ddot{p}(t)=\begin{cases}a,&t\in[0,t_a)\\0,&t\in[t_a,t_d)\\d,&t\in[t_d,T]\end{cases} \]
[in] | ctx | points to an instance of trapezoidal velocity trajectory |
[in] | x | difference between current time and initial time |
double a_trajtrap_gen | ( | a_trajtrap * | ctx, |
double | vm, | ||
double | ac, | ||
double | de, | ||
double | p0, | ||
double | p1, | ||
double | v0, | ||
double | v1 ) |
generate for trapezoidal velocity trajectory
Assuming that there is no constant velocity phase, but only acceleration and deceleration phases, the maximum velocity in the motion is \(v\), then we have
\[\frac{v^2-v_0^2}{2a}+\frac{v_1^2-v^2}{2d}=p_1-p_0\]
Solving for the maximum velocity is
\[|v|=\sqrt{\frac{av_1^2-dv_0^2-2ad(p_1-p_0)}{a-d}}\]
\[p_a=p_0+v_0T_a+\frac{1}{2}aT_a^2\]
\[a_d=p_1-v_cT_d-\frac{1}{2}dT_d^2\]
\begin{cases}T_a=\cfrac{v_m-v_0}{a}\\T_c=\cfrac{p_d-p_a}{v_c}\\T_d=\cfrac{v_1-v_m}{d}\end{cases}
\[|v_1|=\sqrt{v_0^2+2a(p_1-p_0)}\]
\begin{cases}T_a=\cfrac{v_1-v_0}{a}\\T_c=0\\T_d=0\end{cases}
b. If \(|v_0|\ge|v|>|v_1|\), there is only a deceleration phase.\[|v_1|=\sqrt{v_0^2+2d(p_1-p_0)}\]
\begin{cases}T_a=0\\T_c=0\\T_d=\cfrac{v_1-v_0}{d}\end{cases}
c. If \(|v|>|v_0|\), \(|v|>|v_1|\), then there are acceleration and deceleration phases.\begin{cases}T_a=\cfrac{v-v_0}{a}\\T_c=0\\T_d=\cfrac{v_1-v}{d}\end{cases}
[in,out] | ctx | points to an instance of trapezoidal velocity trajectory |
[in] | vm | defines the maximum velocity during system operation |
[in] | ac | defines the acceleration before constant velocity |
[in] | de | defines the acceleration after constant velocity |
[in] | p0 | defines the initial position |
[in] | p1 | defines the final position |
[in] | v0 | defines the initial velocity |
[in] | v1 | defines the final velocity |
double a_trajtrap_pos | ( | a_trajtrap const * | ctx, |
double | x ) |
calculate position for trapezoidal velocity trajectory
\[ p(t)=\begin{cases}v_0+\frac{1}{2}at^2,&t\in[0,t_a)\\p_a+v_c(t-t_a),&t\in[t_a,t_d)\\ p_d+v_c(t-t_d)+\frac{1}{2}d(t-t_d)^2,&t\in[t_d,T]\end{cases} \]
[in] | ctx | points to an instance of trapezoidal velocity trajectory |
[in] | x | difference between current time and initial time |
double a_trajtrap_vel | ( | a_trajtrap const * | ctx, |
double | x ) |
calculate velocity for trapezoidal velocity trajectory
\[ \dot{p}(t)=\begin{cases}v_0+at,&t\in[0,t_a)\\v_c,&t\in[t_a,t_d)\\v_c+d(t-t_d),&t\in[t_d,T]\end{cases} \]
[in] | ctx | points to an instance of trapezoidal velocity trajectory |
[in] | x | difference between current time and initial time |