#include <stdlib.h>#include <string.h>#include "emc.hh"#include "emcglb.h"#include "interpl.hh"#include "canon.hh"#include "rs274ngc.hh"Include dependency graph for emctask.cc:

Go to the source code of this file.
Defines | |
| #define | __attribute__(x) |
Functions | |
| char | __attribute__ ((unused)) ident[]="$Id |
| int | emcTaskHalt () |
| int | emcTaskAbort () |
| int | emcTaskSetMode (int mode) |
| int | emcTaskSetState (int state) |
| int | determineMode () |
| int | determineState () |
| int | emcTaskPlanInit () |
| int | emcTaskPlanSetWait () |
| int | emcTaskPlanIsWait () |
| int | emcTaskPlanClearWait () |
| int | emcTaskPlanSynch () |
| int | emcTaskPlanExit () |
| int | emcTaskPlanOpen (const char *file) |
| int | emcTaskPlanRead () |
| int | emcTaskPlanExecute (const char *command) |
| int | emcTaskPlanClose () |
| int | emcTaskPlanLine () |
| int | emcTaskPlanCommand (char *cmd) |
| int | emcTaskUpdate (EMC_TASK_STAT *stat) |
Variables | |
| int | waitFlag = 0 |
|
|
Definition at line 53 of file emctask.cc. |
|
|
Definition at line 57 of file emctask.cc. 00057 : emctask.cc,v 1.15 2001/11/14 19:07:12 wshackle Exp $";
00058
00059 // flag for how we want to interpret traj coord mode, as mdi or auto
00060 static int mdiOrAuto = EMC_TASK_MODE_AUTO;
00061
00062 // EMC_TASK interface
00063
00064 int emcTaskInit()
00065 {
00066 return 0;
00067 }
|
|
|
Definition at line 182 of file emctask.cc. Referenced by emcTaskUpdate().
00183 {
00184 // if traj is in free mode, then we're in manual mode
00185 if (emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE ||
00186 emcStatus->motion.traj.mode == EMC_TRAJ_MODE_TELEOP ) {
00187 return EMC_TASK_MODE_MANUAL;
00188 }
00189
00190 // else traj is in coord mode-- we can be in either mdi or auto
00191 return mdiOrAuto;
00192 }
|
|
|
Definition at line 208 of file emctask.cc. Referenced by emcTaskUpdate().
00209 {
00210 if (emcStatus->io.aux.estop) {
00211 return EMC_TASK_STATE_ESTOP;
00212 }
00213
00214 if (! emcStatus->motion.traj.enabled) {
00215 return EMC_TASK_STATE_ESTOP_RESET;
00216 }
00217
00218 return EMC_TASK_STATE_ON;
00219 }
|
|
|
Definition at line 74 of file emctask.cc. 00075 {
00076 emcMotionAbort();
00077 emcIoAbort();
00078
00079 return 0;
00080 }
|
|
|
Definition at line 69 of file emctask.cc. 00070 {
00071 return 0;
00072 }
|
|
|
Definition at line 313 of file emctask.cc. 00314 {
00315 waitFlag = 0;
00316
00317 return 0;
00318 }
|
|
|
Definition at line 395 of file emctask.cc. 00396 {
00397 int retval = rs274ngc_close();
00398 #ifdef NEW_INTERPRETER
00399 if(retval > RS274NGC_MIN_ERROR)
00400 {
00401 print_rs274ngc_error(retval);
00402 }
00403 #endif
00404
00405 taskplanopen=0;
00406 return retval;
00407 }
|
|
|
Definition at line 414 of file emctask.cc. Referenced by emcTaskPlan().
00415 {
00416 strcpy(cmd, rs274ngc_command());
00417 return 0;
00418 }
|
|
|
Definition at line 376 of file emctask.cc. Referenced by emcTaskIssueCommand(), and emcTaskPlan().
00377 {
00378 if(command != 0)
00379 {
00380 if(*command != 0)
00381 {
00382 rs274ngc_synch();
00383 }
00384 }
00385 int retval = rs274ngc_execute(command);
00386 #ifdef NEW_INTERPRETER
00387 if(retval > RS274NGC_MIN_ERROR)
00388 {
00389 print_rs274ngc_error(retval);
00390 }
00391 #endif
00392 return retval;
00393 }
|
|
|
Definition at line 325 of file emctask.cc. 00326 {
00327 return rs274ngc_exit();
00328 }
|
|
|
Definition at line 270 of file emctask.cc. 00271 {
00272 rs274ngc_ini_load(EMC_INIFILE);
00273 waitFlag = 0;
00274
00275 int retval = rs274ngc_init();
00276 #ifdef NEW_INTERPRETER
00277 if(retval > RS274NGC_MIN_ERROR)
00278 {
00279 print_rs274ngc_error(retval);
00280 }
00281 else
00282 {
00283 if( 0 != RS274NGC_STARTUP_CODE[0])
00284 {
00285 retval = rs274ngc_execute(RS274NGC_STARTUP_CODE);
00286 if(retval > RS274NGC_MIN_ERROR)
00287 {
00288 print_rs274ngc_error(retval);
00289 }
00290 }
00291 }
00292 #else
00293 if( 0 != RS274NGC_STARTUP_CODE[0])
00294 {
00295 rs274ngc_execute(RS274NGC_STARTUP_CODE);
00296 }
00297 #endif
00298 return retval;
00299 }
|
|
|
Definition at line 308 of file emctask.cc. 00309 {
00310 return waitFlag;
00311 }
|
|
|
Definition at line 409 of file emctask.cc. 00410 {
00411 return rs274ngc_line();
00412 }
|
|
|
Definition at line 330 of file emctask.cc. Referenced by emcTaskIssueCommand().
00331 {
00332 if(emcStatus != 0)
00333 {
00334 emcStatus->task.motionLine = 0;
00335 emcStatus->task.currentLine = 0;
00336 emcStatus->task.readLine = 0;
00337 }
00338
00339 int retval = rs274ngc_open(file);
00340 #ifdef NEW_INTERPRETER
00341 if(retval > RS274NGC_MIN_ERROR)
00342 {
00343 print_rs274ngc_error(retval);
00344 return retval;
00345 }
00346 #endif
00347 taskplanopen=1;
00348 return retval;
00349 }
|
|
|
Definition at line 352 of file emctask.cc. 00353 {
00354 int retval = rs274ngc_read();
00355 #ifdef NEW_INTERPRETER
00356 if(retval == NCE_FILE_NOT_OPEN)
00357 {
00358 if(emcStatus->task.file[0] != 0)
00359 {
00360 retval = rs274ngc_open(emcStatus->task.file);
00361 if(retval > RS274NGC_MIN_ERROR)
00362 {
00363 print_rs274ngc_error(retval);
00364 }
00365 retval = rs274ngc_read();
00366 }
00367 }
00368 if(retval > RS274NGC_MIN_ERROR)
00369 {
00370 print_rs274ngc_error(retval);
00371 }
00372 #endif
00373 return retval;
00374 }
|
|
|
Definition at line 301 of file emctask.cc. 00302 {
00303 waitFlag = 1;
00304
00305 return 0;
00306 }
|
|
|
Definition at line 320 of file emctask.cc. 00321 {
00322 return rs274ngc_synch();
00323 }
|
|
|
Definition at line 82 of file emctask.cc. Referenced by emcTaskIssueCommand(), and main().
00083 {
00084 int retval = 0;
00085
00086 switch (mode) {
00087 case EMC_TASK_MODE_MANUAL:
00088 // go to manual mode
00089 emcTrajSetMode(EMC_TRAJ_MODE_FREE);
00090 mdiOrAuto = EMC_TASK_MODE_AUTO; // we'll default back to here
00091 break;
00092
00093 case EMC_TASK_MODE_MDI:
00094 // go to mdi mode
00095 emcTrajSetMode(EMC_TRAJ_MODE_COORD);
00096 emcTaskPlanSynch();
00097 mdiOrAuto = EMC_TASK_MODE_MDI;
00098 break;
00099
00100 case EMC_TASK_MODE_AUTO:
00101 // go to auto mode
00102 emcTrajSetMode(EMC_TRAJ_MODE_COORD);
00103 emcTaskPlanSynch();
00104 mdiOrAuto = EMC_TASK_MODE_AUTO;
00105 break;
00106
00107 default:
00108 retval = -1;
00109 break;
00110 }
00111
00112 return retval;
00113 }
|
|
|
Definition at line 115 of file emctask.cc. Referenced by emcTaskIssueCommand(), and main().
00116 {
00117 int t;
00118 int retval = 0;
00119
00120 switch (state) {
00121 case EMC_TASK_STATE_OFF:
00122 // turn the machine servos off-- go into ESTOP_RESET state
00123 for (t = 0; t < emcStatus->motion.traj.axes; t++) {
00124 emcAxisDisable(t);
00125 }
00126 emcTrajDisable();
00127 emcLubeOff();
00128 break;
00129
00130 case EMC_TASK_STATE_ON:
00131 // turn the machine servos on
00132 emcTrajEnable();
00133 for (t = 0; t < emcStatus->motion.traj.axes; t++) {
00134 emcAxisEnable(t);
00135 }
00136 emcLubeOn();
00137 break;
00138
00139 case EMC_TASK_STATE_ESTOP_RESET:
00140 // reset the estop
00141 if(emcStatus->io.aux.estopIn)
00142 {
00143 rcs_print("Can't come out of estop while the estop button is in.");
00144 }
00145 emcAuxEstopOff();
00146 emcLubeOff();
00147 break;
00148
00149 case EMC_TASK_STATE_ESTOP:
00150 // go into estop-- do both IO estop and machine servos off
00151 emcAuxEstopOn();
00152 for (t = 0; t < emcStatus->motion.traj.axes; t++) {
00153 emcAxisDisable(t);
00154 }
00155 emcTrajDisable();
00156 emcLubeOff();
00157 break;
00158
00159 default:
00160 retval = -1;
00161 break;
00162 }
00163
00164 return retval;
00165 }
|
|
|
Definition at line 420 of file emctask.cc. Referenced by emctask_startup(), and main().
00421 {
00422 stat->mode = determineMode();
00423 stat->state = determineState();
00424
00425 // execState set in main
00426 // interpState set in main
00427 if(emcStatus->motion.traj.id > 0)
00428 {
00429 stat->motionLine = emcStatus->motion.traj.id;
00430 }
00431 // currentLine set in main
00432 // readLine set in main
00433
00434 strcpy(stat->file, rs274ngc_file());
00435 // command set in main
00436
00437 // update active G and M codes
00438 rs274ngc_active_g_codes(&stat->activeGCodes[0]);
00439 rs274ngc_active_m_codes(&stat->activeMCodes[0]);
00440 rs274ngc_active_settings(&stat->activeSettings[0]);
00441
00442 stat->heartbeat++;
00443
00444 return 0;
00445 }
|
|
|
Definition at line 221 of file emctask.cc. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001