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

EMC_TOOL_MODULE Class Reference

#include <emcio.hh>

Inheritance diagram for EMC_TOOL_MODULE:

Inheritance graph
[legend]
Collaboration diagram for EMC_TOOL_MODULE:

Collaboration graph
[legend]

Public Methods

 EMC_TOOL_MODULE (void)
 ~EMC_TOOL_MODULE (void)
void DECISION_PROCESS (void)
void PRE_PROCESS (void)
void POST_PROCESS (void)
void INIT (EMC_TOOL_INIT *)
void HALT (EMC_TOOL_HALT *)
void ABORT (EMC_TOOL_ABORT *)
void REPORT_ERROR (RCS_CMD_MSG *)
void TOOL_PREPARE (EMC_TOOL_PREPARE *)
void TOOL_LOAD (EMC_TOOL_LOAD *)
void TOOL_UNLOAD (EMC_TOOL_UNLOAD *)
void TOOL_LOAD_TOOL_TABLE (EMC_TOOL_LOAD_TOOL_TABLE *)
void TOOL_SET_OFFSET (EMC_TOOL_SET_OFFSET *)
void SPINDLE_ON (EMC_SPINDLE_ON *)
void SPINDLE_OFF (EMC_SPINDLE_OFF *)
void SPINDLE_INCREASE (EMC_SPINDLE_INCREASE *)
void SPINDLE_DECREASE (EMC_SPINDLE_DECREASE *)
void SPINDLE_CONSTANT (EMC_SPINDLE_CONSTANT *)
void SPINDLE_BRAKE_RELEASE (EMC_SPINDLE_BRAKE_RELEASE *)
void SPINDLE_BRAKE_ENGAGE (EMC_SPINDLE_BRAKE_ENGAGE *)
void SPINDLE_ENABLE (EMC_SPINDLE_ENABLE *)
void SPINDLE_DISABLE (EMC_SPINDLE_DISABLE *)
void COOLANT_MIST_ON (EMC_COOLANT_MIST_ON *)
void COOLANT_MIST_OFF (EMC_COOLANT_MIST_OFF *)
void COOLANT_FLOOD_ON (EMC_COOLANT_FLOOD_ON *)
void COOLANT_FLOOD_OFF (EMC_COOLANT_FLOOD_OFF *)
void AUX_ESTOP_ON (EMC_AUX_ESTOP_ON *)
void AUX_ESTOP_OFF (EMC_AUX_ESTOP_OFF *)
void AUX_DIO_WRITE (EMC_AUX_DIO_WRITE *)
void AUX_AIO_WRITE (EMC_AUX_AIO_WRITE *)
void LUBE_ON (EMC_LUBE_ON *)
void LUBE_OFF (EMC_LUBE_OFF *)

Data Fields

int spindleSubNum
int coolantSubNum
int auxSubNum
int lubeSubNum
EMC_IO_STAT ioStatus
double deltaClock

Constructor & Destructor Documentation

EMC_TOOL_MODULE::EMC_TOOL_MODULE void   
 

Definition at line 196 of file bridgeporttool.cc.

00197 {
00198   EMC_TOOL_INIT initMsg;
00199 
00200   setErrorLogChannel(new NML(nmlErrorFormat, "emcError", "tool", EMC_NMLFILE));
00201 
00202   setCmdChannel(new RCS_CMD_CHANNEL(emcFormat, "toolCmd", "tool", EMC_NMLFILE));
00203 
00204   setStatChannel(new RCS_STAT_CHANNEL(emcFormat, "toolSts", "tool", EMC_NMLFILE), &ioStatus);
00205 
00206   spindleSubNum = addSubordinate(new RCS_CMD_CHANNEL(emcFormat, "spindleCmd", "tool", EMC_NMLFILE), new RCS_STAT_CHANNEL(emcFormat, "spindleSts", "tool", EMC_NMLFILE));
00207 
00208   coolantSubNum = addSubordinate(new RCS_CMD_CHANNEL(emcFormat, "coolantCmd", "tool", EMC_NMLFILE), new RCS_STAT_CHANNEL(emcFormat, "coolantSts", "tool", EMC_NMLFILE));
00209 
00210   auxSubNum = addSubordinate(new RCS_CMD_CHANNEL(emcFormat, "auxCmd", "tool", EMC_NMLFILE), new RCS_STAT_CHANNEL(emcFormat, "auxSts", "tool", EMC_NMLFILE));
00211 
00212   lubeSubNum = addSubordinate(new RCS_CMD_CHANNEL(emcFormat, "lubeCmd", "tool", EMC_NMLFILE), new RCS_STAT_CHANNEL(emcFormat, "lubeSts", "tool", EMC_NMLFILE));
00213 
00214   // local data
00215   deltaClock = 0.0;
00216 
00217   // stuff an INIT to get things going
00218   initMsg.serial_number = 1;    // comes up as 0
00219   commandIn->write(initMsg);
00220 }

EMC_TOOL_MODULE::~EMC_TOOL_MODULE void   
 

Definition at line 224 of file bridgeporttool.cc.

00225 {
00226 }


Member Function Documentation

void EMC_TOOL_MODULE::ABORT EMC_TOOL_ABORT   cmdIn
 

Definition at line 466 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00467 {
00468   EMC_SPINDLE_ABORT spindleAbortMsg;
00469   EMC_COOLANT_ABORT coolantAbortMsg;
00470   EMC_AUX_ABORT auxAbortMsg;
00471   EMC_LUBE_ABORT lubeAbortMsg;
00472 
00473   if (STATE_MATCH(NEW_COMMAND))
00474     {
00475       sendCommand(&spindleAbortMsg, spindleSubNum);
00476       sendCommand(&coolantAbortMsg, coolantSubNum);
00477       sendCommand(&auxAbortMsg, auxSubNum);
00478       sendCommand(&lubeAbortMsg, lubeSubNum);
00479 
00480       status = RCS_EXEC;
00481       stateNext(S1);
00482     }
00483   else if (STATE_MATCH(S0))
00484     {
00485       // idle
00486     }
00487   else if (STATE_MATCH(S1,
00488                        spindleStatus->status == RCS_DONE &&
00489                        coolantStatus->status == RCS_DONE &&
00490                        auxStatus->status == RCS_DONE &&
00491                        lubeStatus->status == RCS_DONE))
00492     {
00493       // both are done
00494 
00495       status = RCS_DONE;
00496       stateNext(S0);
00497     }
00498   else if (STATE_MATCH(S1,
00499                        spindleStatus->status == RCS_ERROR ||
00500                        coolantStatus->status == RCS_ERROR ||
00501                        auxStatus->status == RCS_ERROR ||
00502                        lubeStatus->status == RCS_ERROR))
00503     {
00504       // a subordinate reported an error
00505 
00506       status = RCS_ERROR;
00507       stateNext(S0);
00508     }
00509   else if (STATE_MATCH(S1))
00510     {
00511       // one or more are still executing-- keep waiting
00512     }
00513 }

void EMC_TOOL_MODULE::AUX_AIO_WRITE EMC_AUX_AIO_WRITE   cmdIn
 

Definition at line 1214 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01215 {
01216   EMC_AUX_AIO_WRITE aioWriteMsg = *cmdIn;
01217 
01218   if (STATE_MATCH(NEW_COMMAND))
01219     {
01220       sendCommand(&aioWriteMsg, auxSubNum);
01221 
01222       status = RCS_EXEC;
01223       stateNext(S1);
01224     }
01225   else if (STATE_MATCH(S0))
01226     {
01227       // idle
01228     }
01229   else if (STATE_MATCH(S1,
01230                        auxStatus->status == RCS_DONE))
01231     {
01232       status = RCS_DONE;
01233       stateNext(S0);
01234     }
01235   else if (STATE_MATCH(S1,
01236                        auxStatus->status == RCS_ERROR))
01237     {
01238       status = RCS_ERROR;
01239       stateNext(S0);
01240     }
01241   else if (STATE_MATCH(S1,
01242                        auxStatus->status == RCS_EXEC))
01243     {
01244       // still working
01245     }
01246 }

void EMC_TOOL_MODULE::AUX_DIO_WRITE EMC_AUX_DIO_WRITE   cmdIn
 

Definition at line 1180 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01181 {
01182   EMC_AUX_DIO_WRITE dioWriteMsg = *cmdIn;
01183 
01184   if (STATE_MATCH(NEW_COMMAND))
01185     {
01186       sendCommand(&dioWriteMsg, auxSubNum);
01187 
01188       status = RCS_EXEC;
01189       stateNext(S1);
01190     }
01191   else if (STATE_MATCH(S0))
01192     {
01193       // idle
01194     }
01195   else if (STATE_MATCH(S1,
01196                        auxStatus->status == RCS_DONE))
01197     {
01198       status = RCS_DONE;
01199       stateNext(S0);
01200     }
01201   else if (STATE_MATCH(S1,
01202                        auxStatus->status == RCS_ERROR))
01203     {
01204       status = RCS_ERROR;
01205       stateNext(S0);
01206     }
01207   else if (STATE_MATCH(S1,
01208                        auxStatus->status == RCS_EXEC))
01209     {
01210       // still working
01211     }
01212 }

void EMC_TOOL_MODULE::AUX_ESTOP_OFF EMC_AUX_ESTOP_OFF   cmdIn
 

Definition at line 1146 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01147 {
01148   EMC_AUX_ESTOP_OFF estopOffMsg;
01149 
01150   if (STATE_MATCH(NEW_COMMAND))
01151     {
01152       sendCommand(&estopOffMsg, auxSubNum);
01153 
01154       status = RCS_EXEC;
01155       stateNext(S1);
01156     }
01157   else if (STATE_MATCH(S0))
01158     {
01159       // idle
01160     }
01161   else if (STATE_MATCH(S1,
01162                        auxStatus->status == RCS_DONE))
01163     {
01164       status = RCS_DONE;
01165       stateNext(S0);
01166     }
01167   else if (STATE_MATCH(S1,
01168                        auxStatus->status == RCS_ERROR))
01169     {
01170       status = RCS_ERROR;
01171       stateNext(S0);
01172     }
01173   else if (STATE_MATCH(S1,
01174                        auxStatus->status == RCS_EXEC))
01175     {
01176       // still working
01177     }
01178 }

void EMC_TOOL_MODULE::AUX_ESTOP_ON EMC_AUX_ESTOP_ON   cmdIn
 

Definition at line 1112 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01113 {
01114   EMC_AUX_ESTOP_ON estopOnMsg;
01115 
01116   if (STATE_MATCH(NEW_COMMAND))
01117     {
01118       sendCommand(&estopOnMsg, auxSubNum);
01119 
01120       status = RCS_EXEC;
01121       stateNext(S1);
01122     }
01123   else if (STATE_MATCH(S0))
01124     {
01125       // idle
01126     }
01127   else if (STATE_MATCH(S1,
01128                        auxStatus->status == RCS_DONE))
01129     {
01130       status = RCS_DONE;
01131       stateNext(S0);
01132     }
01133   else if (STATE_MATCH(S1,
01134                        auxStatus->status == RCS_ERROR))
01135     {
01136       status = RCS_ERROR;
01137       stateNext(S0);
01138     }
01139   else if (STATE_MATCH(S1,
01140                        auxStatus->status == RCS_EXEC))
01141     {
01142       // still working
01143     }
01144 }

void EMC_TOOL_MODULE::COOLANT_FLOOD_OFF EMC_COOLANT_FLOOD_OFF   cmdIn
 

Definition at line 1074 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01075 {
01076   EMC_COOLANT_FLOOD_OFF floodOffMsg;
01077 
01078   if (STATE_MATCH(NEW_COMMAND))
01079     {
01080       sendCommand(&floodOffMsg, coolantSubNum);
01081       status = RCS_EXEC;
01082       stateNext(S1);
01083     }
01084   else if (STATE_MATCH(S0))
01085     {
01086       // idle
01087     }
01088   else if (STATE_MATCH(S1,
01089                        coolantStatus->status == RCS_DONE))
01090     {
01091       status = RCS_DONE;
01092       stateNext(S0);
01093     }
01094   else if (STATE_MATCH(S1,
01095                        coolantStatus->status == RCS_ERROR))
01096     {
01097       status = RCS_ERROR;
01098       stateNext(S0);
01099     }
01100   else if (STATE_MATCH(S1,
01101                        coolantStatus->status == RCS_EXEC))
01102     {
01103       // still working
01104     }
01105   else
01106     {
01107       printf("flood off %d %d\n", state, coolantStatus->status);
01108     }
01109 }

void EMC_TOOL_MODULE::COOLANT_FLOOD_ON EMC_COOLANT_FLOOD_ON   cmdIn
 

Definition at line 1041 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01042 {
01043   EMC_COOLANT_FLOOD_ON floodOnMsg;
01044 
01045   if (STATE_MATCH(NEW_COMMAND))
01046     {
01047       sendCommand(&floodOnMsg, coolantSubNum);
01048       status = RCS_EXEC;
01049       stateNext(S1);
01050     }
01051   else if (STATE_MATCH(S0))
01052     {
01053       // idle
01054     }
01055   else if (STATE_MATCH(S1,
01056                        coolantStatus->status == RCS_DONE))
01057     {
01058       status = RCS_DONE;
01059       stateNext(S0);
01060     }
01061   else if (STATE_MATCH(S1,
01062                        coolantStatus->status == RCS_ERROR))
01063     {
01064       status = RCS_ERROR;
01065       stateNext(S0);
01066     }
01067   else if (STATE_MATCH(S1,
01068                        coolantStatus->status == RCS_EXEC))
01069     {
01070       // still working
01071     }
01072 }

void EMC_TOOL_MODULE::COOLANT_MIST_OFF EMC_COOLANT_MIST_OFF   cmdIn
 

Definition at line 1004 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01005 {
01006   EMC_COOLANT_MIST_OFF mistOffMsg;
01007 
01008   if (STATE_MATCH(NEW_COMMAND))
01009     {
01010       sendCommand(&mistOffMsg, coolantSubNum);
01011       status = RCS_EXEC;
01012       stateNext(S1);
01013     }
01014   else if (STATE_MATCH(S0))
01015     {
01016       // idle
01017     }
01018   else if (STATE_MATCH(S1,
01019                        coolantStatus->status == RCS_DONE))
01020     {
01021       status = RCS_DONE;
01022       stateNext(S0);
01023     }
01024   else if (STATE_MATCH(S1,
01025                        coolantStatus->status == RCS_ERROR))
01026     {
01027       status = RCS_ERROR;
01028       stateNext(S0);
01029     }
01030   else if (STATE_MATCH(S1,
01031                        coolantStatus->status == RCS_EXEC))
01032     {
01033       // still working
01034     }
01035   else
01036     {
01037       printf("mist off %d %d\n", state, coolantStatus->status);
01038     }
01039 }

void EMC_TOOL_MODULE::COOLANT_MIST_ON EMC_COOLANT_MIST_ON   cmdIn
 

Definition at line 970 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00971 {
00972   EMC_COOLANT_MIST_ON mistOnMsg;
00973 
00974   if (STATE_MATCH(NEW_COMMAND))
00975     {
00976       sendCommand(&mistOnMsg, coolantSubNum);
00977 
00978       status = RCS_EXEC;
00979       stateNext(S1);
00980     }
00981   else if (STATE_MATCH(S0))
00982     {
00983       // idle
00984     }
00985   else if (STATE_MATCH(S1,
00986                        coolantStatus->status == RCS_DONE))
00987     {
00988       status = RCS_DONE;
00989       stateNext(S0);
00990     }
00991   else if (STATE_MATCH(S1,
00992                        coolantStatus->status == RCS_ERROR))
00993     {
00994       status = RCS_ERROR;
00995       stateNext(S0);
00996     }
00997   else if (STATE_MATCH(S1,
00998                        coolantStatus->status == RCS_EXEC))
00999     {
01000       // still working
01001     }
01002 }

void EMC_TOOL_MODULE::DECISION_PROCESS void   
 

Definition at line 228 of file bridgeporttool.cc.

00229 {
00230   switch (commandInData->type)
00231     {
00232     case EMC_SET_DEBUG_TYPE:
00233       /* this will be done "immediately", without a state table, since
00234          it's trivial. We have to make sure to manipulate the state
00235          table vars as we would any command */
00236       EMC_DEBUG = ((EMC_SET_DEBUG *) commandInData)->debug;
00237       ioStatus.debug = EMC_DEBUG;
00238       status = RCS_DONE;
00239       stateNext(S0);
00240       break;
00241 
00242     case EMC_TOOL_INIT_TYPE:
00243       INIT((EMC_TOOL_INIT *) commandInData);
00244       break;
00245 
00246     case EMC_TOOL_HALT_TYPE:
00247       HALT((EMC_TOOL_HALT *) commandInData);
00248       break;
00249 
00250     case EMC_TOOL_ABORT_TYPE:
00251       ABORT((EMC_TOOL_ABORT *) commandInData);
00252       break;
00253 
00254     case EMC_TOOL_PREPARE_TYPE:
00255       TOOL_PREPARE((EMC_TOOL_PREPARE *) commandInData);
00256       break;
00257 
00258     case EMC_TOOL_LOAD_TYPE:
00259       TOOL_LOAD((EMC_TOOL_LOAD *) commandInData);
00260       break;
00261 
00262     case EMC_TOOL_UNLOAD_TYPE:
00263       TOOL_UNLOAD((EMC_TOOL_UNLOAD *) commandInData);
00264       break;
00265 
00266     case EMC_TOOL_LOAD_TOOL_TABLE_TYPE:
00267       TOOL_LOAD_TOOL_TABLE((EMC_TOOL_LOAD_TOOL_TABLE *) commandInData);
00268       break;
00269 
00270     case EMC_TOOL_SET_OFFSET_TYPE:
00271       TOOL_SET_OFFSET((EMC_TOOL_SET_OFFSET *) commandInData);
00272       break;
00273 
00274     case EMC_SPINDLE_ON_TYPE:
00275       SPINDLE_ON((EMC_SPINDLE_ON *) commandInData);
00276       break;
00277 
00278     case EMC_SPINDLE_OFF_TYPE:
00279       SPINDLE_OFF((EMC_SPINDLE_OFF *) commandInData);
00280       break;
00281 
00282     case EMC_SPINDLE_INCREASE_TYPE:
00283       SPINDLE_INCREASE((EMC_SPINDLE_INCREASE *) commandInData);
00284       break;
00285 
00286     case EMC_SPINDLE_DECREASE_TYPE:
00287       SPINDLE_DECREASE((EMC_SPINDLE_DECREASE *) commandInData);
00288       break;
00289 
00290     case EMC_SPINDLE_CONSTANT_TYPE:
00291       SPINDLE_CONSTANT((EMC_SPINDLE_CONSTANT *) commandInData);
00292       break;
00293 
00294     case EMC_SPINDLE_BRAKE_RELEASE_TYPE:
00295       SPINDLE_BRAKE_RELEASE((EMC_SPINDLE_BRAKE_RELEASE *) commandInData);
00296       break;
00297 
00298     case EMC_SPINDLE_BRAKE_ENGAGE_TYPE:
00299       SPINDLE_BRAKE_ENGAGE((EMC_SPINDLE_BRAKE_ENGAGE *) commandInData);
00300       break;
00301 
00302     case EMC_COOLANT_MIST_ON_TYPE:
00303       COOLANT_MIST_ON((EMC_COOLANT_MIST_ON *) commandInData);
00304       break;
00305 
00306     case EMC_COOLANT_MIST_OFF_TYPE:
00307       COOLANT_MIST_OFF((EMC_COOLANT_MIST_OFF *) commandInData);
00308       break;
00309 
00310     case EMC_COOLANT_FLOOD_ON_TYPE:
00311       COOLANT_FLOOD_ON((EMC_COOLANT_FLOOD_ON *) commandInData);
00312       break;
00313 
00314     case EMC_COOLANT_FLOOD_OFF_TYPE:
00315       COOLANT_FLOOD_OFF((EMC_COOLANT_FLOOD_OFF *) commandInData);
00316       break;
00317 
00318     case EMC_AUX_ESTOP_ON_TYPE:
00319       AUX_ESTOP_ON((EMC_AUX_ESTOP_ON *) commandInData);
00320       break;
00321 
00322     case EMC_AUX_ESTOP_OFF_TYPE:
00323       AUX_ESTOP_OFF((EMC_AUX_ESTOP_OFF *) commandInData);
00324       break;
00325 
00326     case EMC_AUX_DIO_WRITE_TYPE:
00327       AUX_DIO_WRITE((EMC_AUX_DIO_WRITE *) commandInData);
00328       break;
00329 
00330     case EMC_AUX_AIO_WRITE_TYPE:
00331       AUX_AIO_WRITE((EMC_AUX_AIO_WRITE *) commandInData);
00332       break;
00333 
00334     case EMC_LUBE_ON_TYPE:
00335       LUBE_ON((EMC_LUBE_ON *) commandInData);
00336       break;
00337 
00338     case EMC_LUBE_OFF_TYPE:
00339       LUBE_OFF((EMC_LUBE_OFF *) commandInData);
00340       break;
00341 
00342     default:
00343       REPORT_ERROR(commandInData);
00344       break;
00345     }
00346 }

void EMC_TOOL_MODULE::HALT EMC_TOOL_HALT   cmdIn
 

Definition at line 417 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00418 {
00419   EMC_SPINDLE_HALT spindleHaltMsg;
00420   EMC_COOLANT_HALT coolantHaltMsg;
00421   EMC_AUX_HALT auxHaltMsg;
00422   EMC_LUBE_HALT lubeHaltMsg;
00423 
00424   if (STATE_MATCH(NEW_COMMAND))
00425     {
00426       sendCommand(&spindleHaltMsg, spindleSubNum);
00427       sendCommand(&coolantHaltMsg, coolantSubNum);
00428       sendCommand(&auxHaltMsg, auxSubNum);
00429       sendCommand(&lubeHaltMsg, lubeSubNum);
00430 
00431       status = RCS_EXEC;
00432       stateNext(S1);
00433     }
00434   else if (STATE_MATCH(S0))
00435     {
00436       // idle
00437     }
00438   else if (STATE_MATCH(S1,
00439                        spindleStatus->status == RCS_DONE &&
00440                        coolantStatus->status == RCS_DONE &&
00441                        auxStatus->status == RCS_DONE &&
00442                        lubeStatus->status == RCS_DONE))
00443     {
00444       // both are done
00445 
00446       status = RCS_DONE;
00447       stateNext(S0);
00448     }
00449   else if (STATE_MATCH(S1,
00450                        spindleStatus->status == RCS_ERROR ||
00451                        coolantStatus->status == RCS_ERROR ||
00452                        auxStatus->status == RCS_ERROR ||
00453                        lubeStatus->status == RCS_ERROR))
00454     {
00455       // a subordinate reported an error
00456 
00457       status = RCS_ERROR;
00458       stateNext(S0);
00459     }
00460   else if (STATE_MATCH(S1))
00461     {
00462       // one or more are still executing-- keep waiting
00463     }
00464 }

void EMC_TOOL_MODULE::INIT EMC_TOOL_INIT   cmdIn
 

Definition at line 364 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00365 {
00366   EMC_SPINDLE_INIT spindleInitMsg;
00367   EMC_COOLANT_INIT coolantInitMsg;
00368   EMC_AUX_INIT auxInitMsg;
00369   EMC_LUBE_INIT lubeInitMsg;
00370 
00371   if (STATE_MATCH(NEW_COMMAND))
00372     {
00373       // load params from ini file
00374       iniTool(EMC_INIFILE);
00375       loadToolTable(TOOL_TABLE_FILE, ioStatus.tool.toolTable);
00376 
00377       // send commands to subordinates
00378       sendCommand(&spindleInitMsg, spindleSubNum);
00379       sendCommand(&coolantInitMsg, coolantSubNum);
00380       sendCommand(&auxInitMsg, auxSubNum);
00381       sendCommand(&lubeInitMsg, lubeSubNum);
00382 
00383       status = RCS_EXEC;
00384       stateNext(S1);
00385 
00386     }
00387   else if (STATE_MATCH(S0))
00388     {
00389       // idle
00390     }
00391   else if (STATE_MATCH(S1,
00392                        spindleStatus->status == RCS_DONE &&
00393                        coolantStatus->status == RCS_DONE &&
00394                        auxStatus->status == RCS_DONE &&
00395                        lubeStatus->status == RCS_DONE))
00396     {
00397       // all are done
00398       status = RCS_DONE;
00399       stateNext(S0);
00400     }
00401   else if (STATE_MATCH(S1,
00402                        spindleStatus->status == RCS_ERROR ||
00403                        coolantStatus->status == RCS_ERROR ||
00404                        auxStatus->status == RCS_ERROR ||
00405                        lubeStatus->status == RCS_ERROR))
00406     {
00407       // a subordinate reported an error
00408       status = RCS_ERROR;
00409       stateNext(S0);
00410     }
00411   else if (STATE_MATCH(S1))
00412     {
00413       // one or more are still executing-- keep waiting
00414     }
00415 }

void EMC_TOOL_MODULE::LUBE_OFF EMC_LUBE_OFF   cmdIn
 

Definition at line 1290 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01291 {
01292   EMC_LUBE_OFF lubeOffMsg;
01293 
01294   if (STATE_MATCH(NEW_COMMAND))
01295     {
01296       sendCommand(&lubeOffMsg, lubeSubNum);
01297 
01298       status = RCS_EXEC;
01299       stateNext(S1);
01300     }
01301   else if (STATE_MATCH(S0))
01302     {
01303       // idle
01304     }
01305   else if (STATE_MATCH(S1,
01306                        lubeStatus->status == RCS_DONE))
01307     {
01308       status = RCS_DONE;
01309       stateNext(S0);
01310     }
01311   else if (STATE_MATCH(S1,
01312                        lubeStatus->status == RCS_ERROR))
01313     {
01314       status = RCS_ERROR;
01315       stateNext(S0);
01316     }
01317   else if (STATE_MATCH(S1,
01318                        lubeStatus->status == RCS_EXEC))
01319     {
01320       // still working
01321     }
01322 }

void EMC_TOOL_MODULE::LUBE_ON EMC_LUBE_ON   cmdIn
 

Definition at line 1249 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

01250 {
01251   EMC_LUBE_ON lubeOnMsg;
01252 
01253   if (STATE_MATCH(NEW_COMMAND,
01254                   auxStatus->estop))
01255     {
01256       status = RCS_ERROR;
01257       stateNext(S0);
01258     }
01259   else if (STATE_MATCH(NEW_COMMAND,
01260                        ! auxStatus->estop))
01261     {
01262       sendCommand(&lubeOnMsg, lubeSubNum);
01263 
01264       status = RCS_EXEC;
01265       stateNext(S1);
01266     }
01267   else if (STATE_MATCH(S0))
01268     {
01269       // idle
01270     }
01271   else if (STATE_MATCH(S1,
01272                        lubeStatus->status == RCS_DONE))
01273     {
01274       status = RCS_DONE;
01275       stateNext(S0);
01276     }
01277   else if (STATE_MATCH(S1,
01278                        lubeStatus->status == RCS_ERROR))
01279     {
01280       status = RCS_ERROR;
01281       stateNext(S0);
01282     }
01283   else if (STATE_MATCH(S1,
01284                        lubeStatus->status == RCS_EXEC))
01285     {
01286       // still working
01287     }
01288 }

void EMC_TOOL_MODULE::POST_PROCESS void   
 

Definition at line 352 of file bridgeporttool.cc.

00353 {
00354   // copy in the subordinate status
00355   ioStatus.spindle = *spindleStatus;
00356   ioStatus.coolant = *coolantStatus;
00357   ioStatus.aux = *auxStatus;
00358   ioStatus.lube = *lubeStatus;
00359 
00360   // update the heartbeat
00361   ioStatus.heartbeat++;
00362 }

void EMC_TOOL_MODULE::PRE_PROCESS void   
 

Definition at line 348 of file bridgeporttool.cc.

00349 {
00350 }

void EMC_TOOL_MODULE::REPORT_ERROR RCS_CMD_MSG   cmdIn
 

Definition at line 515 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00516 {
00517   if (STATE_MATCH(NEW_COMMAND))
00518     {
00519       rcs_print_error("EMC_TOOL_MODULE: unknown command %d\n",
00520                       cmdIn->type);
00521       status = RCS_ERROR;
00522       stateNext(S0);
00523     }
00524   else if (STATE_MATCH(S0))
00525     {
00526       // idle
00527     }
00528 }

void EMC_TOOL_MODULE::SPINDLE_BRAKE_ENGAGE EMC_SPINDLE_BRAKE_ENGAGE   cmdIn
 

Definition at line 935 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00936 {
00937   EMC_SPINDLE_BRAKE_ENGAGE spindleBrakeEngageMsg;
00938 
00939   if (STATE_MATCH(NEW_COMMAND))
00940     {
00941       sendCommand(&spindleBrakeEngageMsg, spindleSubNum);
00942 
00943       status = RCS_EXEC;
00944       stateNext(S1);
00945     }
00946   else if (STATE_MATCH(S0))
00947     {
00948       // idle
00949     }
00950   else if (STATE_MATCH(S1,
00951                        spindleStatus->status == RCS_DONE))
00952     {
00953       status = RCS_DONE;
00954       stateNext(S0);
00955     }
00956   else if (STATE_MATCH(S1,
00957                        spindleStatus->status == RCS_ERROR))
00958     {
00959       status = RCS_ERROR;
00960       stateNext(S0);
00961     }
00962   else if (STATE_MATCH(S1,
00963                        spindleStatus->status == RCS_EXEC))
00964     {
00965       // still working
00966     }
00967 }

void EMC_TOOL_MODULE::SPINDLE_BRAKE_RELEASE EMC_SPINDLE_BRAKE_RELEASE   cmdIn
 

Definition at line 901 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00902 {
00903   EMC_SPINDLE_BRAKE_RELEASE spindleBrakeReleaseMsg;
00904 
00905   if (STATE_MATCH(NEW_COMMAND))
00906     {
00907       sendCommand(&spindleBrakeReleaseMsg, spindleSubNum);
00908 
00909       status = RCS_EXEC;
00910       stateNext(S1);
00911     }
00912   else if (STATE_MATCH(S0))
00913     {
00914       // idle
00915     }
00916   else if (STATE_MATCH(S1,
00917                        spindleStatus->status == RCS_DONE))
00918     {
00919       status = RCS_DONE;
00920       stateNext(S0);
00921     }
00922   else if (STATE_MATCH(S1,
00923                        spindleStatus->status == RCS_ERROR))
00924     {
00925       status = RCS_ERROR;
00926       stateNext(S0);
00927     }
00928   else if (STATE_MATCH(S1,
00929                        spindleStatus->status == RCS_EXEC))
00930     {
00931       // still working
00932     }
00933 }

void EMC_TOOL_MODULE::SPINDLE_CONSTANT EMC_SPINDLE_CONSTANT   cmdIn
 

Definition at line 867 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00868 {
00869   EMC_SPINDLE_CONSTANT spindleConstantMsg;
00870 
00871   if (STATE_MATCH(NEW_COMMAND))
00872     {
00873       sendCommand(&spindleConstantMsg, spindleSubNum);
00874 
00875       status = RCS_EXEC;
00876       stateNext(S1);
00877     }
00878   else if (STATE_MATCH(S0))
00879     {
00880       // idle
00881     }
00882   else if (STATE_MATCH(S1,
00883                        spindleStatus->status == RCS_DONE))
00884     {
00885       status = RCS_DONE;
00886       stateNext(S0);
00887     }
00888   else if (STATE_MATCH(S1,
00889                        spindleStatus->status == RCS_ERROR))
00890     {
00891       status = RCS_ERROR;
00892       stateNext(S0);
00893     }
00894   else if (STATE_MATCH(S1,
00895                        spindleStatus->status == RCS_EXEC))
00896     {
00897       // still working
00898     }
00899 }

void EMC_TOOL_MODULE::SPINDLE_DECREASE EMC_SPINDLE_DECREASE   cmdIn
 

Definition at line 833 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00834 {
00835   EMC_SPINDLE_DECREASE spindleDecreaseMsg;
00836 
00837   if (STATE_MATCH(NEW_COMMAND))
00838     {
00839       sendCommand(&spindleDecreaseMsg, spindleSubNum);
00840 
00841       status = RCS_EXEC;
00842       stateNext(S1);
00843     }
00844   else if (STATE_MATCH(S0))
00845     {
00846       // idle
00847     }
00848   else if (STATE_MATCH(S1,
00849                        spindleStatus->status == RCS_DONE))
00850     {
00851       status = RCS_DONE;
00852       stateNext(S0);
00853     }
00854   else if (STATE_MATCH(S1,
00855                        spindleStatus->status == RCS_ERROR))
00856     {
00857       status = RCS_ERROR;
00858       stateNext(S0);
00859     }
00860   else if (STATE_MATCH(S1,
00861                        spindleStatus->status == RCS_EXEC))
00862     {
00863       // still working
00864     }
00865 }

void EMC_TOOL_MODULE::SPINDLE_DISABLE EMC_SPINDLE_DISABLE  
 

void EMC_TOOL_MODULE::SPINDLE_ENABLE EMC_SPINDLE_ENABLE  
 

void EMC_TOOL_MODULE::SPINDLE_INCREASE EMC_SPINDLE_INCREASE   cmdIn
 

Definition at line 799 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00800 {
00801   EMC_SPINDLE_INCREASE spindleIncreaseMsg;
00802 
00803   if (STATE_MATCH(NEW_COMMAND))
00804     {
00805       sendCommand(&spindleIncreaseMsg, spindleSubNum);
00806 
00807       status = RCS_EXEC;
00808       stateNext(S1);
00809     }
00810   else if (STATE_MATCH(S0))
00811     {
00812       // idle
00813     }
00814   else if (STATE_MATCH(S1,
00815                        spindleStatus->status == RCS_DONE))
00816     {
00817       status = RCS_DONE;
00818       stateNext(S0);
00819     }
00820   else if (STATE_MATCH(S1,
00821                        spindleStatus->status == RCS_ERROR))
00822     {
00823       status = RCS_ERROR;
00824       stateNext(S0);
00825     }
00826   else if (STATE_MATCH(S1,
00827                        spindleStatus->status == RCS_EXEC))
00828     {
00829       // still working
00830     }
00831 }

void EMC_TOOL_MODULE::SPINDLE_OFF EMC_SPINDLE_OFF   cmdIn
 

Definition at line 725 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00726 {
00727   EMC_SPINDLE_STOP stopMsg;
00728   EMC_SPINDLE_BRAKE_ENGAGE brakeEngageMsg;
00729 
00730   if (STATE_MATCH(NEW_COMMAND))
00731     {
00732       // turn spindle off
00733       sendCommand(&stopMsg, spindleSubNum);
00734 
00735       status = RCS_EXEC;
00736       stateNext(S1);            // wait on clock
00737     }
00738   else if (STATE_MATCH(S0))
00739     {
00740       // idle
00741     }
00742   else if (STATE_MATCH(S1,
00743                        spindleStatus->status == RCS_ERROR))
00744     {
00745       status = RCS_ERROR;
00746       stateNext(S0);
00747     }
00748   else if (STATE_MATCH(S1,
00749                        spindleStatus->status == RCS_EXEC))
00750     {
00751       // still working on the stop
00752     }
00753   else if (STATE_MATCH(S1,
00754                        spindleStatus->status == RCS_DONE))
00755     {
00756       // load delta clock
00757       deltaClock = SPINDLE_OFF_WAIT;
00758       stateNext(S2);
00759     }
00760   else if (STATE_MATCH(S2))
00761     {
00762       if (deltaClock <= 0.0)
00763         {
00764           stateNext(S3);
00765         }
00766       else
00767         {
00768           deltaClock -= EMC_IO_CYCLE_TIME;
00769         }
00770     }
00771   else if (STATE_MATCH(S3))
00772     {
00773       // time's up; put on brake
00774       sendCommand(&brakeEngageMsg, spindleSubNum);
00775 
00776       stateNext(S4);
00777     }
00778   else if (STATE_MATCH(S4,
00779                        spindleStatus->status == RCS_DONE))
00780     {
00781       // done
00782       status = RCS_DONE;
00783       stateNext(S0);
00784     }
00785   else if (STATE_MATCH(S4,
00786                        spindleStatus->status == RCS_ERROR))
00787     {
00788       // error
00789       status = RCS_ERROR;
00790       stateNext(S0);
00791     }
00792   else if (STATE_MATCH(S4,
00793                        spindleStatus->status == RCS_EXEC))
00794     {
00795       // still running
00796     }
00797 }

void EMC_TOOL_MODULE::SPINDLE_ON EMC_SPINDLE_ON   cmdIn
 

Definition at line 639 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00640 {
00641   EMC_SPINDLE_FORWARD forwardMsg;
00642   EMC_SPINDLE_REVERSE reverseMsg;
00643   EMC_SPINDLE_BRAKE_RELEASE brakeReleaseMsg;
00644   EMC_SPINDLE_STOP stopMsg;
00645 
00646   if (STATE_MATCH(NEW_COMMAND,
00647                   auxStatus->estop))
00648     {
00649       status = RCS_ERROR;
00650       stateNext(S0);
00651     }
00652   else if (STATE_MATCH(NEW_COMMAND,
00653                        ! auxStatus->estop))
00654     {
00655       // take brake off
00656       sendCommand(&brakeReleaseMsg, spindleSubNum);
00657       // load delta clock
00658       deltaClock = SPINDLE_ON_WAIT;
00659 
00660       status = RCS_EXEC;
00661       stateNext(S1);            // wait for time delay
00662     }
00663   else if (STATE_MATCH(S0))
00664     {
00665       // idle
00666     }
00667   else if (STATE_MATCH(S1))
00668     {
00669       // wait for clock to expire
00670       if (deltaClock <= 0.0)
00671         {
00672           stateNext(S2);
00673         }
00674       else
00675         {
00676           deltaClock -= EMC_IO_CYCLE_TIME;
00677         }
00678     }
00679   else if (STATE_MATCH(S2))
00680     {
00681       if (cmdIn->speed < 0.0)
00682         {
00683           sendCommand(&reverseMsg, spindleSubNum);
00684         }
00685       else if (cmdIn->speed > 0.0)
00686         {
00687           sendCommand(&forwardMsg, spindleSubNum);
00688         }
00689       else
00690         {
00691           sendCommand(&stopMsg, spindleSubNum);
00692         }
00693 
00694       stateNext(S3);
00695     }
00696   else if (STATE_MATCH(S3,
00697                        spindleStatus->status == RCS_DONE))
00698     {
00699       // done
00700       status = RCS_DONE;
00701       stateNext(S0);
00702     }
00703   else if (STATE_MATCH(S3,
00704                        spindleStatus->status == RCS_ERROR))
00705     {
00706       // error
00707       status = RCS_ERROR;
00708       stateNext(S0);
00709     }
00710   else if (STATE_MATCH(S3,
00711                        spindleStatus->status == RCS_EXEC))
00712     {
00713       // still running
00714     }
00715 }

void EMC_TOOL_MODULE::TOOL_LOAD EMC_TOOL_LOAD   cmdIn
 

Definition at line 545 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00546 {
00547   if (STATE_MATCH(NEW_COMMAND))
00548     {
00549       ioStatus.tool.toolInSpindle = ioStatus.tool.toolPrepped;
00550       ioStatus.tool.toolPrepped = 0;
00551 
00552       status = RCS_DONE;
00553       stateNext(S0);
00554     }
00555   else if (STATE_MATCH(S0))
00556     {
00557       // idle
00558     }
00559 }

void EMC_TOOL_MODULE::TOOL_LOAD_TOOL_TABLE EMC_TOOL_LOAD_TOOL_TABLE   cmdIn
 

Definition at line 576 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00577 {
00578   if (STATE_MATCH(NEW_COMMAND))
00579     {
00580       if (0 != loadToolTable(cmdIn->file, ioStatus.tool.toolTable))
00581         {
00582           status = RCS_ERROR;
00583         }
00584       else
00585         {
00586           status = RCS_DONE;
00587         }
00588       stateNext(S0);
00589     }
00590   else if (STATE_MATCH(S0))
00591     {
00592       // idle
00593     }
00594 }

void EMC_TOOL_MODULE::TOOL_PREPARE EMC_TOOL_PREPARE   cmdIn
 

Definition at line 530 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00531 {
00532   if (STATE_MATCH(NEW_COMMAND))
00533     {
00534       ioStatus.tool.toolPrepped = cmdIn->tool;
00535 
00536       status = RCS_DONE;
00537       stateNext(S0);
00538     }
00539   else if (STATE_MATCH(S0))
00540     {
00541       // idle
00542     }
00543 }

void EMC_TOOL_MODULE::TOOL_SET_OFFSET EMC_TOOL_SET_OFFSET   cmdIn
 

Definition at line 596 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00597 {
00598   if (STATE_MATCH(NEW_COMMAND))
00599     {
00600       if (cmdIn->tool < 0 || cmdIn->tool > CANON_TOOL_MAX)
00601         {
00602           status = RCS_ERROR;
00603           stateNext(S0);
00604         }
00605       else
00606         {
00607           // good tool number, so record it and save it
00608           ioStatus.tool.toolTable[cmdIn->tool].length = cmdIn->length;
00609           ioStatus.tool.toolTable[cmdIn->tool].diameter = cmdIn->diameter;
00610 
00611           if (0 != saveToolTable(TOOL_TABLE_FILE, ioStatus.tool.toolTable))
00612             {
00613               status = RCS_ERROR;
00614             }
00615           else
00616             {
00617               status = RCS_DONE;
00618             }
00619           stateNext(S0);
00620         }
00621     }
00622   else if (STATE_MATCH(S0))
00623     {
00624       // idle
00625     }
00626 }

void EMC_TOOL_MODULE::TOOL_UNLOAD EMC_TOOL_UNLOAD   cmdIn
 

Definition at line 561 of file bridgeporttool.cc.

Referenced by DECISION_PROCESS().

00562 {
00563   if (STATE_MATCH(NEW_COMMAND))
00564     {
00565       ioStatus.tool.toolInSpindle = 0;
00566 
00567       status = RCS_DONE;
00568       stateNext(S0);
00569     }
00570   else if (STATE_MATCH(S0))
00571     {
00572       // idle
00573     }
00574 }


Field Documentation

int EMC_TOOL_MODULE::auxSubNum
 

Definition at line 106 of file emcio.hh.

int EMC_TOOL_MODULE::coolantSubNum
 

Definition at line 105 of file emcio.hh.

double EMC_TOOL_MODULE::deltaClock
 

Definition at line 113 of file emcio.hh.

EMC_IO_STAT EMC_TOOL_MODULE::ioStatus
 

Definition at line 110 of file emcio.hh.

int EMC_TOOL_MODULE::lubeSubNum
 

Definition at line 107 of file emcio.hh.

int EMC_TOOL_MODULE::spindleSubNum
 

Definition at line 104 of file emcio.hh.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 15:29:02 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001