00001 #ifndef TC_H
00002 #define TC_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "posemath.h"
00035 #include "emcpos.h"
00036
00037
00038 #ifndef __GNUC__
00039 #ifndef __attribute__
00040 #define __attribute__(x)
00041 #endif
00042 #endif
00043
00044 static char __attribute__((unused)) tc_h[] = "$Id: tc.h,v 1.6 2001/08/17 22:05:41 proctor Exp $";
00045
00046
00047 #define TC_IS_UNSET -1
00048 #define TC_IS_DONE 1
00049 #define TC_IS_ACCEL 2
00050 #define TC_IS_CONST 3
00051 #define TC_IS_DECEL 4
00052 #define TC_IS_PAUSED 5
00053
00054
00055 #define TC_TERM_COND_STOP 1
00056 #define TC_TERM_COND_BLEND 2
00057
00058 #define TC_LINEAR 1
00059 #define TC_CIRCULAR 2
00060
00061
00062
00063 typedef struct
00064 {
00065 double cycleTime;
00066 double targetPos;
00067 double vMax;
00068 double vScale;
00069 double aMax;
00070 double preVMax;
00071 double preAMax;
00072 double vLimit;
00073 double toGo;
00074 double currentPos;
00075 double currentVel;
00076 double currentAccel;
00077 int tcFlag;
00078 int type;
00079 int id;
00080 int termCond;
00081 PmLine line;
00082 PmLine line_abc;
00083 PmCircle circle;
00084 double tmag;
00085 double abc_mag;
00086 double tvMax;
00087 double taMax;
00088 double abc_vMax;
00089 double abc_aMax;
00090 PmCartesian unitCart;
00091 unsigned char douts;
00092 unsigned char doutstarts;
00093 unsigned char doutends;
00094 } TC_STRUCT;
00095
00096
00097
00098 extern int tcInit(TC_STRUCT *tc);
00099 extern int tcSetCycleTime(TC_STRUCT *tc, double secs);
00100 extern int tcSetLine(TC_STRUCT *tc, PmLine line, PmLine line_abc);
00101 extern int tcSetCircle(TC_STRUCT *tc, PmCircle circle, PmLine line_abc);
00102 extern int tcSetTVmax(TC_STRUCT *tc, double vmax);
00103 extern int tcSetRVmax(TC_STRUCT *tc, double vmax);
00104 extern int tcSetVscale(TC_STRUCT *tc, double vscale);
00105 extern int tcSetTAmax(TC_STRUCT *tc, double amax);
00106 extern int tcSetRAmax(TC_STRUCT *tc, double wmax);
00107 extern int tcSetPremax(TC_STRUCT *tc, double vmax, double amax);
00108 extern int tcSetVlimit(TC_STRUCT *tc, double vlimit);
00109 extern int tcSetId(TC_STRUCT *tc, int id);
00110 extern int tcGetId(TC_STRUCT *tc);
00111 extern int tcSetTermCond(TC_STRUCT *tc, int cond);
00112 extern int tcGetTermCond(TC_STRUCT *tc);
00113 extern int tcRunCycle(TC_STRUCT *tc);
00114 extern EmcPose tcGetPos(TC_STRUCT *tc);
00115 extern EmcPose tcGetGoalPos(TC_STRUCT *tc);
00116 extern double tcGetVel(TC_STRUCT *tc);
00117 extern double tcGetAccel(TC_STRUCT *tc);
00118 extern PmCartesian tcGetUnitCart(TC_STRUCT *tc);
00119 extern int tcGetTcFlag(TC_STRUCT *tc);
00120 extern int tcIsDone(TC_STRUCT *tc);
00121 extern int tcIsAccel(TC_STRUCT *tc);
00122 extern int tcIsConst(TC_STRUCT *tc);
00123 extern int tcIsDecel(TC_STRUCT *tc);
00124 extern int tcIsPaused(TC_STRUCT *tc);
00125 extern void tcPrint(TC_STRUCT *tc);
00126 extern double tcRunPreCycle(const TC_STRUCT *tc);
00127 extern int tcForceCycle(TC_STRUCT *tc, double ratio);
00128 extern int tcSetDout(TC_STRUCT *tc, unsigned char douts, unsigned char starts, unsigned char ends);
00129
00130
00131
00132 typedef struct
00133 {
00134 TC_STRUCT *queue;
00135 int size;
00136 int _len;
00137 int start, end;
00138 int allFull;
00139 } TC_QUEUE_STRUCT;
00140
00141
00142
00143
00144 extern int tcqCreate(TC_QUEUE_STRUCT *tcq, int _size, TC_STRUCT *tcSpace);
00145
00146
00147 extern int tcqDelete(TC_QUEUE_STRUCT *tcq);
00148
00149
00150 extern int tcqInit(TC_QUEUE_STRUCT *tcq);
00151
00152
00153 extern int tcqPut(TC_QUEUE_STRUCT *tcq, TC_STRUCT tc);
00154
00155
00156 extern TC_STRUCT tcqGet(TC_QUEUE_STRUCT *tcq, int *status);
00157
00158
00159 extern int tcqRemove(TC_QUEUE_STRUCT *tcq, int n);
00160
00161
00162 extern int tcqLen(TC_QUEUE_STRUCT *tcq);
00163
00164
00165 extern TC_STRUCT * tcqItem(TC_QUEUE_STRUCT *tcq, int n, int *status);
00166
00167
00168 extern TC_STRUCT * tcqLast(TC_QUEUE_STRUCT *tcq, int *status);
00169
00170
00171 extern int tcqFull(TC_QUEUE_STRUCT *tcq);
00172
00173 #endif
00174