1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/***
trapezoidal velocity trajectory
@classmod a.trajtrap
*/
#ifndef LUA_LIBA_TRAJTRAP_H
#define LUA_LIBA_TRAJTRAP_H
#include "a.h"
/***
trapezoidal velocity trajectory
@field t total duration
@field p0 initial position
@field p1 final position
@field v0 initial velocity
@field v1 final velocity
@field vc constant velocity
@field ta time before constant velocity
@field td time after constant velocity
@field pa position before constant velocity
@field pd position after constant velocity
@field ac acceleration before constant velocity
@field de acceleration after constant velocity
@table a.trajtrap
*/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/***
constructor for trapezoidal velocity trajectory
@treturn a.trajtrap trapezoidal velocity trajectory userdata
@function new
*/
int liba_trajtrap_new(lua_State *L);
/***
generate for trapezoidal velocity trajectory
@tparam number vm defines the maximum velocity during system operation
@tparam number ac defines the acceleration before constant velocity
@tparam number de defines the acceleration after constant velocity
@tparam number p0 defines the initial position
@tparam number p1 defines the final position
@tparam[opt] number v0 defines the initial velocity
@tparam[opt] number v1 defines the final velocity
@treturn number total duration
@function gen
*/
int liba_trajtrap_gen(lua_State *L);
/***
calculate position for trapezoidal velocity trajectory
@tparam number x difference between current time and initial time
@treturn number position output
@function pos
*/
int liba_trajtrap_pos(lua_State *L);
/***
calculate velocity for trapezoidal velocity trajectory
@tparam number x difference between current time and initial time
@treturn number velocity output
@function vel
*/
int liba_trajtrap_vel(lua_State *L);
/***
calculate acceleration for trapezoidal velocity trajectory
@tparam number x difference between current time and initial time
@treturn number acceleration output
@function acc
*/
int liba_trajtrap_acc(lua_State *L);
#if defined(__cplusplus)
} /* extern "C" */
#endif /* __cplusplus */
#endif /* trajtrap.h */