Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

emcmotlog.h

Go to the documentation of this file.
00001 #ifndef EMCMOTLOG_H
00002 #define EMCMOTLOG_H
00003 
00004 /*
00005   Data logging declarations
00006 
00007   Modification history:
00008 
00009   13-Mar-2000 WPS added unused attribute to emcmotlog_h to avoid 'defined but not used' compiler warning.
00010   3-Nov-1999  FMP added EMCMOT_LOG_POS_VOLTAGE
00011   7-Jun-1999  FMP added 'mag' to vel and accel logging
00012   21-May-1999  FMP added EMCMOT_LOG_TYPE_TRAJ_POS for Cartesian position
00013   logged at trajectory rate, and VEL and ACCEL differences also
00014   7-Feb-1999  FMP added EMCMOT_LOG_TYPE_ALL_FERROR for all axes'
00015   following error
00016   20-Aug-1998  FMP added EMCMOT_LOG_TYPE_AXIS_VEL; added type to each
00017   log item; got rid of different EMCMOT_LOG_MAX for different plats;
00018   made EMCMOT_LOG_MAX 20000, since 100000 resulted in 4 MB shared memory
00019   23-Feb-1998  FMP added output pos
00020   6-Feb-1998  FMP added logging type defines
00021   22-Dec-1997  FMP created
00022   */
00023 
00024 #include "posemath.h"           /* PmCartesian */
00025 
00026 /* ident tag */
00027 #ifndef __GNUC__
00028 #ifndef __attribute__
00029 #define __attribute__(x)
00030 #endif
00031 #endif
00032 
00033 static char __attribute__((unused)) emcmotlog_h[] = "$Id: emcmotlog.h,v 1.4 2001/07/31 15:47:45 wshackle Exp $";
00034 
00035 /* max log points allowed */
00036 /* Note: this will strongly affect the requirements for shared memory */
00037 #define EMCMOT_LOG_MAX 10000
00038 
00039 /* types of logged data */
00040 enum EMCMOT_LOG_TYPE_ENUM {
00041   EMCMOT_LOG_TYPE_AXIS_POS = 1, /* single axis cmd/actual pos */
00042   EMCMOT_LOG_TYPE_ALL_INPOS = 2, /* all axes actual input pos */
00043   EMCMOT_LOG_TYPE_ALL_OUTPOS = 3, /* all axes commanded output pos */
00044   EMCMOT_LOG_TYPE_CMD = 4,      /* command type and num */
00045   EMCMOT_LOG_TYPE_AXIS_VEL = 5, /* single axis cmd/actual vel */
00046   EMCMOT_LOG_TYPE_ALL_FERROR = 6, /* all axes following error */
00047   EMCMOT_LOG_TYPE_TRAJ_POS = 7, /* Cartesian position at traj rate */
00048   EMCMOT_LOG_TYPE_TRAJ_VEL = 8, /* Cartesian vel diffs at traj rate */
00049   EMCMOT_LOG_TYPE_TRAJ_ACC = 9, /* Cartesian accel diffs at traj rate */
00050   EMCMOT_LOG_TYPE_POS_VOLTAGE = 10 /* all axes measured pos and output V */
00051 };
00052 
00053 
00054 enum EMCLOG_TRIGGER_TYPE {
00055   EMCLOG_MANUAL_TRIGGER,
00056   EMCLOG_DELTA_TRIGGER,
00057   EMCLOG_OVER_TRIGGER,
00058   EMCLOG_UNDER_TRIGGER
00059 };
00060 
00061 enum EMCLOG_TRIGGER_VAR {
00062   EMCLOG_TRIGGER_ON_FERROR,
00063   EMCLOG_TRIGGER_ON_VOLT,
00064   EMCLOG_TRIGGER_ON_POS,
00065   EMCLOG_TRIGGER_ON_VEL
00066 };
00067 
00068 
00069 /* various loggable structs */
00070 
00071 /* logs commanded and actual position, single axis, per cycle */
00072 typedef struct
00073 {
00074   double time;
00075   double output;
00076   double input;
00077 } EMCMOT_LOG_AXIS_POS_STRUCT;
00078 
00079 /* logs actual input position, all axes, per cycle */
00080 #define EMCMOT_LOG_NUM_AXES 3   /* how many are logged */
00081 typedef struct
00082 {
00083   double time;
00084   double input[EMCMOT_LOG_NUM_AXES];
00085 } EMCMOT_LOG_ALL_INPOS_STRUCT;
00086 
00087 /* logs commanded output position, all axes, per cycle */
00088 typedef struct
00089 {
00090   double time;
00091   double output[EMCMOT_LOG_NUM_AXES];
00092 } EMCMOT_LOG_ALL_OUTPOS_STRUCT;
00093 
00094 /* logs commands, per new command */
00095 typedef struct
00096 {
00097   double time;
00098   int command;
00099   int commandNum;
00100 } EMCMOT_LOG_CMD_STRUCT;
00101 
00102 /* logs axis cmd and actual vel */
00103 typedef struct
00104 {
00105   double time;
00106   double cmdVel;
00107   double actVel;
00108 } EMCMOT_LOG_AXIS_VEL_STRUCT;
00109 
00110 /* logs all axes' following error */
00111 typedef struct
00112 {
00113   double time;
00114   double ferror[EMCMOT_LOG_NUM_AXES];
00115 } EMCMOT_LOG_ALL_FERROR_STRUCT;
00116 
00117 /* logs Cartesian position at trajectory rate */
00118 typedef struct
00119 {
00120   double time;
00121   PmCartesian pos;              /* calculated Cartesian position */
00122 } EMCMOT_LOG_TRAJ_POS_STRUCT;
00123 
00124 /* logs Cartesian velocity diffs at trajectory rate */
00125 typedef struct
00126 {
00127   double time;
00128   PmCartesian vel;              /* differenced Cartesian velocity */
00129   double mag;
00130 } EMCMOT_LOG_TRAJ_VEL_STRUCT;
00131 
00132 /* logs Cartesian acceleration diffs at trajectory rate */
00133 typedef struct
00134 {
00135   double time;
00136   PmCartesian acc;              /* differenced Cartesian acceleration */
00137   double mag;
00138 } EMCMOT_LOG_TRAJ_ACC_STRUCT;
00139 
00140 /* logs measured position and resulting output voltage */
00141 typedef struct
00142 {
00143   double time;
00144   double pos;
00145   double voltage;
00146 } EMCMOT_LOG_POS_VOLTAGE_STRUCT;
00147 
00148 /* full EMCMOT_LOG_STRUCT union */
00149 typedef struct
00150 {
00151   int type;
00152   union {
00153     EMCMOT_LOG_AXIS_POS_STRUCT axisPos;
00154     EMCMOT_LOG_ALL_INPOS_STRUCT allInpos;
00155     EMCMOT_LOG_ALL_OUTPOS_STRUCT allOutpos;
00156     EMCMOT_LOG_CMD_STRUCT cmd;
00157     EMCMOT_LOG_AXIS_VEL_STRUCT axisVel;
00158     EMCMOT_LOG_ALL_FERROR_STRUCT allFerror;
00159     EMCMOT_LOG_TRAJ_POS_STRUCT trajPos;
00160     EMCMOT_LOG_TRAJ_VEL_STRUCT trajVel;
00161     EMCMOT_LOG_TRAJ_ACC_STRUCT trajAcc;
00162     EMCMOT_LOG_POS_VOLTAGE_STRUCT posVoltage;
00163   } item;
00164 } EMCMOT_LOG_STRUCT;
00165 
00166 /* full log, with header and union of types */
00167 typedef struct
00168 {
00169   int type;                     /* type of data logged, as in enum above */
00170   int size;                     /* elements of log[] array */
00171   int start;                    /* index of start */
00172   int end;                      /* index of end */
00173   int howmany;                  /* how many in log */
00174   EMCMOT_LOG_STRUCT log[EMCMOT_LOG_MAX];
00175 } EMCMOT_LOG;
00176 
00177 extern int emcmotLogInit(EMCMOT_LOG *log, int type, int size);
00178 extern int emcmotLogAdd(EMCMOT_LOG *log, EMCMOT_LOG_STRUCT val);
00179 extern int emcmotLogGet(EMCMOT_LOG *log, EMCMOT_LOG_STRUCT *val);
00180 
00181 #endif /* EMCMOTLOG_H */
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 

Generated on Sun Dec 2 15:27:39 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001