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

emc.hh

Go to the documentation of this file.
00001 #ifndef EMC_HH
00002 #define EMC_HH
00003 
00004 /*
00005   emc.hh
00006 
00007   Declarations for EMC NML vocabulary
00008 
00009   Modification history:
00010 
00011   17-Aug-2001  FMP added EMC_MOTION_SET_DOUT stuff
00012   1-Jun-2001  FMP added debug to EMC_IO_STAT, EMC_MOTION_STAT; added
00013   emcIo,MotionSetDebug
00014   31-May-2001  FMP added EMC_SET_DEBUG, debug to EMC_STAT
00015   23-May-2001  FMP added EMC_TASK_STAT::programUnits
00016   16-Aug-2000  FMP added EMC_AXIS_ALTER, emcAxisAlter(), alter to axis stat.
00017   10-Aug-2000  FMP added axis compensation: emcAxisLoadComp(),
00018   EMC_AXIS_LOAD_COMP, etc.
00019   31-Jul-2000 WPS added probing junk.
00020   19-May-2000  FMP added prototypes for emcLubeSetWriteIndex,Polarity(),
00021   which are defined in inilube.cc
00022   30-Mar-2000 WPS added ferrorCurrent and changed the name of ferror to
00023   ferrorHighMark in EMC_AXIS_STAT class.
00024   3-Mar-2000  FMP added fault to axis status; estopIn to aux status
00025   24-Feb-2000  FMP added deadband
00026   23-Feb-2000  FMP added EMC_AXIS_SET_MAX_VELOCITY; moved EMC_AXIS_MAX into
00027   emcglb.h
00028   22-Jan-2000  FMP added pos-voltage log type; renumbered log types to
00029   include a type for logged motion commands, consistent with emcmot logging.
00030   Added placeholders for task and IO logging. Added EMC_AXIS_SET_OUTPUT
00031   to set DACs for servo tuning.
00032   1-Oct-1999  FMP added emcAxisOverrideLimits(), etc.
00033   29-Sep-1999  FMP added EMC_AXIS_SET_HOME_OFFSET, emcAxisSetHomeOffset(),
00034   homeOffset in status
00035   17-Aug-1999  FMP added EMC_TASK_EXEC_WAITING_FOR_STEP
00036   9-Aug-1999  FMP added EMC_TRAJ_SET_HOME, EMC_AXIS_SET_HOME
00037   3-Aug-1999  FMP added EMC_AXIS_ACTIVATE,DEACTIVATE
00038   16-Jun-1999  FMP added EMC_AXIS_STAT::setpoint
00039   10-Jun-1999  FMP added emcTaskPlanCommand()
00040   21-May-1999  FMP added EMC_LOG_TYPE_TRAJ_POS, changing TRAJ_INPOS,OUTPOS
00041   to AXES_INPOS,OUTPOS
00042   22-Mar-1999  FMP added line field to EMC_TASK_PLAN_RUN
00043   22-Feb-1999  FMP added EMC_TOOL_SET_OFFSET
00044   7-Feb-1999  FMP added EMC_LOG_TYPE_TRAJ_FERROR following error log type
00045   31-Jan-1999  FMP added backlash, bias, maxError to EMC_AXIS_STAT
00046   23-Dec-1998  FMP added emcTaskPlanSet,Is,ClearWait(); EMC_TRAJ_SET_OFFSET;
00047   EMC_TRAJ_SET_ORIGIN;
00048   15-Oct-1998  FMP added EMC_OPERATOR_ series, replacing emcLogDisplay, etc.
00049   7-Oct-1998 FMP added axis homing vel
00050   2-Sep-1998  FMP added min/maxSoft/HardLimit to EMC_AXIS_STAT
00051   18-Aug-1998  FMP took out reverse PID gains, added bias
00052   3-Aug-1998  FMP added toolOffset to task status
00053   31-Jul-1998  FMP added active G, M, and settings to task stat
00054   8-Jul-1998  FMP added logPoints to status
00055   6-Jul-1998  FMP added decls for Argc,Argv
00056   2-Jul-1998  FMP added EMC_TASK_PLAN_SYNCH stuff
00057   30-Jun-1998  FMP added emcSpindleSetOff/OnWait
00058   17-Jun-1998  FMP added 'which' parameter to EMC_LOG_OPEN, emcLogOpen()
00059   15-Jun-1998  FMP added EMC_TRAJ_SET_TERM_COND
00060   12-Jun-1998 FMP added EMC_TASK_EXEC_WAITING_FOR_DELAY
00061   5-Jun-1998  FMP added reverse gains, backlash
00062   22-May-1998  FMP added decl for auto-generated emc_symbol_lookup(),
00063   and aliased more conventional emcSymbolLookup() to it
00064   27-Apr-1998  FMP added EMC_DIO_SET_INDEX,POLARITY and enum for
00065   EMC_DIO_XXX_INDEX,POLARITY
00066   7-Apr-1998  FMP added EMCIO SET_, POLARITY messages; motion heartbeat
00067   1-Apr-1998  FMP added EMC_SPINDLE_ENABLE,DISABLE, and enabled to status
00068   25-Mar-1998  FMP took out repeated decl of EMC_INIFILE, since it was
00069   C++ here and really was C.
00070   18-Mar-1998  FMP added actualPosition to EMC_TRAJ_STAT
00071   25-Feb-1998  FMP added inpos to axis stat
00072   24-Feb-1998  FMP added origin to task status; task plan init
00073   20-Feb-1998  FMP added enabled flag to EMC_AXIS_STAT code; changed
00074   EMC_TASK_EXEC_WAITING_FOR_ALL to ...WAITING_FOR_MOTION_AND_IO; added
00075   operator = to tool status
00076   17-Feb-1998  FMP added homing, homed to axis status
00077   16-Dec-1997  FMP created from ancient, venerable nml_emc.hh
00078   */
00079 
00080 #include "rcs.hh"
00081 #include "posemath.h"           // PM_POSE, etc.
00082 #include "canon.hh"             // CANON_TOOL_TABLE, CANON_UNITS
00083 #include "emcglb.h"             // EMC_AXIS_MAX
00084 #include "emcpos.h"
00085 
00086 /* ident tag */
00087 #ifndef __GNUC__
00088 #ifndef __attribute__
00089 #define __attribute__(x)
00090 #endif
00091 #endif
00092 
00093 static char __attribute__((unused)) emc_hh[] = "$Id: emc.hh,v 1.14 2001/10/04 15:11:59 wshackle Exp $";
00094 
00095 // ---------------------
00096 // EMC TYPE DECLARATIONS
00097 // ---------------------
00098 
00099 // NML for base EMC
00100 
00101 #define EMC_OPERATOR_ERROR_TYPE                      ((NMLTYPE) 11)
00102 #define EMC_OPERATOR_TEXT_TYPE                       ((NMLTYPE) 12)
00103 #define EMC_OPERATOR_DISPLAY_TYPE                    ((NMLTYPE) 13)
00104 
00105 #define EMC_NULL_TYPE                                ((NMLTYPE) 21)
00106 
00107 #define EMC_SET_DEBUG_TYPE                           ((NMLTYPE) 22)
00108 
00109 // NML for EMC_AXIS
00110 
00111 #define EMC_AXIS_SET_AXIS_TYPE                       ((NMLTYPE) 101)
00112 #define EMC_AXIS_SET_UNITS_TYPE                      ((NMLTYPE) 102)
00113 #define EMC_AXIS_SET_GAINS_TYPE                      ((NMLTYPE) 103)
00114 #define EMC_AXIS_SET_CYCLE_TIME_TYPE                 ((NMLTYPE) 104)
00115 #define EMC_AXIS_SET_INPUT_SCALE_TYPE                ((NMLTYPE) 105)
00116 #define EMC_AXIS_SET_OUTPUT_SCALE_TYPE               ((NMLTYPE) 106)
00117 #define EMC_AXIS_SET_MIN_POSITION_LIMIT_TYPE         ((NMLTYPE) 107)
00118 #define EMC_AXIS_SET_MAX_POSITION_LIMIT_TYPE         ((NMLTYPE) 108)
00119 #define EMC_AXIS_SET_MIN_OUTPUT_LIMIT_TYPE           ((NMLTYPE) 109)
00120 #define EMC_AXIS_SET_MAX_OUTPUT_LIMIT_TYPE           ((NMLTYPE) 110)
00121 #define EMC_AXIS_SET_FERROR_TYPE                     ((NMLTYPE) 111)
00122 #define EMC_AXIS_SET_HOMING_VEL_TYPE                 ((NMLTYPE) 112)
00123 #define EMC_AXIS_SET_HOME_TYPE                       ((NMLTYPE) 113)
00124 #define EMC_AXIS_SET_HOME_OFFSET_TYPE                ((NMLTYPE) 114)
00125 #define EMC_AXIS_SET_MIN_FERROR_TYPE                 ((NMLTYPE) 115)
00126 #define EMC_AXIS_SET_MAX_VELOCITY_TYPE               ((NMLTYPE) 116)
00127 
00128 #define EMC_AXIS_INIT_TYPE                           ((NMLTYPE) 118)
00129 #define EMC_AXIS_HALT_TYPE                           ((NMLTYPE) 119)
00130 #define EMC_AXIS_ABORT_TYPE                          ((NMLTYPE) 120)
00131 #define EMC_AXIS_ENABLE_TYPE                         ((NMLTYPE) 121)
00132 #define EMC_AXIS_DISABLE_TYPE                        ((NMLTYPE) 122)
00133 #define EMC_AXIS_HOME_TYPE                           ((NMLTYPE) 123)
00134 #define EMC_AXIS_JOG_TYPE                            ((NMLTYPE) 124)
00135 #define EMC_AXIS_INCR_JOG_TYPE                       ((NMLTYPE) 125)
00136 #define EMC_AXIS_ABS_JOG_TYPE                        ((NMLTYPE) 126)
00137 #define EMC_AXIS_ACTIVATE_TYPE                       ((NMLTYPE) 127)
00138 #define EMC_AXIS_DEACTIVATE_TYPE                     ((NMLTYPE) 128)
00139 #define EMC_AXIS_OVERRIDE_LIMITS_TYPE                ((NMLTYPE) 129)
00140 #define EMC_AXIS_SET_OUTPUT_TYPE                     ((NMLTYPE) 130)
00141 #define EMC_AXIS_LOAD_COMP_TYPE                      ((NMLTYPE) 131)
00142 #define EMC_AXIS_ALTER_TYPE                          ((NMLTYPE) 132)
00143 
00144 #define EMC_AXIS_STAT_TYPE                           ((NMLTYPE) 199)
00145 
00146 // NML for EMC_TRAJ
00147 
00148 // defs for termination conditions
00149 
00150 #define EMC_TRAJ_TERM_COND_STOP  1
00151 #define EMC_TRAJ_TERM_COND_BLEND 2
00152 
00153 #define EMC_TRAJ_SET_AXES_TYPE                       ((NMLTYPE) 201)
00154 #define EMC_TRAJ_SET_UNITS_TYPE                      ((NMLTYPE) 202)
00155 #define EMC_TRAJ_SET_CYCLE_TIME_TYPE                 ((NMLTYPE) 203)
00156 #define EMC_TRAJ_SET_MODE_TYPE                       ((NMLTYPE) 204)
00157 #define EMC_TRAJ_SET_VELOCITY_TYPE                   ((NMLTYPE) 205)
00158 #define EMC_TRAJ_SET_ACCELERATION_TYPE               ((NMLTYPE) 206)
00159 #define EMC_TRAJ_SET_MAX_VELOCITY_TYPE               ((NMLTYPE) 207)
00160 #define EMC_TRAJ_SET_MAX_ACCELERATION_TYPE           ((NMLTYPE) 208)
00161 #define EMC_TRAJ_SET_SCALE_TYPE                      ((NMLTYPE) 209)
00162 #define EMC_TRAJ_SET_MOTION_ID_TYPE                  ((NMLTYPE) 210)
00163 
00164 #define EMC_TRAJ_INIT_TYPE                           ((NMLTYPE) 211)
00165 #define EMC_TRAJ_HALT_TYPE                           ((NMLTYPE) 212)
00166 #define EMC_TRAJ_ENABLE_TYPE                         ((NMLTYPE) 213)
00167 #define EMC_TRAJ_DISABLE_TYPE                        ((NMLTYPE) 214)
00168 #define EMC_TRAJ_ABORT_TYPE                          ((NMLTYPE) 215)
00169 #define EMC_TRAJ_PAUSE_TYPE                          ((NMLTYPE) 216)
00170 #define EMC_TRAJ_STEP_TYPE                           ((NMLTYPE) 217)
00171 #define EMC_TRAJ_RESUME_TYPE                         ((NMLTYPE) 218)
00172 #define EMC_TRAJ_DELAY_TYPE                          ((NMLTYPE) 219)
00173 #define EMC_TRAJ_LINEAR_MOVE_TYPE                    ((NMLTYPE) 220)
00174 #define EMC_TRAJ_CIRCULAR_MOVE_TYPE                  ((NMLTYPE) 221)
00175 #define EMC_TRAJ_SET_TERM_COND_TYPE                  ((NMLTYPE) 222)
00176 #define EMC_TRAJ_SET_OFFSET_TYPE                     ((NMLTYPE) 223)
00177 #define EMC_TRAJ_SET_ORIGIN_TYPE                     ((NMLTYPE) 224)
00178 #define EMC_TRAJ_SET_HOME_TYPE                       ((NMLTYPE) 225)
00179 #define EMC_TRAJ_SET_PROBE_INDEX_TYPE                ((NMLTYPE) 226)
00180 #define EMC_TRAJ_SET_PROBE_POLARITY_TYPE             ((NMLTYPE) 227)
00181 #define EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE       ((NMLTYPE) 228)
00182 #define EMC_TRAJ_PROBE_TYPE                          ((NMLTYPE) 229)
00183 #define EMC_TRAJ_SET_TELEOP_ENABLE_TYPE              ((NMLTYPE) 230)
00184 #define EMC_TRAJ_SET_TELEOP_VECTOR_TYPE              ((NMLTYPE) 231)
00185 
00186 #define EMC_TRAJ_STAT_TYPE                           ((NMLTYPE) 299)
00187 
00188 // EMC_MOTION aggregate class type declaration
00189 
00190 #define EMC_MOTION_INIT_TYPE                         ((NMLTYPE) 301)
00191 #define EMC_MOTION_HALT_TYPE                         ((NMLTYPE) 302)
00192 #define EMC_MOTION_ABORT_TYPE                        ((NMLTYPE) 303)
00193 #define EMC_MOTION_SET_AOUT_TYPE                     ((NMLTYPE) 304)
00194 #define EMC_MOTION_SET_DOUT_TYPE                     ((NMLTYPE) 305)
00195 
00196 #define EMC_MOTION_STAT_TYPE                         ((NMLTYPE) 399)
00197 
00198 // NML for EMC_TASK
00199 
00200 #define EMC_TASK_FILENAME_LEN 256 // how long a file name can be
00201 #define EMC_TASK_COMMAND_LEN 256 // how long a file line can be
00202 
00203 #define EMC_TASK_INIT_TYPE                           ((NMLTYPE) 501)
00204 #define EMC_TASK_HALT_TYPE                           ((NMLTYPE) 502)
00205 #define EMC_TASK_ABORT_TYPE                          ((NMLTYPE) 503)
00206 #define EMC_TASK_SET_MODE_TYPE                       ((NMLTYPE) 504)
00207 #define EMC_TASK_SET_STATE_TYPE                      ((NMLTYPE) 505)
00208 #define EMC_TASK_PLAN_OPEN_TYPE                      ((NMLTYPE) 506)
00209 #define EMC_TASK_PLAN_RUN_TYPE                       ((NMLTYPE) 507)
00210 #define EMC_TASK_PLAN_READ_TYPE                      ((NMLTYPE) 508)
00211 #define EMC_TASK_PLAN_EXECUTE_TYPE                   ((NMLTYPE) 509)
00212 #define EMC_TASK_PLAN_PAUSE_TYPE                     ((NMLTYPE) 510)
00213 #define EMC_TASK_PLAN_STEP_TYPE                      ((NMLTYPE) 511)
00214 #define EMC_TASK_PLAN_RESUME_TYPE                    ((NMLTYPE) 512)
00215 #define EMC_TASK_PLAN_END_TYPE                       ((NMLTYPE) 513)
00216 #define EMC_TASK_PLAN_CLOSE_TYPE                     ((NMLTYPE) 514)
00217 #define EMC_TASK_PLAN_INIT_TYPE                      ((NMLTYPE) 515)
00218 #define EMC_TASK_PLAN_SYNCH_TYPE                     ((NMLTYPE) 516)
00219 
00220 #define EMC_TASK_STAT_TYPE                           ((NMLTYPE) 599)
00221 
00222 // EMC_TOOL type declarations
00223 
00224 #define EMC_TOOL_INIT_TYPE                           ((NMLTYPE) 1101)
00225 #define EMC_TOOL_HALT_TYPE                           ((NMLTYPE) 1102)
00226 #define EMC_TOOL_ABORT_TYPE                          ((NMLTYPE) 1103)
00227 #define EMC_TOOL_PREPARE_TYPE                        ((NMLTYPE) 1104)
00228 #define EMC_TOOL_LOAD_TYPE                           ((NMLTYPE) 1105)
00229 #define EMC_TOOL_UNLOAD_TYPE                         ((NMLTYPE) 1106)
00230 #define EMC_TOOL_LOAD_TOOL_TABLE_TYPE                ((NMLTYPE) 1107)
00231 #define EMC_TOOL_SET_OFFSET_TYPE                     ((NMLTYPE) 1108)
00232 
00233 #define EMC_TOOL_STAT_TYPE                           ((NMLTYPE) 1199)
00234 
00235 // EMC_AUX type declarations
00236 
00237 #define EMC_AUX_INIT_TYPE                             ((NMLTYPE) 1201)
00238 #define EMC_AUX_HALT_TYPE                             ((NMLTYPE) 1202)
00239 #define EMC_AUX_ABORT_TYPE                            ((NMLTYPE) 1203)
00240 #define EMC_AUX_DIO_WRITE_TYPE                        ((NMLTYPE) 1204)
00241 #define EMC_AUX_AIO_WRITE_TYPE                        ((NMLTYPE) 1205)
00242 #define EMC_AUX_ESTOP_ON_TYPE                         ((NMLTYPE) 1206)
00243 #define EMC_AUX_ESTOP_OFF_TYPE                        ((NMLTYPE) 1207)
00244 
00245 #define EMC_AUX_STAT_TYPE                             ((NMLTYPE) 1299)
00246 
00247 // EMC_SPINDLE type declarations
00248 
00249 #define EMC_SPINDLE_INIT_TYPE                        ((NMLTYPE) 1301)
00250 #define EMC_SPINDLE_HALT_TYPE                        ((NMLTYPE) 1302)
00251 #define EMC_SPINDLE_ABORT_TYPE                       ((NMLTYPE) 1303)
00252 #define EMC_SPINDLE_ON_TYPE                          ((NMLTYPE) 1304)
00253 #define EMC_SPINDLE_OFF_TYPE                         ((NMLTYPE) 1305)
00254 #define EMC_SPINDLE_FORWARD_TYPE                     ((NMLTYPE) 1306)
00255 #define EMC_SPINDLE_REVERSE_TYPE                     ((NMLTYPE) 1307)
00256 #define EMC_SPINDLE_STOP_TYPE                        ((NMLTYPE) 1308)
00257 #define EMC_SPINDLE_INCREASE_TYPE                    ((NMLTYPE) 1309)
00258 #define EMC_SPINDLE_DECREASE_TYPE                    ((NMLTYPE) 1310)
00259 #define EMC_SPINDLE_CONSTANT_TYPE                    ((NMLTYPE) 1311)
00260 #define EMC_SPINDLE_BRAKE_RELEASE_TYPE               ((NMLTYPE) 1312)
00261 #define EMC_SPINDLE_BRAKE_ENGAGE_TYPE                ((NMLTYPE) 1313)
00262 #define EMC_SPINDLE_ENABLE_TYPE                      ((NMLTYPE) 1314)
00263 #define EMC_SPINDLE_DISABLE_TYPE                     ((NMLTYPE) 1315)
00264 
00265 #define EMC_SPINDLE_STAT_TYPE                        ((NMLTYPE) 1399)
00266 
00267 // EMC_COOLANT type declarations
00268 
00269 #define EMC_COOLANT_INIT_TYPE                        ((NMLTYPE) 1401)
00270 #define EMC_COOLANT_HALT_TYPE                        ((NMLTYPE) 1402)
00271 #define EMC_COOLANT_ABORT_TYPE                       ((NMLTYPE) 1403)
00272 #define EMC_COOLANT_MIST_ON_TYPE                     ((NMLTYPE) 1404)
00273 #define EMC_COOLANT_MIST_OFF_TYPE                    ((NMLTYPE) 1405)
00274 #define EMC_COOLANT_FLOOD_ON_TYPE                    ((NMLTYPE) 1406)
00275 #define EMC_COOLANT_FLOOD_OFF_TYPE                   ((NMLTYPE) 1407)
00276 
00277 #define EMC_COOLANT_STAT_TYPE                        ((NMLTYPE) 1499)
00278 
00279 // EMC_LUBE type declarations
00280 
00281 #define EMC_LUBE_INIT_TYPE                           ((NMLTYPE) 1501)
00282 #define EMC_LUBE_HALT_TYPE                           ((NMLTYPE) 1502)
00283 #define EMC_LUBE_ABORT_TYPE                          ((NMLTYPE) 1503)
00284 #define EMC_LUBE_ON_TYPE                             ((NMLTYPE) 1504)
00285 #define EMC_LUBE_OFF_TYPE                            ((NMLTYPE) 1505)
00286 
00287 #define EMC_LUBE_STAT_TYPE                           ((NMLTYPE) 1599)
00288 
00289 // EMC IO point configuration declarations
00290 
00291 #define EMC_SET_DIO_INDEX_TYPE                       ((NMLTYPE) 5001)
00292 #define EMC_SET_AIO_INDEX_TYPE                       ((NMLTYPE) 5002)
00293 #define EMC_SET_POLARITY_TYPE                        ((NMLTYPE) 5003)
00294 
00295 // digital IO point indices
00296 enum {
00297   // spindle
00298   EMC_SET_DIO_INDEX_SPINDLE_FORWARD = 5101,
00299   EMC_SET_DIO_INDEX_SPINDLE_REVERSE,
00300   EMC_SET_DIO_INDEX_SPINDLE_DECREASE,
00301   EMC_SET_DIO_INDEX_SPINDLE_INCREASE,
00302   EMC_SET_DIO_INDEX_SPINDLE_BRAKE,
00303   EMC_SET_DIO_INDEX_SPINDLE_ENABLE,
00304   // coolant
00305   EMC_SET_DIO_INDEX_COOLANT_MIST,
00306   EMC_SET_DIO_INDEX_COOLANT_FLOOD,
00307   // lube
00308   EMC_SET_DIO_INDEX_LUBE_SENSE,
00309   // aux
00310   EMC_SET_DIO_INDEX_ESTOP_SENSE,
00311   EMC_SET_DIO_INDEX_ESTOP_WRITE
00312 };
00313 
00314 // analog IO point indices
00315 enum {
00316   // spindle
00317   EMC_SET_AIO_INDEX_SPINDLE_ON = 5201
00318 };
00319 
00320 // IO point polarities
00321 enum {
00322   // axis
00323   EMC_SET_POLARITY_AXIS_ENABLE = 5301,
00324   EMC_SET_POLARITY_AXIS_MIN_LIMIT_SWITCH,
00325   EMC_SET_POLARITY_AXIS_MAX_LIMIT_SWITCH,
00326   EMC_SET_POLARITY_AXIS_HOME_SWITCH,
00327   EMC_SET_POLARITY_AXIS_HOMING,
00328   EMC_SET_POLARITY_AXIS_FAULT,
00329   // spindle
00330   EMC_SET_POLARITY_SPINDLE_FORWARD,
00331   EMC_SET_POLARITY_SPINDLE_REVERSE,
00332   EMC_SET_POLARITY_SPINDLE_DECREASE,
00333   EMC_SET_POLARITY_SPINDLE_INCREASE,
00334   EMC_SET_POLARITY_SPINDLE_BRAKE,
00335   EMC_SET_POLARITY_SPINDLE_ENABLE,
00336   // coolant
00337   EMC_SET_POLARITY_COOLANT_MIST,
00338   EMC_SET_POLARITY_COOLANT_FLOOD,
00339   // lube
00340   EMC_SET_POLARITY_LUBE_SENSE,
00341   // aux
00342   EMC_SET_POLARITY_ESTOP_SENSE,
00343   EMC_SET_POLARITY_ESTOP_WRITE
00344 };
00345 
00346 // EMC_IO aggregate class type declaration
00347 
00348 #define EMC_IO_INIT_TYPE                             ((NMLTYPE) 1601)
00349 #define EMC_IO_HALT_TYPE                             ((NMLTYPE) 1602)
00350 #define EMC_IO_ABORT_TYPE                            ((NMLTYPE) 1603)
00351 #define EMC_IO_SET_CYCLE_TIME_TYPE                   ((NMLTYPE) 1604)
00352 
00353 #define EMC_IO_STAT_TYPE                             ((NMLTYPE) 1699)
00354 
00355 // EMC aggregate class type declaration
00356 
00357 #define EMC_LOG_FILENAME_LEN 256 // how long a file name can be
00358 
00359 // types of data that can be logged
00360 #define EMC_LOG_TYPE_AXIS_POS     1 // single axis cmd/actual pos
00361 #define EMC_LOG_TYPE_AXES_INPOS   2 // all axes actual input pos
00362 #define EMC_LOG_TYPE_AXES_OUTPOS  3 // all axes commanded output pos
00363 #define EMC_LOG_TYPE_MOTION_CMD   4 // command into EMC motion controller
00364 #define EMC_LOG_TYPE_AXIS_VEL     5 // single axis cmd/actual vel
00365 #define EMC_LOG_TYPE_AXES_FERROR  6 // all axes following error
00366 #define EMC_LOG_TYPE_TRAJ_POS     7 // trajectory Cartesian points
00367 #define EMC_LOG_TYPE_TRAJ_VEL     8 // trajectory Cartesian vel diffs
00368 #define EMC_LOG_TYPE_TRAJ_ACC     9 // trajectory Cartesian accel diffs
00369 #define EMC_LOG_TYPE_POS_VOLTAGE 10 // input position and output voltage
00370 // these are placeholders
00371 #define EMC_LOG_TYPE_IO_CMD      21 // command into EMC IO controller
00372 #define EMC_LOG_TYPE_TASK_CMD    51 // command into EMC Task controller
00373 
00374 #define EMC_INIT_TYPE                                ((NMLTYPE) 1901)
00375 #define EMC_HALT_TYPE                                ((NMLTYPE) 1902)
00376 #define EMC_ABORT_TYPE                               ((NMLTYPE) 1903)
00377 #define EMC_LOG_OPEN_TYPE                            ((NMLTYPE) 1904)
00378 #define EMC_LOG_START_TYPE                           ((NMLTYPE) 1905)
00379 #define EMC_LOG_STOP_TYPE                            ((NMLTYPE) 1906)
00380 #define EMC_LOG_CLOSE_TYPE                           ((NMLTYPE) 1907)
00381 
00382 #define EMC_STAT_TYPE                                ((NMLTYPE) 1999)
00383 
00384 // --------------
00385 // EMC VOCABULARY
00386 // --------------
00387 
00388 // NML formatting function
00389 extern int emcFormat(NMLTYPE type, void * buffer, CMS * cms);
00390 
00391 // NML Symbol Lookup Function
00392 extern const char * emc_symbol_lookup(int type);
00393 #define emcSymbolLookup(a) emc_symbol_lookup(a)
00394 
00395 // decls for command line args-- mains are responsible for setting these
00396 // so that other modules can get cmd line args for ad hoc processing
00397 extern int Argc;
00398 extern char **Argv;
00399 
00400 // ------------------------
00401 // IMPLEMENTATION FUNCTIONS
00402 // ------------------------
00403 
00404 // implementation functions for EMC error, message types
00405 // intended to be implemented in main() file, by writing to NML buffer
00406 
00407 // print an error
00408 extern int emcOperatorError(int id, const char *fmt, ...);
00409 
00410 // print general text
00411 extern int emcOperatorText(int id, const char *fmt, ...);
00412 
00413 // print note to operator
00414 extern int emcOperatorDisplay(int id, const char *fmt, ...);
00415 
00416 // implementation functions for EMC_AXIS types
00417 
00418 extern int emcAxisSetAxis(int axis, unsigned char axisType);
00419 extern int emcAxisSetUnits(int axis, double units);
00420 extern int emcAxisSetGains(int axis, double p, double i, double d,
00421                 double ff0, double ff1, double ff2,
00422                 double backlash, double bias, double maxError,
00423                 double deadband);
00424 extern int emcAxisSetCycleTime(int axis, double cycleTime);
00425 extern int emcAxisSetInterpolationRate(int axis, int rate);
00426 extern int emcAxisSetInputScale(int axis, double scale, double offset);
00427 extern int emcAxisSetOutputScale(int axis, double scale, double offset);
00428 extern int emcAxisSetMinPositionLimit(int axis, double limit);
00429 extern int emcAxisSetMaxPositionLimit(int axis, double limit);
00430 extern int emcAxisSetMinOutputLimit(int axis, double limit);
00431 extern int emcAxisSetMaxOutputLimit(int axis, double limit);
00432 extern int emcAxisSetFerror(int axis, double ferror);
00433 extern int emcAxisSetMinFerror(int axis, double ferror);
00434 extern int emcAxisSetHomingVel(int axis, double homingVel);
00435 extern int emcAxisSetHome(int axis, double home);
00436 extern int emcAxisSetHomeOffset(int axis, double offset);
00437 extern int emcAxisSetMaxVelocity(int axis, double vel);
00438 extern int emcAxisSetEnablePolarity(int axis, int level);
00439 extern int emcAxisSetMinLimitSwitchPolarity(int axis, int level);
00440 extern int emcAxisSetMaxLimitSwitchPolarity(int axis, int level);
00441 extern int emcAxisSetHomeSwitchPolarity(int axis, int level);
00442 extern int emcAxisSetHomingPolarity(int axis, int level);
00443 extern int emcAxisSetFaultPolarity(int axis, int level);
00444 
00445 extern int emcAxisInit(int axis);
00446 extern int emcAxisHalt(int axis);
00447 extern int emcAxisAbort(int axis);
00448 extern int emcAxisEnable(int axis);
00449 extern int emcAxisDisable(int axis);
00450 extern int emcAxisHome(int axis);
00451 extern int emcAxisJog(int axis, double vel);
00452 extern int emcAxisIncrJog(int axis, double incr, double vel);
00453 extern int emcAxisAbsJog(int axis, double pos, double vel);
00454 extern int emcAxisActivate(int axis);
00455 extern int emcAxisDeactivate(int axis);
00456 extern int emcAxisOverrideLimits(int axis);
00457 extern int emcAxisSetOutput(int axis, double output);
00458 extern int emcAxisLoadComp(int axis, const char *file);
00459 extern int emcAxisAlter(int axis, double alter);
00460 
00461 class EMC_AXIS_STAT;            // forward decl
00462 extern int emcAxisUpdate(EMC_AXIS_STAT stat[], int numAxes);
00463 
00464 // implementation functions for EMC_TRAJ types
00465 
00466 extern int emcTrajSetAxes(int axes);
00467 extern int emcTrajSetUnits(double linearUnits, double angularUnits);
00468 extern int emcTrajSetCycleTime(double cycleTime);
00469 extern int emcTrajSetMode(int axes);
00470 extern int emcTrajSetTeleopVector(EmcPose vel);
00471 extern int emcTrajSetVelocity(double vel);
00472 extern int emcTrajSetAcceleration(double acc);
00473 extern int emcTrajSetMaxVelocity(double vel);
00474 extern int emcTrajSetMaxAcceleration(double acc);
00475 extern int emcTrajSetScale(double scale);
00476 extern int emcTrajSetMotionId(int id);
00477 
00478 extern int emcTrajInit();
00479 extern int emcTrajHalt();
00480 extern int emcTrajEnable();
00481 extern int emcTrajDisable();
00482 extern int emcTrajAbort();
00483 extern int emcTrajPause();
00484 extern int emcTrajStep();
00485 extern int emcTrajResume();
00486 extern int emcTrajDelay(double delay);
00487 extern int emcTrajLinearMove(EmcPose end);
00488 extern int emcTrajCircularMove(EmcPose end, PM_CARTESIAN center, PM_CARTESIAN normal, int turn);
00489 extern int emcTrajSetTermCond(int cond);
00490 extern int emcTrajSetOffset(EmcPose offset);
00491 extern int emcTrajSetOrigin(EmcPose origin);
00492 extern int emcTrajSetHome(EmcPose home);
00493 extern int emcTrajSetProbeIndex(int index);
00494 extern int emcTrajSetProbePolarity(int polarity);
00495 extern int emcTrajClearProbeTrippedFlag();
00496 extern int emcTrajProbe(EmcPose pos);
00497 
00498 class EMC_TRAJ_STAT;            // forward decl
00499 extern int emcTrajUpdate(EMC_TRAJ_STAT *stat);
00500 
00501 // implementation functions for EMC_MOTION aggregate types
00502 
00503 extern int emcMotionInit();
00504 extern int emcMotionHalt();
00505 extern int emcMotionAbort();
00506 extern int emcMotionSetDebug(int debug);
00507 extern int emcMotionSetAout(unsigned char index, double start, double end);
00508 extern int emcMotionSetDout(unsigned char index, unsigned char start, unsigned char end);
00509 
00510 class EMC_MOTION_STAT;          // forward decl
00511 extern int emcMotionUpdate(EMC_MOTION_STAT *stat);
00512 
00513 // implementation functions for EMC_TASK types
00514 
00515 extern int emcTaskInit();
00516 extern int emcTaskHalt();
00517 extern int emcTaskAbort();
00518 extern int emcTaskSetMode(int mode);
00519 extern int emcTaskSetState(int state);
00520 extern int emcTaskPlanInit();
00521 extern int emcTaskPlanSetWait();
00522 extern int emcTaskPlanIsWait();
00523 extern int emcTaskPlanClearWait();
00524 extern int emcTaskPlanSynch();
00525 extern int emcTaskPlanExit();
00526 extern int emcTaskPlanOpen(const char *file);
00527 extern int emcTaskPlanRead();
00528 extern int emcTaskPlanRun(int line);
00529 extern int emcTaskPlanExecute(const char *command);
00530 extern int emcTaskPlanPause();
00531 extern int emcTaskPlanResume();
00532 extern int emcTaskPlanClose();
00533 
00534 extern int emcTaskPlanLine();
00535 extern int emcTaskPlanCommand(char *cmd);
00536 
00537 class EMC_TASK_STAT;            // forward decl
00538 extern int emcTaskUpdate(EMC_TASK_STAT *stat);
00539 
00540 // implementation functions for EMC_TOOL types
00541 
00542 extern int emcToolInit();
00543 extern int emcToolHalt();
00544 extern int emcToolAbort();
00545 extern int emcToolPrepare(int tool);
00546 extern int emcToolLoad();
00547 extern int emcToolUnload();
00548 extern int emcToolLoadToolTable(const char *file);
00549 extern int emcToolSetOffset(int tool, double length, double diameter);
00550 
00551 extern int emcToolSetToolTableFile(const char *file);
00552 
00553 class EMC_TOOL_STAT;            // forward decl
00554 extern int emcToolUpdate(EMC_TOOL_STAT *stat);
00555 
00556 // implementation functions for EMC_AUX types
00557 
00558 extern int emcAuxInit();
00559 extern int emcAuxHalt();
00560 extern int emcAuxAbort();
00561 extern int emcAuxDioWrite(int index, int value);
00562 extern int emcAuxAioWrite(int index, double value);
00563 extern int emcAuxEstopOn();
00564 extern int emcAuxEstopOff();
00565 
00566 extern int emcAuxEstopSetSenseIndex(int index);
00567 extern int emcAuxEstopSetWriteIndex(int index);
00568 
00569 extern int emcAuxEstopSetSensePolarity(int polarity);
00570 extern int emcAuxEstopSetWritePolarity(int polarity);
00571 
00572 class EMC_AUX_STAT;             // forward decl
00573 extern int emcAuxUpdate(EMC_AUX_STAT *stat);
00574 
00575 // implementation functions for EMC_SPINDLE types
00576 
00577 extern int emcSpindleInit();
00578 extern int emcSpindleHalt();
00579 extern int emcSpindleAbort();
00580 extern int emcSpindleOn(double speed);
00581 extern int emcSpindleOff();
00582 extern int emcSpindleForward();
00583 extern int emcSpindleReverse();
00584 extern int emcSpindleStop();
00585 extern int emcSpindleIncrease();
00586 extern int emcSpindleDecrease();
00587 extern int emcSpindleConstant();
00588 extern int emcSpindleBrakeRelease();
00589 extern int emcSpindleBrakeEngage();
00590 extern int emcSpindleEnable();
00591 extern int emcSpindleDisable();
00592 
00593 extern int emcSpindleSetForwardIndex(int index);
00594 extern int emcSpindleSetReverseIndex(int index);
00595 extern int emcSpindleSetDecreaseIndex(int index);
00596 extern int emcSpindleSetIncreaseIndex(int index);
00597 extern int emcSpindleSetBrakeIndex(int index);
00598 extern int emcSpindleSetEnableIndex(int index);
00599 
00600 extern int emcSpindleSetOnIndex(int index);
00601 
00602 extern int emcSpindleSetForwardPolarity(int polarity);
00603 extern int emcSpindleSetReversePolarity(int polarity);
00604 extern int emcSpindleSetDecreasePolarity(int polarity);
00605 extern int emcSpindleSetIncreasePolarity(int polarity);
00606 extern int emcSpindleSetBrakePolarity(int polarity);
00607 extern int emcSpindleSetEnablePolarity(int polarity);
00608 
00609 extern int emcSpindleSetOffWait(double wait);
00610 extern int emcSpindleSetOnWait(double wait);
00611 
00612 class EMC_SPINDLE_STAT;         // forward decl
00613 extern int emcSpindleUpdate(EMC_SPINDLE_STAT *stat);
00614 
00615 // implementation functions for EMC_COOLANT types
00616 
00617 extern int emcCoolantInit();
00618 extern int emcCoolantHalt();
00619 extern int emcCoolantAbort();
00620 extern int emcCoolantMistOn();
00621 extern int emcCoolantMistOff();
00622 extern int emcCoolantFloodOn();
00623 extern int emcCoolantFloodOff();
00624 
00625 extern int emcCoolantSetMistIndex(int index);
00626 extern int emcCoolantSetFloodIndex(int index);
00627 
00628 extern int emcCoolantSetMistPolarity(int polarity);
00629 extern int emcCoolantSetFloodPolarity(int polarity);
00630 
00631 class EMC_COOLANT_STAT;         // forward decl
00632 extern int emcCoolantUpdate(EMC_COOLANT_STAT *stat);
00633 
00634 // implementation functions for EMC_LUBE types
00635 
00636 extern int emcLubeInit();
00637 extern int emcLubeHalt();
00638 extern int emcLubeAbort();
00639 extern int emcLubeOn();
00640 extern int emcLubeOff();
00641 
00642 extern int emcLubeSetSenseIndex(int index);
00643 extern int emcLubeSetSensePolarity(int polarity);
00644 extern int emcLubeSetWriteIndex(int index);
00645 extern int emcLubeSetWritePolarity(int polarity);
00646 
00647 class EMC_LUBE_STAT;    // forward decl
00648 extern int emcLubeUpdate(EMC_LUBE_STAT *stat);
00649 
00650 // implementation functions for EMC_IO types
00651 
00652 extern int emcIoInit();
00653 extern int emcIoHalt();
00654 extern int emcIoAbort();
00655 extern int emcIoSetCycleTime(double cycleTime);
00656 extern int emcIoSetDebug(int debug);
00657 
00658 class EMC_IO_STAT;      // forward decl
00659 extern int emcIoUpdate(EMC_IO_STAT *stat);
00660 
00661 // implementation functions for EMC aggregate types
00662 
00663 extern int emcInit();
00664 extern int emcHalt();
00665 extern int emcAbort();
00666 extern int emcLogOpen(char *file, int type, int size, int skip, int which,
00667                       int triggerType, int triggerVar, double triggerThreshold);
00668 extern int emcLogStart();
00669 extern int emcLogStop();
00670 extern int emcLogClose();
00671 
00672 class EMC_STAT;         // forward decl
00673 extern int emcUpdate(EMC_STAT *stat);
00674 
00675 // ------------------
00676 // CLASS DECLARATIONS
00677 // ------------------
00678 
00679 // declarations for EMC general classes
00680 
00681 
00682 #define EMC_OPERATOR_ERROR_LEN 256
00683 
00684 /**
00685  * Send a textual error message to the operator.
00686  * The message is put in the errlog buffer to be read by the GUI.
00687  * This allows the controller a generic way to send error messages to
00688  * the operator.
00689  */
00690 class EMC_OPERATOR_ERROR : public RCS_CMD_MSG
00691 {
00692 public:
00693   EMC_OPERATOR_ERROR() : RCS_CMD_MSG(EMC_OPERATOR_ERROR_TYPE, sizeof(EMC_OPERATOR_ERROR)) {};
00694 
00695   // For internal NML/CMS use only.
00696   void update(CMS *cms);
00697 
00698   int id;
00699   char error[EMC_OPERATOR_ERROR_LEN];
00700 };
00701 
00702 #define EMC_OPERATOR_TEXT_LEN 256
00703 
00704 /**
00705  * Send a textual information message to the operator.
00706  * This is similiar to EMC_OPERATOR_ERROR message except that the messages are
00707  * sent in situations not necessarily considered to be errors.
00708  */
00709 class EMC_OPERATOR_TEXT : public RCS_CMD_MSG
00710 {
00711 public:
00712   EMC_OPERATOR_TEXT() : RCS_CMD_MSG(EMC_OPERATOR_TEXT_TYPE, sizeof(EMC_OPERATOR_TEXT)) {};
00713 
00714   // For internal NML/CMS use only.
00715   void update(CMS *cms);
00716 
00717   int id;
00718   char text[EMC_OPERATOR_TEXT_LEN];
00719 };
00720 
00721 
00722 #define EMC_OPERATOR_DISPLAY_LEN 256
00723 
00724 /**
00725  * Send the URL or filename of a document to display.
00726  * This message is placed in the errlog buffer  to be read by the GUI.
00727  * If the GUI is capable of doing so it will show the operator a
00728  * previously created document, using the URL or filename provided.
00729  * This message is placed in the errlog channel to be read by the GUI.
00730  * This provides a general means of reporting an error from within the
00731  * controller without having to program the GUI to recognize each error type.
00732  */
00733 class EMC_OPERATOR_DISPLAY : public RCS_CMD_MSG
00734 {
00735 public:
00736   EMC_OPERATOR_DISPLAY(): RCS_CMD_MSG(EMC_OPERATOR_DISPLAY_TYPE, sizeof(EMC_OPERATOR_DISPLAY)) {};
00737 
00738   // For internal NML/CMS use only.
00739   void update(CMS *cms);
00740 
00741   int id;
00742   char display[EMC_OPERATOR_DISPLAY_LEN];
00743 };
00744 
00745 
00746 class EMC_NULL : public RCS_CMD_MSG
00747 {
00748 public:
00749   EMC_NULL(): RCS_CMD_MSG(EMC_NULL_TYPE, sizeof(EMC_NULL)) {};
00750 
00751   // For internal NML/CMS use only.
00752   void update(CMS *cms);
00753 };
00754 
00755 class EMC_SET_DEBUG : public RCS_CMD_MSG
00756 {
00757 public:
00758   EMC_SET_DEBUG(): RCS_CMD_MSG(EMC_SET_DEBUG_TYPE, sizeof(EMC_SET_DEBUG)) {};
00759 
00760   // For internal NML/CMS use only.
00761   void update(CMS *cms);
00762 
00763   int debug;
00764 };
00765 
00766 // declarations for EMC_AXIS classes
00767 
00768 /*
00769  * AXIS command base class.
00770  * This is the base class for all commands that operate on a single axis.
00771  * The axis parameter specifies which axis the command affects.
00772  * These commands are sent to the emcCommand buffer to be read by the
00773  * TASK program that will then pass along corresponding messages to the
00774  * motion system.
00775  */
00776 class EMC_AXIS_CMD_MSG : public RCS_CMD_MSG
00777 {
00778 public:
00779   EMC_AXIS_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
00780 
00781   // For internal NML/CMS use only.
00782   void update(CMS *cms);
00783 
00784   // 0 = X, 1 = Y, 2 = Z, etc.
00785   int axis;
00786 };
00787 
00788 // values for EMC_AXIS_SET_AXIS, axisType
00789 #define EMC_AXIS_LINEAR 1
00790 #define EMC_AXIS_ANGULAR 2
00791 
00792 /**
00793  * Set the axis type to linear or angular.
00794  * Similiar to the AXIS_TYPE field in the ".ini" file.
00795  */
00796 class EMC_AXIS_SET_AXIS : public EMC_AXIS_CMD_MSG
00797 {
00798 public:
00799   EMC_AXIS_SET_AXIS() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_AXIS_TYPE, sizeof(EMC_AXIS_SET_AXIS)) {};
00800 
00801   // For internal NML/CMS use only.
00802   void update(CMS *cms);
00803 
00804   // EMC_AXIS_LINEAR, EMC_AXIS_ANGULAR
00805   unsigned char axisType;
00806 };
00807 
00808 /**
00809  * Set the units conversion factor.
00810  * @see EMC_AXIS_SET_INPUT_SCALE
00811  */
00812 class EMC_AXIS_SET_UNITS : public EMC_AXIS_CMD_MSG
00813 {
00814 public:
00815   EMC_AXIS_SET_UNITS() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_UNITS_TYPE, sizeof(EMC_AXIS_SET_UNITS)) {};
00816 
00817   // For internal NML/CMS use only.
00818   void update(CMS *cms);
00819 
00820   // units per mm, deg for linear, angular
00821   double units;
00822 };
00823 
00824 /**
00825  * Set the PID gains.
00826  * This command sets the PID gains as well as a few other parameters used
00827  * by the PID compensator.
00828  */
00829 class EMC_AXIS_SET_GAINS : public EMC_AXIS_CMD_MSG
00830 {
00831 public:
00832   EMC_AXIS_SET_GAINS() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_GAINS_TYPE, sizeof(EMC_AXIS_SET_GAINS)) {};
00833 
00834   // For internal NML/CMS use only.
00835   void update(CMS *cms);
00836 
00837   double p;
00838   double i;
00839   double d;
00840   double ff0;
00841   double ff1;
00842   double ff2;
00843   double backlash;
00844   double bias;
00845   double maxError;
00846   double deadband;
00847 };
00848 
00849 /**
00850  * Set the cycle time for the servo task.
00851  * Increase this value to get more CPU time for running low-priority tasks,
00852  * decrease it to get more precise control of the motion.
00853  * There is only one cycle time that applies to all axis, so you might as well
00854  * set the axis parameter to zero.
00855  */
00856 class EMC_AXIS_SET_CYCLE_TIME : public EMC_AXIS_CMD_MSG
00857 {
00858 public:
00859   EMC_AXIS_SET_CYCLE_TIME() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_CYCLE_TIME_TYPE, sizeof(EMC_AXIS_SET_CYCLE_TIME)) {};
00860 
00861   // For internal NML/CMS use only.
00862   void update(CMS *cms);
00863 
00864   // PERIOD in seconds, between repeating the low level servo calculations.
00865   double cycleTime;
00866 };
00867 
00868 /**
00869  * Change the scale factor and offset for the position input.
00870  * This command sets the same value as the INPUT_SCALE parameter in the ".ini"
00871  * file.
00872  * These two values are the scale and offset factors for the axis input from
00873  * the raw feedback device, e.g., an incremental encoder. The second value
00874  * (offset) is subtracted from raw input (e.g., encoder counts), and
00875  * divided by the first value (scale factor), before being used as feedback.
00876  * The units on the scale value are in raw units (e.g., counts) per user units
00877  * (e.g., inch). The units on the offset value are in raw units(e.g., counts).
00878  *
00879  * Specifically, when reading inputs, the EMC first reads the raw sensor
00880  * values. The units on these values are the sensor units, typically
00881  * A/D counts, or encoder ticks. These units, and the location of their 0
00882  * value, will not in general correspond to the quasi-SI units used in the EMC. * Hence a scaling is done immediately upon sampling:
00883  *
00884  * input = (raw - offset) / scale
00885  *
00886  * The value for scale can be obtained analytically by doing a unit analysis,
00887  * i.e., units are [sensor units]/[desired input SI units]. For example, on
00888  * a 2000 counts per rev encoder, and 10 revs/inch gearing, and desired units
00889  * of mm, we have
00890  *
00891  * [scale units] = 2000 [counts/rev] * 10 [rev/inch] * 1/25.4 [inch/mm]
00892  * [scale units] = 787.4 counts/mm
00893  *
00894  * and, as a result,
00895  *
00896  * input [mm] = (encoder [counts] - offset [counts]) / 787.4 [counts/mm]
00897  *
00898  * Note that the units of the offset are in sensor units, e.g., counts, and
00899  * they are pre-subtracted from the sensor readings. The value for this offset
00900  * is obtained by finding the value of counts for which you want your user
00901  * units to read 0.0. This is normally accomplished automatically during a
00902  * homing procedure.
00903  *
00904  * Note that using this command to change the scale is not a good idea
00905  * once things have gotten underway, since the axis will
00906  * jump servo to the "new" position, the gains will no longer
00907  * be appropriate, etc.
00908  */
00909 class EMC_AXIS_SET_INPUT_SCALE : public EMC_AXIS_CMD_MSG
00910 {
00911 public:
00912   EMC_AXIS_SET_INPUT_SCALE() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_INPUT_SCALE_TYPE, sizeof(EMC_AXIS_SET_INPUT_SCALE)) {};
00913 
00914   // For internal NML/CMS use only.
00915   void update(CMS *cms);
00916 
00917   double scale, offset;
00918 };
00919 
00920 class EMC_AXIS_SET_OUTPUT_SCALE : public EMC_AXIS_CMD_MSG
00921 {
00922 public:
00923   EMC_AXIS_SET_OUTPUT_SCALE() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_OUTPUT_SCALE_TYPE, sizeof(EMC_AXIS_SET_OUTPUT_SCALE)) {};
00924 
00925   // For internal NML/CMS use only.
00926   void update(CMS *cms);
00927 
00928   double scale, offset;
00929 };
00930 
00931 class EMC_AXIS_SET_MIN_POSITION_LIMIT : public EMC_AXIS_CMD_MSG
00932 {
00933 public:
00934   EMC_AXIS_SET_MIN_POSITION_LIMIT() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MIN_POSITION_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MIN_POSITION_LIMIT)) {};
00935 
00936   // For internal NML/CMS use only.
00937   void update(CMS *cms);
00938 
00939   double limit;
00940 };
00941 
00942 class EMC_AXIS_SET_MAX_POSITION_LIMIT : public EMC_AXIS_CMD_MSG
00943 {
00944 public:
00945   EMC_AXIS_SET_MAX_POSITION_LIMIT() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MAX_POSITION_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MAX_POSITION_LIMIT)) {};
00946 
00947   // For internal NML/CMS use only.
00948   void update(CMS *cms);
00949 
00950   double limit;
00951 };
00952 
00953 class EMC_AXIS_SET_MIN_OUTPUT_LIMIT : public EMC_AXIS_CMD_MSG
00954 {
00955 public:
00956   EMC_AXIS_SET_MIN_OUTPUT_LIMIT() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MIN_OUTPUT_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MIN_OUTPUT_LIMIT)) {};
00957 
00958   // For internal NML/CMS use only.
00959   void update(CMS *cms);
00960 
00961   double limit;
00962 };
00963 
00964 class EMC_AXIS_SET_MAX_OUTPUT_LIMIT : public EMC_AXIS_CMD_MSG
00965 {
00966 public:
00967   EMC_AXIS_SET_MAX_OUTPUT_LIMIT() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MAX_OUTPUT_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MAX_OUTPUT_LIMIT)) {};
00968 
00969   // For internal NML/CMS use only.
00970   void update(CMS *cms);
00971 
00972   double limit;
00973 };
00974 
00975 class EMC_AXIS_SET_FERROR : public EMC_AXIS_CMD_MSG
00976 {
00977 public:
00978   EMC_AXIS_SET_FERROR() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_FERROR_TYPE, sizeof(EMC_AXIS_SET_FERROR)) {};
00979 
00980   // For internal NML/CMS use only.
00981   void update(CMS *cms);
00982 
00983   double ferror;
00984 };
00985 
00986 class EMC_AXIS_SET_MIN_FERROR : public EMC_AXIS_CMD_MSG
00987 {
00988 public:
00989   EMC_AXIS_SET_MIN_FERROR() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MIN_FERROR_TYPE, sizeof(EMC_AXIS_SET_MIN_FERROR)) {};
00990 
00991   // For internal NML/CMS use only.
00992   void update(CMS *cms);
00993 
00994   double ferror;
00995 };
00996 
00997 class EMC_AXIS_SET_HOMING_VEL : public EMC_AXIS_CMD_MSG
00998 {
00999 public:
01000   EMC_AXIS_SET_HOMING_VEL() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_HOMING_VEL_TYPE, sizeof(EMC_AXIS_SET_HOMING_VEL)) {};
01001 
01002   // For internal NML/CMS use only.
01003   void update(CMS *cms);
01004 
01005   double homingVel;
01006 };
01007 
01008 class EMC_AXIS_SET_HOME : public EMC_AXIS_CMD_MSG
01009 {
01010 public:
01011   EMC_AXIS_SET_HOME() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_HOME_TYPE, sizeof(EMC_AXIS_SET_HOME)) {};
01012 
01013   // For internal NML/CMS use only.
01014   void update(CMS *cms);
01015 
01016   double home;
01017 };
01018 
01019 class EMC_AXIS_SET_HOME_OFFSET : public EMC_AXIS_CMD_MSG
01020 {
01021 public:
01022   EMC_AXIS_SET_HOME_OFFSET() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_HOME_OFFSET_TYPE, sizeof(EMC_AXIS_SET_HOME_OFFSET)) {};
01023 
01024   // For internal NML/CMS use only.
01025   void update(CMS *cms);
01026 
01027   double offset;
01028 };
01029 
01030 class EMC_AXIS_SET_MAX_VELOCITY : public EMC_AXIS_CMD_MSG
01031 {
01032 public:
01033   EMC_AXIS_SET_MAX_VELOCITY() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_MAX_VELOCITY_TYPE, sizeof(EMC_AXIS_SET_MAX_VELOCITY)) {};
01034 
01035   // For internal NML/CMS use only.
01036   void update(CMS *cms);
01037 
01038   double vel;
01039 };
01040 
01041 class EMC_AXIS_INIT : public EMC_AXIS_CMD_MSG
01042 {
01043 public:
01044   EMC_AXIS_INIT() : EMC_AXIS_CMD_MSG(EMC_AXIS_INIT_TYPE, sizeof(EMC_AXIS_INIT)) {};
01045 
01046   // For internal NML/CMS use only.
01047   void update(CMS *cms);
01048 };
01049 
01050 class EMC_AXIS_HALT : public EMC_AXIS_CMD_MSG
01051 {
01052 public:
01053   EMC_AXIS_HALT() : EMC_AXIS_CMD_MSG(EMC_AXIS_HALT_TYPE, sizeof(EMC_AXIS_HALT)) {};
01054 
01055   // For internal NML/CMS use only.
01056   void update(CMS *cms);
01057 };
01058 
01059 class EMC_AXIS_ABORT : public EMC_AXIS_CMD_MSG
01060 {
01061 public:
01062   EMC_AXIS_ABORT() : EMC_AXIS_CMD_MSG(EMC_AXIS_ABORT_TYPE, sizeof(EMC_AXIS_ABORT)) {};
01063 
01064   // For internal NML/CMS use only.
01065   void update(CMS *cms);
01066 };
01067 
01068 class EMC_AXIS_ENABLE : public EMC_AXIS_CMD_MSG
01069 {
01070 public:
01071   EMC_AXIS_ENABLE() : EMC_AXIS_CMD_MSG(EMC_AXIS_ENABLE_TYPE, sizeof(EMC_AXIS_ENABLE)) {};
01072 
01073   // For internal NML/CMS use only.
01074   void update(CMS *cms);
01075 };
01076 
01077 class EMC_AXIS_DISABLE : public EMC_AXIS_CMD_MSG
01078 {
01079 public:
01080   EMC_AXIS_DISABLE() : EMC_AXIS_CMD_MSG(EMC_AXIS_DISABLE_TYPE, sizeof(EMC_AXIS_DISABLE)) {};
01081 
01082   // For internal NML/CMS use only.
01083   void update(CMS *cms);
01084 };
01085 
01086 class EMC_AXIS_HOME : public EMC_AXIS_CMD_MSG
01087 {
01088 public:
01089   EMC_AXIS_HOME() : EMC_AXIS_CMD_MSG(EMC_AXIS_HOME_TYPE, sizeof(EMC_AXIS_HOME)) {};
01090 
01091   // For internal NML/CMS use only.
01092   void update(CMS *cms);
01093 };
01094 
01095 class EMC_AXIS_JOG : public EMC_AXIS_CMD_MSG
01096 {
01097 public:
01098   EMC_AXIS_JOG() : EMC_AXIS_CMD_MSG(EMC_AXIS_JOG_TYPE, sizeof(EMC_AXIS_JOG)) {};
01099 
01100   // For internal NML/CMS use only.
01101   void update(CMS *cms);
01102 
01103   double vel;
01104 };
01105 
01106 class EMC_AXIS_INCR_JOG : public EMC_AXIS_CMD_MSG
01107 {
01108 public:
01109   EMC_AXIS_INCR_JOG() : EMC_AXIS_CMD_MSG(EMC_AXIS_INCR_JOG_TYPE, sizeof(EMC_AXIS_INCR_JOG)) {};
01110 
01111   // For internal NML/CMS use only.
01112   void update(CMS *cms);
01113 
01114   double incr;
01115   double vel;
01116 };
01117 
01118 class EMC_AXIS_ABS_JOG : public EMC_AXIS_CMD_MSG
01119 {
01120 public:
01121   EMC_AXIS_ABS_JOG() : EMC_AXIS_CMD_MSG(EMC_AXIS_ABS_JOG_TYPE, sizeof(EMC_AXIS_ABS_JOG)) {};
01122 
01123   // For internal NML/CMS use only.
01124   void update(CMS *cms);
01125 
01126   double pos;
01127   double vel;
01128 };
01129 
01130 class EMC_AXIS_ACTIVATE : public EMC_AXIS_CMD_MSG
01131 {
01132 public:
01133   EMC_AXIS_ACTIVATE() : EMC_AXIS_CMD_MSG(EMC_AXIS_ACTIVATE_TYPE, sizeof(EMC_AXIS_ACTIVATE)) {};
01134 
01135   // For internal NML/CMS use only.
01136   void update(CMS *cms);
01137 };
01138 
01139 class EMC_AXIS_DEACTIVATE : public EMC_AXIS_CMD_MSG
01140 {
01141 public:
01142   EMC_AXIS_DEACTIVATE() : EMC_AXIS_CMD_MSG(EMC_AXIS_DEACTIVATE_TYPE, sizeof(EMC_AXIS_DEACTIVATE)) {};
01143 
01144   // For internal NML/CMS use only.
01145   void update(CMS *cms);
01146 };
01147 
01148 class EMC_AXIS_OVERRIDE_LIMITS : public EMC_AXIS_CMD_MSG
01149 {
01150 public:
01151   EMC_AXIS_OVERRIDE_LIMITS() : EMC_AXIS_CMD_MSG(EMC_AXIS_OVERRIDE_LIMITS_TYPE, sizeof(EMC_AXIS_OVERRIDE_LIMITS)) {};
01152 
01153   // For internal NML/CMS use only.
01154   void update(CMS *cms);
01155 };
01156 
01157 class EMC_AXIS_SET_OUTPUT : public EMC_AXIS_CMD_MSG
01158 {
01159 public:
01160   EMC_AXIS_SET_OUTPUT() : EMC_AXIS_CMD_MSG(EMC_AXIS_SET_OUTPUT_TYPE, sizeof(EMC_AXIS_SET_OUTPUT)) {};
01161 
01162   // For internal NML/CMS use only.
01163   void update(CMS *cms);
01164 
01165   double output;                // value for output, in physical units (volts)
01166 };
01167 
01168 class EMC_AXIS_LOAD_COMP : public EMC_AXIS_CMD_MSG
01169 {
01170 public:
01171   EMC_AXIS_LOAD_COMP() : EMC_AXIS_CMD_MSG(EMC_AXIS_LOAD_COMP_TYPE, sizeof(EMC_AXIS_LOAD_COMP)) {};
01172 
01173   // For internal NML/CMS use only.
01174   void update(CMS *cms);
01175 
01176   char file[EMC_TASK_FILENAME_LEN];
01177 };
01178 
01179 class EMC_AXIS_ALTER : public EMC_AXIS_CMD_MSG
01180 {
01181 public:
01182   EMC_AXIS_ALTER() : EMC_AXIS_CMD_MSG(EMC_AXIS_ALTER_TYPE, sizeof(EMC_AXIS_ALTER)) {};
01183 
01184   // For internal NML/CMS use only.
01185   void update(CMS *cms);
01186 
01187   double alter;
01188 };
01189 
01190 // AXIS status base class
01191 class EMC_AXIS_STAT_MSG : public RCS_STAT_MSG
01192 {
01193 public:
01194   EMC_AXIS_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
01195 
01196   // For internal NML/CMS use only.
01197   void update(CMS *cms);
01198 
01199   int axis;
01200 };
01201 
01202 class EMC_AXIS_STAT : public EMC_AXIS_STAT_MSG
01203 {
01204 public:
01205   EMC_AXIS_STAT();
01206 
01207   // For internal NML/CMS use only.
01208   void update(CMS *cms);
01209 
01210   // configuration parameters
01211   unsigned char axisType;       // EMC_AXIS_LINEAR, EMC_AXIS_ANGULAR
01212   double units;                 // units per mm, deg for linear, angular
01213   double p;
01214   double i;
01215   double d;
01216   double ff0;
01217   double ff1;
01218   double ff2;
01219   double backlash;
01220   double bias;
01221   double maxError;
01222   double deadband;
01223   double cycleTime;
01224   double inputScale;
01225   double inputOffset;
01226   double outputScale;
01227   double outputOffset;
01228   double minPositionLimit;
01229   double maxPositionLimit;
01230   double minOutputLimit;
01231   double maxOutputLimit;
01232   double maxFerror;
01233   double minFerror;
01234   double homingVel;
01235   double homeOffset;
01236   unsigned char enablePolarity;
01237   unsigned char minLimitSwitchPolarity;
01238   unsigned char maxLimitSwitchPolarity;
01239   unsigned char homeSwitchPolarity;
01240   unsigned char homingPolarity;
01241   unsigned char faultPolarity;
01242 
01243   // dynamic status
01244   double setpoint;              // input to axis controller
01245   double ferrorCurrent;         // current following error
01246   double ferrorHighMark;        // magnitude of max following error
01247   double output;                // commanded output position
01248   double input;                 // current input position
01249   unsigned char inpos;          // non-zero means in position
01250   unsigned char homing;         // non-zero means homing
01251   unsigned char homed;          // non-zero means has been homed
01252   unsigned char fault;          // non-zero means axis amp fault
01253   unsigned char enabled;        // non-zero means enabled
01254   unsigned char minSoftLimit;   // non-zero means min soft limit exceeded
01255   unsigned char maxSoftLimit;   // non-zero means max soft limit exceeded
01256   unsigned char minHardLimit;   // non-zero means min hard limit exceeded
01257   unsigned char maxHardLimit;   // non-zero means max hard limit exceeded
01258   unsigned char overrideLimits; // non-zero means limits are overridden
01259   double scale;                 // velocity scale
01260   double alter;                 // external position alter value
01261 };
01262 
01263 // declarations for EMC_TRAJ classes
01264 
01265 // EMC_TRAJ command base class
01266 class EMC_TRAJ_CMD_MSG : public RCS_CMD_MSG
01267 {
01268 public:
01269   EMC_TRAJ_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
01270 
01271   // For internal NML/CMS use only.
01272   void update(CMS *cms);
01273 };
01274 
01275 class EMC_TRAJ_SET_UNITS : public EMC_TRAJ_CMD_MSG
01276 {
01277 public:
01278   EMC_TRAJ_SET_UNITS() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_UNITS_TYPE, sizeof(EMC_TRAJ_SET_UNITS)) {};
01279 
01280   // For internal NML/CMS use only.
01281   void update(CMS *cms);
01282 
01283   double linearUnits;           // units per mm
01284   double angularUnits;          // units per degree
01285 };
01286 
01287 class EMC_TRAJ_SET_AXES : public EMC_TRAJ_CMD_MSG
01288 {
01289 public:
01290   EMC_TRAJ_SET_AXES() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_AXES_TYPE, sizeof(EMC_TRAJ_SET_AXES)) {};
01291 
01292   // For internal NML/CMS use only.
01293   void update(CMS *cms);
01294 
01295   int axes;
01296 };
01297 
01298 class EMC_TRAJ_SET_CYCLE_TIME : public EMC_TRAJ_CMD_MSG
01299 {
01300 public:
01301   EMC_TRAJ_SET_CYCLE_TIME() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_CYCLE_TIME_TYPE, sizeof(EMC_TRAJ_SET_CYCLE_TIME)) {};
01302 
01303   // For internal NML/CMS use only.
01304   void update(CMS *cms);
01305 
01306   double cycleTime;
01307 };
01308 
01309 class EMC_TRAJ_SET_MODE : public EMC_TRAJ_CMD_MSG
01310 {
01311 public:
01312   EMC_TRAJ_SET_MODE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_MODE_TYPE, sizeof(EMC_TRAJ_SET_MODE)) {};
01313 
01314   // For internal NML/CMS use only.
01315   void update(CMS *cms);
01316 
01317   int mode;
01318 };
01319 
01320 class EMC_TRAJ_SET_VELOCITY : public EMC_TRAJ_CMD_MSG
01321 {
01322 public:
01323   EMC_TRAJ_SET_VELOCITY() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_VELOCITY_TYPE, sizeof(EMC_TRAJ_SET_VELOCITY)) {};
01324 
01325   // For internal NML/CMS use only.
01326   void update(CMS *cms);
01327 
01328   double velocity;
01329 };
01330 
01331 class EMC_TRAJ_SET_ACCELERATION : public EMC_TRAJ_CMD_MSG
01332 {
01333 public:
01334   EMC_TRAJ_SET_ACCELERATION() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_ACCELERATION_TYPE, sizeof(EMC_TRAJ_SET_ACCELERATION)) {};
01335 
01336   // For internal NML/CMS use only.
01337   void update(CMS *cms);
01338 
01339   double acceleration;
01340 };
01341 
01342 class EMC_TRAJ_SET_MAX_VELOCITY : public EMC_TRAJ_CMD_MSG
01343 {
01344 public:
01345   EMC_TRAJ_SET_MAX_VELOCITY() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_MAX_VELOCITY_TYPE, sizeof(EMC_TRAJ_SET_MAX_VELOCITY)) {};
01346 
01347   // For internal NML/CMS use only.
01348   void update(CMS *cms);
01349 
01350   double velocity;
01351 };
01352 
01353 class EMC_TRAJ_SET_MAX_ACCELERATION : public EMC_TRAJ_CMD_MSG
01354 {
01355 public:
01356   EMC_TRAJ_SET_MAX_ACCELERATION() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_MAX_ACCELERATION_TYPE, sizeof(EMC_TRAJ_SET_MAX_ACCELERATION)) {};
01357 
01358   // For internal NML/CMS use only.
01359   void update(CMS *cms);
01360 
01361   double acceleration;
01362 };
01363 
01364 class EMC_TRAJ_SET_SCALE : public EMC_TRAJ_CMD_MSG
01365 {
01366 public:
01367   EMC_TRAJ_SET_SCALE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_SCALE_TYPE, sizeof(EMC_TRAJ_SET_SCALE)) {};
01368 
01369   // For internal NML/CMS use only.
01370   void update(CMS *cms);
01371 
01372   double scale;
01373 };
01374 
01375 class EMC_TRAJ_SET_MOTION_ID : public EMC_TRAJ_CMD_MSG
01376 {
01377 public:
01378   EMC_TRAJ_SET_MOTION_ID() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_MOTION_ID_TYPE, sizeof(EMC_TRAJ_SET_MOTION_ID)) {};
01379 
01380   // For internal NML/CMS use only.
01381   void update(CMS *cms);
01382 
01383   int id;
01384 };
01385 
01386 class EMC_TRAJ_INIT : public EMC_TRAJ_CMD_MSG
01387 {
01388 public:
01389   EMC_TRAJ_INIT() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_INIT_TYPE, sizeof(EMC_TRAJ_INIT)) {};
01390 
01391   // For internal NML/CMS use only.
01392   void update(CMS *cms);
01393 };
01394 
01395 class EMC_TRAJ_HALT : public EMC_TRAJ_CMD_MSG
01396 {
01397 public:
01398   EMC_TRAJ_HALT() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_HALT_TYPE, sizeof(EMC_TRAJ_HALT)) {};
01399 
01400   // For internal NML/CMS use only.
01401   void update(CMS *cms);
01402 };
01403 
01404 class EMC_TRAJ_ENABLE : public EMC_TRAJ_CMD_MSG
01405 {
01406 public:
01407   EMC_TRAJ_ENABLE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_ENABLE_TYPE, sizeof(EMC_TRAJ_ENABLE)) {};
01408 
01409   // For internal NML/CMS use only.
01410   void update(CMS *cms);
01411 };
01412 
01413 class EMC_TRAJ_DISABLE : public EMC_TRAJ_CMD_MSG
01414 {
01415 public:
01416   EMC_TRAJ_DISABLE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_DISABLE_TYPE, sizeof(EMC_TRAJ_DISABLE)) {};
01417 
01418   // For internal NML/CMS use only.
01419   void update(CMS *cms);
01420 };
01421 
01422 class EMC_TRAJ_ABORT : public EMC_TRAJ_CMD_MSG
01423 {
01424 public:
01425   EMC_TRAJ_ABORT() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_ABORT_TYPE, sizeof(EMC_TRAJ_ABORT)) {};
01426 
01427   // For internal NML/CMS use only.
01428   void update(CMS *cms);
01429 };
01430 
01431 class EMC_TRAJ_PAUSE : public EMC_TRAJ_CMD_MSG
01432 {
01433 public:
01434   EMC_TRAJ_PAUSE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_PAUSE_TYPE, sizeof(EMC_TRAJ_PAUSE)) {};
01435 
01436   // For internal NML/CMS use only.
01437   void update(CMS *cms);
01438 };
01439 
01440 class EMC_TRAJ_STEP : public EMC_TRAJ_CMD_MSG
01441 {
01442 public:
01443   EMC_TRAJ_STEP() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_STEP_TYPE, sizeof(EMC_TRAJ_STEP)) {};
01444 
01445   // For internal NML/CMS use only.
01446   void update(CMS *cms);
01447 };
01448 
01449 class EMC_TRAJ_RESUME : public EMC_TRAJ_CMD_MSG
01450 {
01451 public:
01452   EMC_TRAJ_RESUME() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_RESUME_TYPE, sizeof(EMC_TRAJ_RESUME)) {};
01453 
01454   // For internal NML/CMS use only.
01455   void update(CMS *cms);
01456 };
01457 
01458 class EMC_TRAJ_DELAY : public EMC_TRAJ_CMD_MSG
01459 {
01460 public:
01461   EMC_TRAJ_DELAY() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_DELAY_TYPE, sizeof(EMC_TRAJ_DELAY)) {};
01462 
01463   // For internal NML/CMS use only.
01464   void update(CMS *cms);
01465 
01466   double delay;                 // delay in seconds
01467 };
01468 
01469 class EMC_TRAJ_LINEAR_MOVE : public EMC_TRAJ_CMD_MSG
01470 {
01471 public:
01472   EMC_TRAJ_LINEAR_MOVE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_LINEAR_MOVE_TYPE, sizeof(EMC_TRAJ_LINEAR_MOVE)) {};
01473 
01474   // For internal NML/CMS use only.
01475   void update(CMS *cms);
01476 
01477   EmcPose end;          // end point
01478 };
01479 
01480 class EMC_TRAJ_CIRCULAR_MOVE : public EMC_TRAJ_CMD_MSG
01481 {
01482 public:
01483   EMC_TRAJ_CIRCULAR_MOVE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_CIRCULAR_MOVE_TYPE, sizeof(EMC_TRAJ_CIRCULAR_MOVE)) {};
01484 
01485   // For internal NML/CMS use only.
01486   void update(CMS *cms);
01487 
01488   EmcPose end;
01489   PM_CARTESIAN center;
01490   PM_CARTESIAN normal;
01491   int turn;
01492 };
01493 
01494 class EMC_TRAJ_SET_TERM_COND : public EMC_TRAJ_CMD_MSG
01495 {
01496 public:
01497   EMC_TRAJ_SET_TERM_COND() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_TERM_COND_TYPE, sizeof(EMC_TRAJ_SET_TERM_COND)) {};
01498 
01499   // For internal NML/CMS use only.
01500   void update(CMS *cms);
01501 
01502   int cond;
01503 };
01504 
01505 class EMC_TRAJ_SET_OFFSET : public EMC_TRAJ_CMD_MSG
01506 {
01507 public:
01508   EMC_TRAJ_SET_OFFSET() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_OFFSET_TYPE, sizeof(EMC_TRAJ_SET_OFFSET)) {};
01509 
01510   // For internal NML/CMS use only.
01511   void update(CMS *cms);
01512 
01513   EmcPose offset;
01514 };
01515 
01516 class EMC_TRAJ_SET_ORIGIN : public EMC_TRAJ_CMD_MSG
01517 {
01518 public:
01519   EMC_TRAJ_SET_ORIGIN() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_ORIGIN_TYPE, sizeof(EMC_TRAJ_SET_ORIGIN)) {};
01520 
01521   // For internal NML/CMS use only.
01522   void update(CMS *cms);
01523 
01524   EmcPose origin;
01525 };
01526 
01527 class EMC_TRAJ_SET_HOME : public EMC_TRAJ_CMD_MSG
01528 {
01529 public:
01530   EMC_TRAJ_SET_HOME() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_HOME_TYPE, sizeof(EMC_TRAJ_SET_HOME)) {};
01531 
01532   // For internal NML/CMS use only.
01533   void update(CMS *cms);
01534 
01535   EmcPose home;
01536 };
01537 
01538 class EMC_TRAJ_SET_PROBE_INDEX : public EMC_TRAJ_CMD_MSG
01539 {
01540 public:
01541   EMC_TRAJ_SET_PROBE_INDEX() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_PROBE_INDEX_TYPE, sizeof(EMC_TRAJ_SET_PROBE_INDEX)) {};
01542 
01543   // For internal NML/CMS use only.
01544   void update(CMS *cms);
01545 
01546   int index;
01547 };
01548 
01549 class EMC_TRAJ_SET_PROBE_POLARITY : public EMC_TRAJ_CMD_MSG
01550 {
01551 public:
01552   EMC_TRAJ_SET_PROBE_POLARITY() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_PROBE_POLARITY_TYPE, sizeof(EMC_TRAJ_SET_PROBE_POLARITY)) {};
01553 
01554   // For internal NML/CMS use only.
01555   void update(CMS *cms);
01556 
01557   int polarity;
01558 };
01559 
01560 class EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG : public EMC_TRAJ_CMD_MSG
01561 {
01562 public:
01563   EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE, sizeof(EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG)) {};
01564 
01565   // For internal NML/CMS use only.
01566   void update(CMS *cms);
01567 };
01568 
01569 class EMC_TRAJ_SET_TELEOP_ENABLE : public EMC_TRAJ_CMD_MSG
01570 {
01571 public:
01572   EMC_TRAJ_SET_TELEOP_ENABLE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_TELEOP_ENABLE_TYPE, sizeof(EMC_TRAJ_SET_TELEOP_ENABLE)) {};
01573 
01574   // For internal NML/CMS use only.
01575   void update(CMS *cms);
01576 
01577   int enable;
01578 };
01579 
01580 class EMC_TRAJ_SET_TELEOP_VECTOR : public EMC_TRAJ_CMD_MSG
01581 {
01582 public:
01583   EMC_TRAJ_SET_TELEOP_VECTOR() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_TELEOP_VECTOR_TYPE, sizeof(EMC_TRAJ_SET_TELEOP_VECTOR)) {};
01584 
01585   // For internal NML/CMS use only.
01586   void update(CMS *cms);
01587 
01588   EmcPose vector;
01589 };
01590 
01591 
01592 
01593 
01594 class EMC_TRAJ_PROBE : public EMC_TRAJ_CMD_MSG
01595 {
01596 public:
01597   EMC_TRAJ_PROBE() : EMC_TRAJ_CMD_MSG(EMC_TRAJ_PROBE_TYPE, sizeof(EMC_TRAJ_PROBE)) {};
01598 
01599   // For internal NML/CMS use only.
01600   void update(CMS *cms);
01601 
01602   EmcPose pos;
01603 };
01604 
01605 
01606 // EMC_TRAJ status base class
01607 class EMC_TRAJ_STAT_MSG : public RCS_STAT_MSG
01608 {
01609 public:
01610   EMC_TRAJ_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
01611 
01612   // For internal NML/CMS use only.
01613   void update(CMS *cms);
01614 };
01615 
01616 // types for motion control
01617 #define EMC_TRAJ_MODE_FREE 1    // independent-axis motion
01618 #define EMC_TRAJ_MODE_COORD 2   // coordinated-axis motion
01619 #define EMC_TRAJ_MODE_TELEOP 3  // velocity based world coordinates motion
01620 
01621 class EMC_TRAJ_STAT : public EMC_TRAJ_STAT_MSG
01622 {
01623 public:
01624   EMC_TRAJ_STAT();
01625 
01626   // For internal NML/CMS use only.
01627   void update(CMS *cms);
01628 
01629   double linearUnits;           // units per mm
01630   double angularUnits;          // units per degree
01631   double cycleTime;             // cycle time, in seconds
01632   int axes;                     // number of axes in group
01633   int mode;                     // EMC_TRAJ_MODE_FREE, EMC_TRAJ_MODE_COORD
01634   int enabled;                  // non-zero means enabled
01635 
01636   int inpos;                    // non-zero means in position
01637   int queue;                    // number of pending motions, counting current
01638   int activeQueue;              // number of motions blending
01639   int queueFull;                // non-zero means can't accept another motion
01640   int id;                       // id of the currently executing motion
01641   int paused;                   // non-zero means motion paused
01642   double scale;                 // velocity scale factor
01643 
01644   EmcPose position;             // current commanded position
01645   EmcPose actualPosition;       // current actual position, from forward kins
01646   double velocity;              // system velocity, for subsequent motions
01647   double acceleration;          // system acceleration, for subsequent motions
01648   double maxVelocity;           // max system velocity
01649   double maxAcceleration;       // system acceleration
01650 
01651   EmcPose probedPosition;       // last position where probe was tripped.
01652   int probe_index;              // which wire or digital input is the probe on.
01653   int probe_polarity;           // which value should the probe look for to trip.
01654   int probe_tripped;            // Has the probe been tripped since the last clear.
01655   int probing;                  // Are we currently looking for a probe signal.
01656   int probeval;                 // Current value of probe input.
01657   int kinematics_type;          // identity=1,serial=2,parallel=3,custom=4
01658 };
01659 
01660 // emc_MOTION is aggregate of all EMC motion-related status classes
01661 
01662 // EMC_MOTION command base class
01663 class EMC_MOTION_CMD_MSG : public RCS_CMD_MSG
01664 {
01665 public:
01666   EMC_MOTION_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
01667 
01668   // For internal NML/CMS use only.
01669   void update(CMS *cms);
01670 };
01671 
01672 class EMC_MOTION_INIT : public EMC_MOTION_CMD_MSG
01673 {
01674 public:
01675   EMC_MOTION_INIT() : EMC_MOTION_CMD_MSG(EMC_MOTION_INIT_TYPE, sizeof(EMC_MOTION_INIT)) {};
01676 
01677   // For internal NML/CMS use only.
01678   void update(CMS *cms);
01679 };
01680 
01681 class EMC_MOTION_HALT : public EMC_MOTION_CMD_MSG
01682 {
01683 public:
01684   EMC_MOTION_HALT() : EMC_MOTION_CMD_MSG(EMC_MOTION_HALT_TYPE, sizeof(EMC_MOTION_HALT)) {};
01685 
01686   // For internal NML/CMS use only.
01687   void update(CMS *cms);
01688 };
01689 
01690 class EMC_MOTION_ABORT : public EMC_MOTION_CMD_MSG
01691 {
01692 public:
01693   EMC_MOTION_ABORT() : EMC_MOTION_CMD_MSG(EMC_MOTION_ABORT_TYPE, sizeof(EMC_MOTION_ABORT)) {};
01694 
01695   // For internal NML/CMS use only.
01696   void update(CMS *cms);
01697 };
01698 
01699 class EMC_MOTION_SET_AOUT : public EMC_MOTION_CMD_MSG
01700 {
01701 public:
01702   EMC_MOTION_SET_AOUT() : EMC_MOTION_CMD_MSG(EMC_MOTION_SET_AOUT_TYPE, sizeof(EMC_MOTION_SET_AOUT)) {};
01703 
01704   // For internal NML/CMS use only.
01705   void update(CMS *cms);
01706 
01707   unsigned char index;          // which to set
01708   double start;                 // value at start
01709   double end;                   // value at end
01710 };
01711 
01712 class EMC_MOTION_SET_DOUT : public EMC_MOTION_CMD_MSG
01713 {
01714 public:
01715   EMC_MOTION_SET_DOUT() : EMC_MOTION_CMD_MSG(EMC_MOTION_SET_DOUT_TYPE, sizeof(EMC_MOTION_SET_DOUT)) {};
01716 
01717   // For internal NML/CMS use only.
01718   void update(CMS *cms);
01719 
01720   unsigned char index;          // which to set
01721   unsigned char start;          // binary value at start
01722   unsigned char end;            // binary value at end
01723 };
01724 
01725 // EMC_MOTION status base class
01726 class EMC_MOTION_STAT_MSG : public RCS_STAT_MSG
01727 {
01728 public:
01729   EMC_MOTION_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s)
01730   {
01731     heartbeat = 0;
01732   };
01733 
01734   // For internal NML/CMS use only.
01735   void update(CMS *cms);
01736 
01737   unsigned long int heartbeat;
01738 };
01739 
01740 // number of axes in EMC_MOTION_STAT class
01741 #define EMC_AXIS_MAX 8
01742 
01743 class EMC_MOTION_STAT : public EMC_MOTION_STAT_MSG
01744 {
01745 public:
01746   EMC_MOTION_STAT() : EMC_MOTION_STAT_MSG(EMC_MOTION_STAT_TYPE, sizeof(EMC_MOTION_STAT)) {};
01747 
01748   // For internal NML/CMS use only.
01749   void update(CMS *cms);
01750 
01751   // aggregate of motion-related status classes
01752   EMC_TRAJ_STAT traj;
01753   EMC_AXIS_STAT axis[EMC_AXIS_MAX];
01754 
01755   int debug;                    // copy of EMC_DEBUG global
01756 };
01757 
01758 // declarations for EMC_TASK classes
01759 
01760 // EMC_TASK command base class
01761 class EMC_TASK_CMD_MSG : public RCS_CMD_MSG
01762 {
01763 public:
01764   EMC_TASK_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
01765 
01766   // For internal NML/CMS use only.
01767   void update(CMS *cms);
01768 };
01769 
01770 class EMC_TASK_INIT : public EMC_TASK_CMD_MSG
01771 {
01772 public:
01773   EMC_TASK_INIT() : EMC_TASK_CMD_MSG(EMC_TASK_INIT_TYPE, sizeof(EMC_TASK_INIT)) {};
01774 
01775   // For internal NML/CMS use only.
01776   void update(CMS *cms);
01777 };
01778 
01779 class EMC_TASK_HALT : public EMC_TASK_CMD_MSG
01780 {
01781 public:
01782   EMC_TASK_HALT() : EMC_TASK_CMD_MSG(EMC_TASK_HALT_TYPE, sizeof(EMC_TASK_HALT)) {};
01783 
01784   // For internal NML/CMS use only.
01785   void update(CMS *cms);
01786 };
01787 
01788 class EMC_TASK_ABORT : public EMC_TASK_CMD_MSG
01789 {
01790 public:
01791   EMC_TASK_ABORT() : EMC_TASK_CMD_MSG(EMC_TASK_ABORT_TYPE, sizeof(EMC_TASK_ABORT)) {};
01792 
01793   // For internal NML/CMS use only.
01794   void update(CMS *cms);
01795 };
01796 
01797 class EMC_TASK_SET_MODE : public EMC_TASK_CMD_MSG
01798 {
01799 public:
01800   EMC_TASK_SET_MODE() : EMC_TASK_CMD_MSG(EMC_TASK_SET_MODE_TYPE, sizeof(EMC_TASK_SET_MODE)) {};
01801 
01802   // For internal NML/CMS use only.
01803   void update(CMS *cms);
01804 
01805   int mode;
01806 };
01807 
01808 class EMC_TASK_SET_STATE : public EMC_TASK_CMD_MSG
01809 {
01810 public:
01811   EMC_TASK_SET_STATE() : EMC_TASK_CMD_MSG(EMC_TASK_SET_STATE_TYPE, sizeof(EMC_TASK_SET_STATE)) {};
01812 
01813   // For internal NML/CMS use only.
01814   void update(CMS *cms);
01815 
01816   int state;
01817 };
01818 
01819 class EMC_TASK_PLAN_OPEN : public EMC_TASK_CMD_MSG
01820 {
01821 public:
01822   EMC_TASK_PLAN_OPEN() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_OPEN_TYPE, sizeof(EMC_TASK_PLAN_OPEN)) {};
01823 
01824   // For internal NML/CMS use only.
01825   void update(CMS *cms);
01826 
01827   char file[EMC_TASK_FILENAME_LEN];
01828 };
01829 
01830 class EMC_TASK_PLAN_RUN : public EMC_TASK_CMD_MSG
01831 {
01832 public:
01833   EMC_TASK_PLAN_RUN() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_RUN_TYPE, sizeof(EMC_TASK_PLAN_RUN)) {};
01834 
01835   // For internal NML/CMS use only.
01836   void update(CMS *cms);
01837 
01838   int line;                     // line to run from; 0 or 1 means from start,
01839                                 // negative means run through to verify
01840 };
01841 
01842 class EMC_TASK_PLAN_READ : public EMC_TASK_CMD_MSG
01843 {
01844 public:
01845   EMC_TASK_PLAN_READ() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_READ_TYPE, sizeof(EMC_TASK_PLAN_READ)) {};
01846 
01847   // For internal NML/CMS use only.
01848   void update(CMS *cms);
01849 };
01850 
01851 class EMC_TASK_PLAN_EXECUTE : public EMC_TASK_CMD_MSG
01852 {
01853 public:
01854   EMC_TASK_PLAN_EXECUTE() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_EXECUTE_TYPE, sizeof(EMC_TASK_PLAN_EXECUTE)) {};
01855 
01856   // For internal NML/CMS use only.
01857   void update(CMS *cms);
01858 
01859   char command [EMC_TASK_COMMAND_LEN];
01860 };
01861 
01862 class EMC_TASK_PLAN_PAUSE : public EMC_TASK_CMD_MSG
01863 {
01864 public:
01865   EMC_TASK_PLAN_PAUSE() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_PAUSE_TYPE, sizeof(EMC_TASK_PLAN_PAUSE)) {};
01866 
01867   // For internal NML/CMS use only.
01868   void update(CMS *cms);
01869 };
01870 
01871 class EMC_TASK_PLAN_STEP : public EMC_TASK_CMD_MSG
01872 {
01873 public:
01874   EMC_TASK_PLAN_STEP() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_STEP_TYPE, sizeof(EMC_TASK_PLAN_STEP)) {};
01875 
01876   // For internal NML/CMS use only.
01877   void update(CMS *cms);
01878 };
01879 
01880 class EMC_TASK_PLAN_RESUME : public EMC_TASK_CMD_MSG
01881 {
01882 public:
01883   EMC_TASK_PLAN_RESUME() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_RESUME_TYPE, sizeof(EMC_TASK_PLAN_RESUME)) {};
01884 
01885   // For internal NML/CMS use only.
01886   void update(CMS *cms);
01887 };
01888 
01889 class EMC_TASK_PLAN_END : public EMC_TASK_CMD_MSG
01890 {
01891 public:
01892   EMC_TASK_PLAN_END() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_END_TYPE, sizeof(EMC_TASK_PLAN_END)) {};
01893 
01894   // For internal NML/CMS use only.
01895   void update(CMS *cms);
01896 };
01897 
01898 class EMC_TASK_PLAN_CLOSE : public EMC_TASK_CMD_MSG
01899 {
01900 public:
01901   EMC_TASK_PLAN_CLOSE() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_CLOSE_TYPE, sizeof(EMC_TASK_PLAN_CLOSE)) {};
01902 
01903   // For internal NML/CMS use only.
01904   void update(CMS *cms);
01905 };
01906 
01907 class EMC_TASK_PLAN_INIT : public EMC_TASK_CMD_MSG
01908 {
01909 public:
01910   EMC_TASK_PLAN_INIT() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_INIT_TYPE, sizeof(EMC_TASK_PLAN_INIT)) {};
01911 
01912   // For internal NML/CMS use only.
01913   void update(CMS *cms);
01914 };
01915 
01916 class EMC_TASK_PLAN_SYNCH : public EMC_TASK_CMD_MSG
01917 {
01918 public:
01919   EMC_TASK_PLAN_SYNCH() : EMC_TASK_CMD_MSG(EMC_TASK_PLAN_SYNCH_TYPE, sizeof(EMC_TASK_PLAN_SYNCH)) {};
01920 
01921   // For internal NML/CMS use only.
01922   void update(CMS *cms);
01923 };
01924 
01925 // EMC_TASK status base class
01926 class EMC_TASK_STAT_MSG : public RCS_STAT_MSG
01927 {
01928 public:
01929   EMC_TASK_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s)
01930   {
01931     heartbeat = 0;
01932   };
01933 
01934   // For internal NML/CMS use only.
01935   void update(CMS *cms);
01936 
01937   unsigned long int heartbeat;
01938 };
01939 
01940 // types for EMC_TASK mode
01941 #define EMC_TASK_MODE_MANUAL  1
01942 #define EMC_TASK_MODE_AUTO    2
01943 #define EMC_TASK_MODE_MDI     3
01944 
01945 // types for EMC_TASK state
01946 #define EMC_TASK_STATE_ESTOP        1
01947 #define EMC_TASK_STATE_ESTOP_RESET  2
01948 #define EMC_TASK_STATE_OFF          3
01949 #define EMC_TASK_STATE_ON           4
01950 
01951 // types for EMC_TASK execState
01952 #define EMC_TASK_EXEC_ERROR                     1
01953 #define EMC_TASK_EXEC_DONE                      2
01954 #define EMC_TASK_EXEC_WAITING_FOR_MOTION        3
01955 #define EMC_TASK_EXEC_WAITING_FOR_MOTION_QUEUE  4
01956 #define EMC_TASK_EXEC_WAITING_FOR_IO            5
01957 #define EMC_TASK_EXEC_WAITING_FOR_PAUSE         6
01958 #define EMC_TASK_EXEC_WAITING_FOR_MOTION_AND_IO 7
01959 #define EMC_TASK_EXEC_WAITING_FOR_DELAY         8
01960 
01961 // types for EMC_TASK interpState
01962 #define EMC_TASK_INTERP_IDLE      1
01963 #define EMC_TASK_INTERP_READING   2
01964 #define EMC_TASK_INTERP_PAUSED    3
01965 #define EMC_TASK_INTERP_WAITING   4
01966 
01967 #define EMC_TASK_ACTIVE_G_CODES 12 // FIXME-- Java code gen can't resolve
01968                                 // RS274NGC_ACTIVE_G_CODES in rs274ngc.hh
01969 #define EMC_TASK_ACTIVE_M_CODES 7 // FIXME-- Java code gen can't resolve
01970                                 // RS274NGC_ACTIVE_M_CODES in rs274ngc.hh
01971 #define EMC_TASK_ACTIVE_SETTINGS 3 // FIXME-- Java code gen can't resolve
01972                                 // RS274NGC_ACTIVE_SETTINGS in rs274ngc.hh
01973 
01974 class EMC_TASK_STAT : public EMC_TASK_STAT_MSG
01975 {
01976 public:
01977   EMC_TASK_STAT();
01978 
01979   // For internal NML/CMS use only.
01980   void update(CMS *cms);
01981 
01982   int mode;                     // EMC_TASK_MODE_MANUAL, etc.
01983   int state;                    // EMC_TASK_STATE_ESTOP, etc.
01984 
01985   int execState;                // EMC_DONE,WAITING_FOR_MOTION, etc.
01986   int interpState;              // EMC_IDLE,READING,PAUSED,WAITING
01987   int motionLine;               // line motion is executing-- may lag
01988   int currentLine;              // line currently executing
01989   int readLine;                 // line interpreter has read to
01990   char file[EMC_TASK_FILENAME_LEN];
01991   char command[EMC_TASK_COMMAND_LEN];
01992   EmcPose origin;               // origin, in user units, currently active
01993   EmcPose toolOffset;           // tool offset, in general pose form
01994   int activeGCodes[EMC_TASK_ACTIVE_G_CODES]; // FIXME-- dialect-specific
01995   int activeMCodes[EMC_TASK_ACTIVE_M_CODES]; // FIXME-- dialect-specific
01996   double activeSettings[EMC_TASK_ACTIVE_SETTINGS]; // FIXME-- dialect-specific
01997   CANON_UNITS programUnits;     // CANON_UNITS_INCHES,MM,CM
01998 
01999   int interpreter_errcode;      // return value from rs274ngc function 
02000   // (only useful for new interpreter.)
02001 };
02002 
02003 // declarations for EMC_TOOL classes
02004 
02005 // EMC_TOOL command base class
02006 class EMC_TOOL_CMD_MSG : public RCS_CMD_MSG
02007 {
02008 public:
02009   EMC_TOOL_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02010 
02011   // For internal NML/CMS use only.
02012   void update(CMS *cms);
02013 };
02014 
02015 class EMC_TOOL_INIT : public EMC_TOOL_CMD_MSG
02016 {
02017 public:
02018   EMC_TOOL_INIT() : EMC_TOOL_CMD_MSG(EMC_TOOL_INIT_TYPE, sizeof(EMC_TOOL_INIT)) {};
02019 
02020   // For internal NML/CMS use only.
02021   void update(CMS *cms);
02022 };
02023 
02024 class EMC_TOOL_HALT : public EMC_TOOL_CMD_MSG
02025 {
02026 public:
02027   EMC_TOOL_HALT() : EMC_TOOL_CMD_MSG(EMC_TOOL_HALT_TYPE, sizeof(EMC_TOOL_HALT)) {};
02028 
02029   // For internal NML/CMS use only.
02030   void update(CMS *cms);
02031 };
02032 
02033 class EMC_TOOL_ABORT : public EMC_TOOL_CMD_MSG
02034 {
02035 public:
02036   EMC_TOOL_ABORT() : EMC_TOOL_CMD_MSG(EMC_TOOL_ABORT_TYPE, sizeof(EMC_TOOL_ABORT)) {};
02037 
02038   // For internal NML/CMS use only.
02039   void update(CMS *cms);
02040 };
02041 
02042 class EMC_TOOL_PREPARE : public EMC_TOOL_CMD_MSG
02043 {
02044 public:
02045   EMC_TOOL_PREPARE() : EMC_TOOL_CMD_MSG(EMC_TOOL_PREPARE_TYPE, sizeof(EMC_TOOL_PREPARE)) {};
02046 
02047   // For internal NML/CMS use only.
02048   void update(CMS *cms);
02049 
02050   int tool;
02051 };
02052 
02053 class EMC_TOOL_LOAD : public EMC_TOOL_CMD_MSG
02054 {
02055 public:
02056   EMC_TOOL_LOAD() : EMC_TOOL_CMD_MSG(EMC_TOOL_LOAD_TYPE, sizeof(EMC_TOOL_LOAD)) {};
02057 
02058   // For internal NML/CMS use only.
02059   void update(CMS *cms);
02060 };
02061 
02062 class EMC_TOOL_UNLOAD : public EMC_TOOL_CMD_MSG
02063 {
02064 public:
02065   EMC_TOOL_UNLOAD() : EMC_TOOL_CMD_MSG(EMC_TOOL_UNLOAD_TYPE, sizeof(EMC_TOOL_UNLOAD)) {};
02066 
02067   // For internal NML/CMS use only.
02068   void update(CMS *cms);
02069 };
02070 
02071 class EMC_TOOL_LOAD_TOOL_TABLE : public EMC_TOOL_CMD_MSG
02072 {
02073 public:
02074   EMC_TOOL_LOAD_TOOL_TABLE() : EMC_TOOL_CMD_MSG(EMC_TOOL_LOAD_TOOL_TABLE_TYPE, sizeof(EMC_TOOL_LOAD_TOOL_TABLE)) {};
02075 
02076   // For internal NML/CMS use only.
02077   void update(CMS *cms);
02078 
02079   char file[EMC_TASK_FILENAME_LEN]; // name of tool table, empty means default
02080 };
02081 
02082 class EMC_TOOL_SET_OFFSET : public EMC_TOOL_CMD_MSG
02083 {
02084 public:
02085   EMC_TOOL_SET_OFFSET() : EMC_TOOL_CMD_MSG(EMC_TOOL_SET_OFFSET_TYPE, sizeof(EMC_TOOL_SET_OFFSET)) {};
02086 
02087   // For internal NML/CMS use only.
02088   void update(CMS *cms);
02089 
02090   int tool;
02091   double length;
02092   double diameter;
02093 };
02094 
02095 // EMC_TOOL status base class
02096 class EMC_TOOL_STAT_MSG : public RCS_STAT_MSG
02097 {
02098 public:
02099   EMC_TOOL_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02100 
02101   // For internal NML/CMS use only.
02102   void update(CMS *cms);
02103 };
02104 
02105 class EMC_TOOL_STAT : public EMC_TOOL_STAT_MSG
02106 {
02107 public:
02108   EMC_TOOL_STAT();
02109 
02110   // For internal NML/CMS use only.
02111   void update(CMS *cms);
02112   EMC_TOOL_STAT operator = (EMC_TOOL_STAT s); // need this for [] members
02113 
02114   int toolPrepped;              // tool ready for loading, 0 is no tool
02115   int toolInSpindle;            // tool loaded, 0 is no tool
02116   CANON_TOOL_TABLE toolTable[CANON_TOOL_MAX + 1];
02117 };
02118 
02119 // EMC_AUX type declarations
02120 
02121 // EMC_AUX command base class
02122 class EMC_AUX_CMD_MSG : public RCS_CMD_MSG
02123 {
02124 public:
02125   EMC_AUX_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02126 
02127   // For internal NML/CMS use only.
02128   void update(CMS *cms);
02129 };
02130 
02131 class EMC_AUX_INIT : public EMC_AUX_CMD_MSG
02132 {
02133 public:
02134   EMC_AUX_INIT() : EMC_AUX_CMD_MSG(EMC_AUX_INIT_TYPE, sizeof(EMC_AUX_INIT)) {};
02135 
02136   // For internal NML/CMS use only.
02137   void update(CMS *cms);
02138 };
02139 
02140 class EMC_AUX_HALT : public EMC_AUX_CMD_MSG
02141 {
02142 public:
02143   EMC_AUX_HALT() : EMC_AUX_CMD_MSG(EMC_AUX_HALT_TYPE, sizeof(EMC_AUX_HALT)) {};
02144 
02145   // For internal NML/CMS use only.
02146   void update(CMS *cms);
02147 };
02148 
02149 class EMC_AUX_ABORT : public EMC_AUX_CMD_MSG
02150 {
02151 public:
02152   EMC_AUX_ABORT() : EMC_AUX_CMD_MSG(EMC_AUX_ABORT_TYPE, sizeof(EMC_AUX_ABORT)) {};
02153 
02154   // For internal NML/CMS use only.
02155   void update(CMS *cms);
02156 };
02157 
02158 class EMC_AUX_DIO_WRITE : public EMC_AUX_CMD_MSG
02159 {
02160 public:
02161   EMC_AUX_DIO_WRITE() : EMC_AUX_CMD_MSG(EMC_AUX_DIO_WRITE_TYPE, sizeof(EMC_AUX_DIO_WRITE)) {};
02162 
02163   // For internal NML/CMS use only.
02164   void update(CMS *cms);
02165 
02166   int index;
02167   int value;
02168 };
02169 
02170 class EMC_AUX_AIO_WRITE : public EMC_AUX_CMD_MSG
02171 {
02172 public:
02173   EMC_AUX_AIO_WRITE() : EMC_AUX_CMD_MSG(EMC_AUX_AIO_WRITE_TYPE, sizeof(EMC_AUX_AIO_WRITE)) {};
02174 
02175   // For internal NML/CMS use only.
02176   void update(CMS *cms);
02177 
02178   int index;
02179   double value;
02180 };
02181 
02182 class EMC_AUX_ESTOP_ON : public EMC_AUX_CMD_MSG
02183 {
02184 public:
02185   EMC_AUX_ESTOP_ON() : EMC_AUX_CMD_MSG(EMC_AUX_ESTOP_ON_TYPE, sizeof(EMC_AUX_ESTOP_ON)) {};
02186 
02187   // For internal NML/CMS use only.
02188   void update(CMS *cms);
02189 };
02190 
02191 class EMC_AUX_ESTOP_OFF : public EMC_AUX_CMD_MSG
02192 {
02193 public:
02194   EMC_AUX_ESTOP_OFF() : EMC_AUX_CMD_MSG(EMC_AUX_ESTOP_OFF_TYPE, sizeof(EMC_AUX_ESTOP_OFF)) {};
02195 
02196   // For internal NML/CMS use only.
02197   void update(CMS *cms);
02198 };
02199 
02200 // EMC_AUX status base class
02201 class EMC_AUX_STAT_MSG : public RCS_STAT_MSG
02202 {
02203 public:
02204   EMC_AUX_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02205 
02206   // For internal NML/CMS use only.
02207   void update(CMS *cms);
02208 };
02209 
02210 #define EMC_AUX_MAX_DOUT 4      // digital out bytes
02211 #define EMC_AUX_MAX_DIN  4      // digital in bytes
02212 #define EMC_AUX_MAX_AOUT 32     // analog out points
02213 #define EMC_AUX_MAX_AIN  32     // analog in points
02214 
02215 class EMC_AUX_STAT : public EMC_AUX_STAT_MSG
02216 {
02217 public:
02218   EMC_AUX_STAT();
02219 
02220   // For internal NML/CMS use only.
02221   void update(CMS *cms);
02222   EMC_AUX_STAT operator = (EMC_AUX_STAT s); // need this for [] members
02223 
02224   int estop;                    // non-zero means estopped
02225   int estopIn;                  // non-zero means estop button pressed
02226 
02227   unsigned char dout[EMC_AUX_MAX_DOUT]; // digital output readings
02228   unsigned char din[EMC_AUX_MAX_DIN]; // digital input readings
02229 
02230   double aout[EMC_AUX_MAX_AOUT]; // digital output readings
02231   double ain[EMC_AUX_MAX_AIN]; // digital input readings
02232 };
02233 
02234 // EMC_SPINDLE type declarations
02235 
02236 // EMC_SPINDLE command base class
02237 class EMC_SPINDLE_CMD_MSG : public RCS_CMD_MSG
02238 {
02239 public:
02240   EMC_SPINDLE_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02241 
02242   // For internal NML/CMS use only.
02243   void update(CMS *cms);
02244 };
02245 
02246 class EMC_SPINDLE_INIT : public EMC_SPINDLE_CMD_MSG
02247 {
02248 public:
02249   EMC_SPINDLE_INIT() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_INIT_TYPE, sizeof(EMC_SPINDLE_INIT)) {};
02250 
02251   // For internal NML/CMS use only.
02252   void update(CMS *cms);
02253 };
02254 
02255 class EMC_SPINDLE_HALT : public EMC_SPINDLE_CMD_MSG
02256 {
02257 public:
02258   EMC_SPINDLE_HALT() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_HALT_TYPE, sizeof(EMC_SPINDLE_HALT)) {};
02259 
02260   // For internal NML/CMS use only.
02261   void update(CMS *cms);
02262 };
02263 
02264 class EMC_SPINDLE_ABORT : public EMC_SPINDLE_CMD_MSG
02265 {
02266 public:
02267   EMC_SPINDLE_ABORT() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_ABORT_TYPE, sizeof(EMC_SPINDLE_ABORT)) {};
02268 
02269   // For internal NML/CMS use only.
02270   void update(CMS *cms);
02271 };
02272 
02273 class EMC_SPINDLE_ON : public EMC_SPINDLE_CMD_MSG
02274 {
02275 public:
02276   EMC_SPINDLE_ON() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_ON_TYPE, sizeof(EMC_SPINDLE_ON)) {};
02277 
02278   // For internal NML/CMS use only.
02279   void update(CMS *cms);
02280 
02281   double speed;                 // commanded speed in RPMs
02282 };
02283 
02284 class EMC_SPINDLE_OFF : public EMC_SPINDLE_CMD_MSG
02285 {
02286 public:
02287   EMC_SPINDLE_OFF() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_OFF_TYPE, sizeof(EMC_SPINDLE_OFF)) {};
02288 
02289   // For internal NML/CMS use only.
02290   void update(CMS *cms);
02291 };
02292 
02293 class EMC_SPINDLE_FORWARD : public EMC_SPINDLE_CMD_MSG
02294 {
02295 public:
02296   EMC_SPINDLE_FORWARD() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_FORWARD_TYPE, sizeof(EMC_SPINDLE_FORWARD)) {};
02297 
02298   // For internal NML/CMS use only.
02299   void update(CMS *cms);
02300 };
02301 
02302 class EMC_SPINDLE_REVERSE : public EMC_SPINDLE_CMD_MSG
02303 {
02304 public:
02305   EMC_SPINDLE_REVERSE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_REVERSE_TYPE, sizeof(EMC_SPINDLE_REVERSE)) {};
02306 
02307   // For internal NML/CMS use only.
02308   void update(CMS *cms);
02309 };
02310 
02311 class EMC_SPINDLE_STOP : public EMC_SPINDLE_CMD_MSG
02312 {
02313 public:
02314   EMC_SPINDLE_STOP() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_STOP_TYPE, sizeof(EMC_SPINDLE_STOP)) {};
02315 
02316   // For internal NML/CMS use only.
02317   void update(CMS *cms);
02318 };
02319 
02320 class EMC_SPINDLE_INCREASE : public EMC_SPINDLE_CMD_MSG
02321 {
02322 public:
02323   EMC_SPINDLE_INCREASE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_INCREASE_TYPE, sizeof(EMC_SPINDLE_INCREASE)) {};
02324 
02325   // For internal NML/CMS use only.
02326   void update(CMS *cms);
02327 };
02328 
02329 class EMC_SPINDLE_DECREASE : public EMC_SPINDLE_CMD_MSG
02330 {
02331 public:
02332   EMC_SPINDLE_DECREASE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_DECREASE_TYPE, sizeof(EMC_SPINDLE_DECREASE)) {};
02333 
02334   // For internal NML/CMS use only.
02335   void update(CMS *cms);
02336 };
02337 
02338 class EMC_SPINDLE_CONSTANT : public EMC_SPINDLE_CMD_MSG
02339 {
02340 public:
02341   EMC_SPINDLE_CONSTANT() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_CONSTANT_TYPE, sizeof(EMC_SPINDLE_CONSTANT)) {};
02342 
02343   // For internal NML/CMS use only.
02344   void update(CMS *cms);
02345 };
02346 
02347 class EMC_SPINDLE_BRAKE_RELEASE : public EMC_SPINDLE_CMD_MSG
02348 {
02349 public:
02350   EMC_SPINDLE_BRAKE_RELEASE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_BRAKE_RELEASE_TYPE, sizeof(EMC_SPINDLE_BRAKE_RELEASE)) {};
02351 
02352   // For internal NML/CMS use only.
02353   void update(CMS *cms);
02354 };
02355 
02356 class EMC_SPINDLE_BRAKE_ENGAGE : public EMC_SPINDLE_CMD_MSG
02357 {
02358 public:
02359   EMC_SPINDLE_BRAKE_ENGAGE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_BRAKE_ENGAGE_TYPE, sizeof(EMC_SPINDLE_BRAKE_ENGAGE)) {};
02360 
02361   // For internal NML/CMS use only.
02362   void update(CMS *cms);
02363 };
02364 
02365 class EMC_SPINDLE_ENABLE : public EMC_SPINDLE_CMD_MSG
02366 {
02367 public:
02368   EMC_SPINDLE_ENABLE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_ENABLE_TYPE, sizeof(EMC_SPINDLE_ENABLE)) {};
02369 
02370   // For internal NML/CMS use only.
02371   void update(CMS *cms);
02372 };
02373 
02374 class EMC_SPINDLE_DISABLE : public EMC_SPINDLE_CMD_MSG
02375 {
02376 public:
02377   EMC_SPINDLE_DISABLE() : EMC_SPINDLE_CMD_MSG(EMC_SPINDLE_DISABLE_TYPE, sizeof(EMC_SPINDLE_DISABLE)) {};
02378 
02379   // For internal NML/CMS use only.
02380   void update(CMS *cms);
02381 };
02382 
02383 // EMC_SPINDLE status base class
02384 class EMC_SPINDLE_STAT_MSG : public RCS_STAT_MSG
02385 {
02386 public:
02387   EMC_SPINDLE_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02388 
02389   // For internal NML/CMS use only.
02390   void update(CMS *cms);
02391 };
02392 
02393 class EMC_SPINDLE_STAT : public EMC_SPINDLE_STAT_MSG
02394 {
02395 public:
02396   EMC_SPINDLE_STAT();
02397 
02398   // For internal NML/CMS use only.
02399   void update(CMS *cms);
02400 
02401   double speed;                 // spindle speed in RPMs
02402   int direction;                // 0 stopped, 1 forward, -1 reverse
02403   int brake;                    // 0 released, 1 engaged
02404   int increasing;               // 1 increasing, -1 decreasing, 0 neither
02405   int enabled;                  // non-zero means enabled
02406 };
02407 
02408 // EMC_COOLANT type declarations
02409 
02410 // EMC_COOLANT command base class
02411 class EMC_COOLANT_CMD_MSG : public RCS_CMD_MSG
02412 {
02413 public:
02414   EMC_COOLANT_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02415 
02416   // For internal NML/CMS use only.
02417   void update(CMS *cms);
02418 };
02419 
02420 class EMC_COOLANT_INIT : public EMC_COOLANT_CMD_MSG
02421 {
02422 public:
02423   EMC_COOLANT_INIT() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_INIT_TYPE, sizeof(EMC_COOLANT_INIT)) {};
02424 
02425   // For internal NML/CMS use only.
02426   void update(CMS *cms);
02427 };
02428 
02429 class EMC_COOLANT_HALT : public EMC_COOLANT_CMD_MSG
02430 {
02431 public:
02432   EMC_COOLANT_HALT() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_HALT_TYPE, sizeof(EMC_COOLANT_HALT)) {};
02433 
02434   // For internal NML/CMS use only.
02435   void update(CMS *cms);
02436 };
02437 
02438 class EMC_COOLANT_ABORT : public EMC_COOLANT_CMD_MSG
02439 {
02440 public:
02441   EMC_COOLANT_ABORT() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_ABORT_TYPE, sizeof(EMC_COOLANT_ABORT)) {};
02442 
02443   // For internal NML/CMS use only.
02444   void update(CMS *cms);
02445 };
02446 
02447 class EMC_COOLANT_MIST_ON : public EMC_COOLANT_CMD_MSG
02448 {
02449 public:
02450   EMC_COOLANT_MIST_ON() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_MIST_ON_TYPE, sizeof(EMC_COOLANT_MIST_ON)) {};
02451 
02452   // For internal NML/CMS use only.
02453   void update(CMS *cms);
02454 };
02455 
02456 class EMC_COOLANT_MIST_OFF : public EMC_COOLANT_CMD_MSG
02457 {
02458 public:
02459   EMC_COOLANT_MIST_OFF() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_MIST_OFF_TYPE, sizeof(EMC_COOLANT_MIST_OFF)) {};
02460 
02461   // For internal NML/CMS use only.
02462   void update(CMS *cms);
02463 };
02464 
02465 class EMC_COOLANT_FLOOD_ON : public EMC_COOLANT_CMD_MSG
02466 {
02467 public:
02468   EMC_COOLANT_FLOOD_ON() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_FLOOD_ON_TYPE, sizeof(EMC_COOLANT_FLOOD_ON)) {};
02469 
02470   // For internal NML/CMS use only.
02471   void update(CMS *cms);
02472 };
02473 
02474 class EMC_COOLANT_FLOOD_OFF : public EMC_COOLANT_CMD_MSG
02475 {
02476 public:
02477   EMC_COOLANT_FLOOD_OFF() : EMC_COOLANT_CMD_MSG(EMC_COOLANT_FLOOD_OFF_TYPE, sizeof(EMC_COOLANT_FLOOD_OFF)) {};
02478 
02479   // For internal NML/CMS use only.
02480   void update(CMS *cms);
02481 };
02482 
02483 // EMC_COOLANT status base class
02484 class EMC_COOLANT_STAT_MSG : public RCS_STAT_MSG
02485 {
02486 public:
02487   EMC_COOLANT_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02488 
02489   // For internal NML/CMS use only.
02490   void update(CMS *cms);
02491 };
02492 
02493 class EMC_COOLANT_STAT : public EMC_COOLANT_STAT_MSG
02494 {
02495 public:
02496   EMC_COOLANT_STAT();
02497 
02498   // For internal NML/CMS use only.
02499   void update(CMS *cms);
02500 
02501   int mist;                     // 0 off, 1 on
02502   int flood;                    // 0 off, 1 on
02503 };
02504 
02505 // EMC_LUBE type declarations
02506 
02507 // EMC_LUBE command base class
02508 class EMC_LUBE_CMD_MSG : public RCS_CMD_MSG
02509 {
02510 public:
02511   EMC_LUBE_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02512 
02513   // For internal NML/CMS use only.
02514   void update(CMS *cms);
02515 };
02516 
02517 class EMC_LUBE_INIT : public EMC_LUBE_CMD_MSG
02518 {
02519 public:
02520   EMC_LUBE_INIT() : EMC_LUBE_CMD_MSG(EMC_LUBE_INIT_TYPE, sizeof(EMC_LUBE_INIT)) {};
02521 
02522   // For internal NML/CMS use only.
02523   void update(CMS *cms);
02524 };
02525 
02526 class EMC_LUBE_HALT : public EMC_LUBE_CMD_MSG
02527 {
02528 public:
02529   EMC_LUBE_HALT() : EMC_LUBE_CMD_MSG(EMC_LUBE_HALT_TYPE, sizeof(EMC_LUBE_HALT)) {};
02530 
02531   // For internal NML/CMS use only.
02532   void update(CMS *cms);
02533 };
02534 
02535 class EMC_LUBE_ABORT : public EMC_LUBE_CMD_MSG
02536 {
02537 public:
02538   EMC_LUBE_ABORT() : EMC_LUBE_CMD_MSG(EMC_LUBE_ABORT_TYPE, sizeof(EMC_LUBE_ABORT)) {};
02539 
02540   // For internal NML/CMS use only.
02541   void update(CMS *cms);
02542 };
02543 
02544 class EMC_LUBE_ON : public EMC_LUBE_CMD_MSG
02545 {
02546 public:
02547   EMC_LUBE_ON() : EMC_LUBE_CMD_MSG(EMC_LUBE_ON_TYPE, sizeof(EMC_LUBE_ON)) {};
02548 
02549   // For internal NML/CMS use only.
02550   void update(CMS *cms);
02551 };
02552 
02553 class EMC_LUBE_OFF : public EMC_LUBE_CMD_MSG
02554 {
02555 public:
02556   EMC_LUBE_OFF() : EMC_LUBE_CMD_MSG(EMC_LUBE_OFF_TYPE, sizeof(EMC_LUBE_OFF)) {};
02557 
02558   // For internal NML/CMS use only.
02559   void update(CMS *cms);
02560 };
02561 
02562 // EMC_LUBE status base class
02563 class EMC_LUBE_STAT_MSG : public RCS_STAT_MSG
02564 {
02565 public:
02566   EMC_LUBE_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02567 
02568   // For internal NML/CMS use only.
02569   void update(CMS *cms);
02570 };
02571 
02572 class EMC_LUBE_STAT : public EMC_LUBE_STAT_MSG
02573 {
02574 public:
02575   EMC_LUBE_STAT();
02576 
02577   // For internal NML/CMS use only.
02578   void update(CMS *cms);
02579 
02580   int on;                       // 0 off, 1 on
02581   int level;                    // 0 low, 1 okay
02582 };
02583 
02584 // EMC IO configuration classes
02585 
02586 class EMC_SET_DIO_INDEX : public RCS_CMD_MSG
02587 {
02588 public:
02589   EMC_SET_DIO_INDEX() : RCS_CMD_MSG(EMC_SET_DIO_INDEX_TYPE, sizeof(EMC_SET_DIO_INDEX)) {};
02590 
02591   // For internal NML/CMS use only.
02592   void update(CMS *cms);
02593 
02594   int value;                    // one of enum EMC_SET_DIO_INDEX_XXX
02595   int index;                    // index, 0..max
02596 };
02597 
02598 class EMC_SET_AIO_INDEX : public RCS_CMD_MSG
02599 {
02600 public:
02601   EMC_SET_AIO_INDEX() : RCS_CMD_MSG(EMC_SET_AIO_INDEX_TYPE, sizeof(EMC_SET_AIO_INDEX)) {};
02602 
02603   // For internal NML/CMS use only.
02604   void update(CMS *cms);
02605 
02606   int value;                    // one of enum EMC_SET_AIO_INDEX_XXX
02607   int index;                    // index, 0..max
02608 };
02609 
02610 class EMC_SET_POLARITY : public RCS_CMD_MSG
02611 {
02612 public:
02613   EMC_SET_POLARITY() : RCS_CMD_MSG(EMC_SET_POLARITY_TYPE, sizeof(EMC_SET_POLARITY)) {};
02614 
02615   // For internal NML/CMS use only.
02616   void update(CMS *cms);
02617 
02618   int value;                    // one of enum EMC_SET_POLARITY_XXX
02619   int polarity;                 // polarity, 0 or 1
02620 };
02621 
02622 // EMC_IO is aggregate of all EMC IO-related status classes
02623 
02624 // EMC_IO command base class
02625 class EMC_IO_CMD_MSG : public RCS_CMD_MSG
02626 {
02627 public:
02628   EMC_IO_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02629 
02630   // For internal NML/CMS use only.
02631   void update(CMS *cms);
02632 };
02633 
02634 class EMC_IO_INIT : public EMC_IO_CMD_MSG
02635 {
02636 public:
02637   EMC_IO_INIT() : EMC_IO_CMD_MSG(EMC_IO_INIT_TYPE, sizeof(EMC_IO_INIT)) {};
02638 
02639   // For internal NML/CMS use only.
02640   void update(CMS *cms);
02641 };
02642 
02643 class EMC_IO_HALT : public EMC_IO_CMD_MSG
02644 {
02645 public:
02646   EMC_IO_HALT() : EMC_IO_CMD_MSG(EMC_IO_HALT_TYPE, sizeof(EMC_IO_HALT)) {};
02647 
02648   // For internal NML/CMS use only.
02649   void update(CMS *cms);
02650 };
02651 
02652 class EMC_IO_ABORT : public EMC_IO_CMD_MSG
02653 {
02654 public:
02655   EMC_IO_ABORT() : EMC_IO_CMD_MSG(EMC_IO_ABORT_TYPE, sizeof(EMC_IO_ABORT)) {};
02656 
02657   // For internal NML/CMS use only.
02658   void update(CMS *cms);
02659 };
02660 
02661 class EMC_IO_SET_CYCLE_TIME : public EMC_IO_CMD_MSG
02662 {
02663 public:
02664   EMC_IO_SET_CYCLE_TIME() : EMC_IO_CMD_MSG(EMC_IO_SET_CYCLE_TIME_TYPE, sizeof(EMC_IO_SET_CYCLE_TIME)) {};
02665 
02666   // For internal NML/CMS use only.
02667   void update(CMS *cms);
02668 
02669   double cycleTime;
02670 };
02671 
02672 // EMC_IO status base class
02673 class EMC_IO_STAT_MSG : public RCS_STAT_MSG
02674 {
02675 public:
02676   EMC_IO_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s)
02677   {
02678     heartbeat = 0;
02679   };
02680 
02681   // For internal NML/CMS use only.
02682   void update(CMS *cms);
02683 
02684   unsigned long int heartbeat;
02685 };
02686 
02687 class EMC_IO_STAT : public EMC_IO_STAT_MSG
02688 {
02689 public:
02690   EMC_IO_STAT() : EMC_IO_STAT_MSG(EMC_IO_STAT_TYPE, sizeof(EMC_IO_STAT)) {};
02691 
02692   // For internal NML/CMS use only.
02693   void update(CMS *cms);
02694 
02695   // top-level stuff
02696   double cycleTime;
02697   int debug;                    // copy of EMC_DEBUG global
02698 
02699   // aggregate of IO-related status classes
02700   EMC_TOOL_STAT tool;
02701   EMC_SPINDLE_STAT spindle;
02702   EMC_COOLANT_STAT coolant;
02703   EMC_AUX_STAT aux;
02704   EMC_LUBE_STAT lube;
02705 };
02706 
02707 // EMC is aggregate of EMC_TASK, EMC_TRAJ, EMC_IO, etc.
02708 
02709 // EMC command base class
02710 class EMC_CMD_MSG : public RCS_CMD_MSG
02711 {
02712 public:
02713   EMC_CMD_MSG(NMLTYPE t, size_t s): RCS_CMD_MSG(t, s) {};
02714 
02715   // For internal NML/CMS use only.
02716   void update(CMS *cms);
02717 };
02718 
02719 class EMC_INIT : public EMC_CMD_MSG
02720 {
02721 public:
02722   EMC_INIT() : EMC_CMD_MSG(EMC_INIT_TYPE, sizeof(EMC_INIT)) {};
02723 
02724   // For internal NML/CMS use only.
02725   void update(CMS *cms);
02726 };
02727 
02728 class EMC_HALT : public EMC_CMD_MSG
02729 {
02730 public:
02731   EMC_HALT() : EMC_CMD_MSG(EMC_HALT_TYPE, sizeof(EMC_HALT)) {};
02732 
02733   // For internal NML/CMS use only.
02734   void update(CMS *cms);
02735 };
02736 
02737 class EMC_ABORT : public EMC_CMD_MSG
02738 {
02739 public:
02740   EMC_ABORT() : EMC_CMD_MSG(EMC_ABORT_TYPE, sizeof(EMC_ABORT)) {};
02741 
02742   // For internal NML/CMS use only.
02743   void update(CMS *cms);
02744 };
02745 
02746 class EMC_LOG_OPEN : public EMC_CMD_MSG
02747 {
02748 public:
02749   EMC_LOG_OPEN() : EMC_CMD_MSG(EMC_LOG_OPEN_TYPE, sizeof(EMC_LOG_OPEN)) {};
02750 
02751   // For internal NML/CMS use only.
02752   void update(CMS *cms);
02753 
02754   char file[EMC_LOG_FILENAME_LEN]; // file to contain data when log closed
02755   int type;                     // EMC_LOG_TYPE_AXIS_POS, etc.
02756   int size;                     // how many data points in file
02757   int skip;                     // how many to skip, 0 means none
02758   int which;                    // further selects which to log, e.g., axis
02759   int triggerType;
02760   int triggerVar;
02761   double triggerThreshold;
02762 
02763 };
02764 
02765 class EMC_LOG_START : public EMC_CMD_MSG
02766 {
02767 public:
02768   EMC_LOG_START() : EMC_CMD_MSG(EMC_LOG_START_TYPE, sizeof(EMC_LOG_START)) {};
02769 
02770   // For internal NML/CMS use only.
02771   void update(CMS *cms);
02772 };
02773 
02774 class EMC_LOG_STOP : public EMC_CMD_MSG
02775 {
02776 public:
02777   EMC_LOG_STOP() : EMC_CMD_MSG(EMC_LOG_STOP_TYPE, sizeof(EMC_LOG_STOP)) {};
02778 
02779   // For internal NML/CMS use only.
02780   void update(CMS *cms);
02781 };
02782 
02783 class EMC_LOG_CLOSE : public EMC_CMD_MSG
02784 {
02785 public:
02786   EMC_LOG_CLOSE() : EMC_CMD_MSG(EMC_LOG_CLOSE_TYPE, sizeof(EMC_LOG_CLOSE)) {};
02787 
02788   // For internal NML/CMS use only.
02789   void update(CMS *cms);
02790 };
02791 
02792 // EMC status base class
02793 
02794 class EMC_STAT_MSG : public RCS_STAT_MSG
02795 {
02796 public:
02797   EMC_STAT_MSG(NMLTYPE t, size_t s): RCS_STAT_MSG(t, s) {};
02798 
02799   // For internal NML/CMS use only.
02800   void update(CMS *cms);
02801 };
02802 
02803 class EMC_STAT : public EMC_STAT_MSG
02804 {
02805 public:
02806   EMC_STAT();
02807 
02808   // For internal NML/CMS  use only.
02809   void update(CMS *cms);
02810 
02811   // the top-level EMC_TASK status class
02812   EMC_TASK_STAT task;
02813 
02814   // subordinate status classes
02815   EMC_MOTION_STAT motion;
02816   EMC_IO_STAT io;
02817 
02818   // logging status
02819   char logFile[EMC_LOG_FILENAME_LEN]; // name of file to log to upon close
02820   int logType;                  // type being logged
02821   int logSize;                  // size in entries, not bytes
02822   int logSkip;                  // how many are being skipped
02823   int logOpen;                  // non-zero means a log is open
02824   int logStarted;               // non-zero means logging is happening
02825   int logPoints;                // how many points currently in log
02826 
02827   int debug;                    // copy of EMC_DEBUG global
02828 };
02829 
02830 /*
02831    Declarations of EMC status class implementations, for major subsystems.
02832    These are defined in the appropriate main() files, and referenced
02833    by code in other files to get EMC status.
02834    */
02835 
02836 // full EMC status
02837 extern EMC_STAT * emcStatus;
02838 
02839 // EMC IO status
02840 extern EMC_IO_STAT * emcIoStatus;
02841 
02842 // EMC MOTION status
02843 extern EMC_MOTION_STAT * emcMotionStatus;
02844 
02845 #endif // #ifndef EMC_HH

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