#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "emc.hh"
#include "emcmot.h"
#include "usrmotintf.h"
#include "initraj.hh"
#include "iniaxis.hh"
#include "emcglb.h"
#include "emcmotglb.h"
#include "emcmotcfg.h"
Include dependency graph for inimot.cc:
Go to the source code of this file.
Defines | |
#define | DEFAULT_NUM_AXES 3 |
Functions | |
int | emcOperatorError (int id, const char *fmt,...) |
int | iniLoad (const char *filename) |
int | main (int argc, char *argv[]) |
Variables | |
EMC_STAT | emcStatusStruct |
EMC_STAT * | emcStatus = 0 |
int | numAxes = 0 |
|
|
|
Definition at line 38 of file inimot.cc. Referenced by checkInterpList(), emcMotionUpdate(), emcTaskIssueCommand(), emcTaskPlan(), main(), and waitFlag().
00039 { 00040 char errorString[EMC_OPERATOR_ERROR_LEN]; 00041 va_list ap; 00042 00043 // prepend error code 00044 sprintf(errorString, "[%d] ", id); 00045 00046 // append error string 00047 va_start(ap, fmt); 00048 vsprintf(&errorString[strlen(errorString)], fmt, ap); 00049 va_end(ap); 00050 00051 // force a NULL at the end for safety 00052 errorString[EMC_OPERATOR_ERROR_LEN-1] = 0; 00053 00054 // print it 00055 printf("%s\n", errorString); 00056 00057 return 0; 00058 } |
|
Definition at line 63 of file inimot.cc. 00064 { 00065 INIFILE inifile; 00066 const char *inistring; 00067 00068 // open it 00069 if (-1 == inifile.open(filename)) { 00070 return -1; 00071 } 00072 00073 if (NULL != (inistring = inifile.find("AXES", "TRAJ"))) { 00074 if (1 != sscanf(inistring, "%d", &numAxes)) { 00075 numAxes = DEFAULT_NUM_AXES; 00076 } 00077 } 00078 else { 00079 // not found, use default 00080 numAxes = DEFAULT_NUM_AXES; 00081 } 00082 00083 // close it 00084 inifile.close(); 00085 00086 return 0; 00087 } |
|
Definition at line 89 of file inimot.cc. 00090 { 00091 int retval = 0; 00092 int axis; 00093 00094 emcStatus = &emcStatusStruct; 00095 00096 // process command line args 00097 if (0 != emcGetArgs(argc, argv)) 00098 { 00099 printf("error in argument list\n"); 00100 exit(1); 00101 } 00102 00103 // get some ini file params for us 00104 if (0 != iniLoad(EMC_INIFILE)) { 00105 printf("can't read INI file\n"); 00106 exit(1); 00107 } 00108 00109 // check ini file for emcmot params 00110 if (0 != usrmotIniLoad(EMC_INIFILE)) { 00111 printf("can't read motion control INI file\n"); 00112 exit(1); 00113 } 00114 00115 if (0 != usrmotInit()) { 00116 printf("can't initialize motion control interface\n"); 00117 exit(1); 00118 } 00119 00120 for (axis = 0; axis < numAxes; axis++) { 00121 printf("initing axis %d...", axis); 00122 fflush(stdout); 00123 if (0 == iniAxis(axis, EMC_INIFILE)) { 00124 printf("done\n"); 00125 } 00126 else { 00127 printf("error\n"); 00128 retval = 1; 00129 } 00130 } 00131 00132 // initialize parameters from ini file 00133 printf("initing traj..."); 00134 fflush(stdout); 00135 if (0 == iniTraj(EMC_INIFILE)) { 00136 printf("done\n"); 00137 } 00138 else { 00139 printf("error\n"); 00140 retval = 1; 00141 } 00142 00143 usrmotExit(); 00144 00145 exit(retval); 00146 } |
|
|
|
|
|
Definition at line 60 of file inimot.cc. Referenced by init_module().
|