EthercatMasterWithThread.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 extern "C" {
00052 #include "ethercattype.h"
00053 #include "nicdrv.h"
00054 #include "ethercatbase.h"
00055 #include "ethercatmain.h"
00056 #include "ethercatconfig.h"
00057 #include "ethercatcoe.h"
00058 #include "ethercatdc.h"
00059 #include "ethercatprint.h"
00060 }
00061 #include "youbot/EthercatMasterWithThread.hpp"
00062 #include "youbot/DataTrace.hpp"
00063
00064 namespace youbot {
00065
00066 EthercatMasterWithThread::EthercatMasterWithThread(const std::string& configFile, const std::string& configFilePath) {
00067
00068
00069 this->ethercatConnectionEstablished = false;
00070 ethernetDevice = "eth0";
00071 timeTillNextEthercatUpdate = 1000;
00072 mailboxTimeout = 4000;
00073 ethercatTimeout = 500;
00074 communicationErrors = 0;
00075 maxCommunicationErrors = 100;
00076 stopThread = false;
00077 this->automaticSendOn = true;
00078 this->automaticReceiveOn = true;
00079 this->configFileName = configFile;
00080 this->configFilepath = configFilePath;
00081 configfile = NULL;
00082
00083
00084 for (unsigned int i = 0; i < 4096; i++) {
00085 IOmap_[i] = 0;
00086 }
00087
00088 configfile = new ConfigFile(this->configFileName, this->configFilepath);
00089
00090
00091 configfile->readInto(ethernetDevice, "EtherCAT", "EthernetDevice");
00092 configfile->readInto(timeTillNextEthercatUpdate, "EtherCAT", "EtherCATUpdateRate_[usec]");
00093 configfile->readInto(ethercatTimeout, "EtherCAT", "EtherCATTimeout_[usec]");
00094 configfile->readInto(mailboxTimeout, "EtherCAT", "MailboxTimeout_[usec]");
00095 configfile->readInto(maxCommunicationErrors, "EtherCAT", "MaximumNumberOfEtherCATErrors");
00096
00097 this->initializeEthercat();
00098
00099
00100
00101 }
00102
00103 EthercatMasterWithThread::~EthercatMasterWithThread() {
00104
00105 stopThread = true;
00106 threads.join_all();
00107 this->closeEthercat();
00108 if (configfile != NULL)
00109 delete configfile;
00110
00111 }
00112
00113 bool EthercatMasterWithThread::isThreadActive() {
00114
00115 return true;
00116
00117 }
00118
00119
00120 unsigned int EthercatMasterWithThread::getNumberOfSlaves() const {
00121
00122 return this->nrOfSlaves;
00123
00124 }
00125
00126 void EthercatMasterWithThread::AutomaticSendOn(const bool enableAutomaticSend) {
00127
00128 this->automaticSendOn = enableAutomaticSend;
00129
00130 if (this->automaticSendOn == true) {
00131 unsigned int slaveNo = 0;
00132
00133 for (unsigned int i = 0; i < automaticSendOffBufferVector.size(); i++) {
00134 slaveNo = automaticSendOffBufferVector[i].jointNumber - 1;
00135 slaveMessages[slaveNo].stctInput.Set(automaticSendOffBufferVector[i].stctInput);
00136 slaveMessages[slaveNo].stctOutput.Set(automaticSendOffBufferVector[i].stctOutput);
00137 slaveMessages[slaveNo].jointNumber.Set(automaticSendOffBufferVector[i].jointNumber);
00138 }
00139
00140 automaticSendOffBufferVector.clear();
00141 } else {
00142 return;
00143 }
00144 return;
00145
00146 }
00147
00148 void EthercatMasterWithThread::AutomaticReceiveOn(const bool enableAutomaticReceive) {
00149
00150 this->automaticReceiveOn = enableAutomaticReceive;
00151
00152
00153 if (this->automaticReceiveOn == false) {
00154
00155
00156 for (unsigned int i = 0; i < slaveMessages.size(); i++) {
00157 slaveMessages[i].stctInput.Get(automaticReceiveOffBufferVector[i].stctInput);
00158 slaveMessages[i].stctOutput.Get(automaticReceiveOffBufferVector[i].stctOutput);
00159 slaveMessages[i].jointNumber.Get(automaticReceiveOffBufferVector[i].jointNumber);
00160 }
00161 }
00162
00163 return;
00164
00165 }
00166
00167
00168
00169 void EthercatMasterWithThread::getEthercatDiagnosticInformation(std::vector<ec_slavet>& ethercatSlaveInfos) {
00170
00171 ethercatSlaveInfos = this->ethercatSlaveInfo;
00172 for (unsigned int i = 0; i < ethercatSlaveInfos.size(); i++) {
00173 ethercatSlaveInfos[i].inputs = NULL;
00174 ethercatSlaveInfos[i].outputs = NULL;
00175 }
00176
00177 }
00178
00179
00180
00181 bool EthercatMasterWithThread::sendProcessData() {
00182
00183 throw std::runtime_error("When using the EthercatMaster with thread there is not need to send process data manual.");
00184 return false;
00185
00186 }
00187
00188
00189
00190 bool EthercatMasterWithThread::receiveProcessData() {
00191
00192 throw std::runtime_error("When using the EthercatMaster with thread there is not need to receive process data manual");
00193 return false;
00194
00195 }
00196
00197
00198
00199 bool EthercatMasterWithThread::isErrorInSoemDriver() {
00200
00201
00202 return ec_iserror();
00203
00204
00205 }
00206
00207 void EthercatMasterWithThread::registerJointTrajectoryController(JointTrajectoryController* object, const unsigned int JointNumber) {
00208
00209 {
00210 boost::mutex::scoped_lock trajectoryControllerMutex(trajectoryControllerVectorMutex);
00211 if (this->trajectoryControllers[JointNumber - 1] != NULL)
00212 throw std::runtime_error("A joint trajectory controller is already register for this joint!");
00213 if ((JointNumber - 1) >= this->trajectoryControllers.size())
00214 throw std::out_of_range("Invalid joint number");
00215
00216 this->trajectoryControllers[JointNumber - 1] = object;
00217 }
00218 LOG(debug) << "register joint trajectory controller for joint: " << JointNumber;
00219
00220 }
00221
00222 void EthercatMasterWithThread::deleteJointTrajectoryControllerRegistration(const unsigned int JointNumber) {
00223
00224 {
00225 boost::mutex::scoped_lock trajectoryControllerMutex(trajectoryControllerVectorMutex);
00226 if ((JointNumber - 1) >= this->trajectoryControllers.size())
00227 throw std::out_of_range("Invalid joint number");
00228
00229 this->trajectoryControllers[JointNumber - 1] = NULL;
00230 }
00231 LOG(debug) << "delete joint trajectory controller registration for joint: " << JointNumber;
00232
00233 }
00234
00235 unsigned int EthercatMasterWithThread::getNumberOfThreadCyclesPerSecond() {
00236
00237
00238 return static_cast<unsigned int> (1.0 / ((double) timeTillNextEthercatUpdate / 1000 / 1000));
00239
00240 }
00241
00242 bool EthercatMasterWithThread::isEtherCATConnectionEstablished() {
00243
00244 return this->ethercatConnectionEstablished;
00245
00246 }
00247
00248 void EthercatMasterWithThread::registerJointLimitMonitor(JointLimitMonitor* object, const unsigned int JointNumber) {
00249
00250 {
00251 boost::mutex::scoped_lock limitMonitorMutex(jointLimitMonitorVectorMutex);
00252 if (this->jointLimitMonitors[JointNumber - 1] != NULL)
00253 LOG(warning) << "A joint limit monitor is already register for this joint!";
00254 if ((JointNumber - 1) >= this->jointLimitMonitors.size())
00255 throw std::out_of_range("Invalid joint number");
00256
00257 this->jointLimitMonitors[JointNumber - 1] = object;
00258 }
00259 LOG(debug) << "register a joint limit monitor for joint: " << JointNumber;
00260
00261 }
00262
00263 void EthercatMasterWithThread::registerDataTrace(void* object, const unsigned int JointNumber) {
00264
00265 {
00266 boost::mutex::scoped_lock datatraceM(dataTracesMutex);
00267 if (this->dataTraces[JointNumber - 1] != NULL)
00268 throw std::runtime_error("A data trace is already register for this joint!");
00269 if ((JointNumber - 1) >= this->dataTraces.size())
00270 throw std::out_of_range("Invalid joint number");
00271
00272 this->dataTraces[JointNumber - 1] = (DataTrace*)object;
00273 }
00274 LOG(debug) << "register a data trace for joint: " << JointNumber;
00275
00276 }
00277
00278 void EthercatMasterWithThread::deleteDataTraceRegistration(const unsigned int JointNumber) {
00279
00280 {
00281 boost::mutex::scoped_lock datatraceM(dataTracesMutex);
00282 if ((JointNumber - 1) >= this->dataTraces.size())
00283 throw std::out_of_range("Invalid joint number");
00284
00285 this->dataTraces[JointNumber - 1] = NULL;
00286
00287 }
00288 LOG(debug) << "removed data trace for joint: " << JointNumber;
00289
00290 }
00291
00292
00293 void EthercatMasterWithThread::initializeEthercat() {
00294
00295
00296
00297 if (ec_init(ethernetDevice.c_str())) {
00298 LOG(info) << "Initializing EtherCAT on " << ethernetDevice << " with communication thread";
00299
00300 if (ec_config(TRUE, &IOmap_) > 0) {
00301
00302 LOG(trace) << ec_slavecount << " EtherCAT slaves found and configured.";
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 ec_statecheck(0, EC_STATE_SAFE_OP, EC_TIMEOUTSTATE);
00336 if (ec_slave[0].state != EC_STATE_SAFE_OP) {
00337 LOG(warning) << "Not all EtherCAT slaves reached safe operational state.";
00338 ec_readstate();
00339
00340 for (int i = 1; i <= ec_slavecount; i++) {
00341 if (ec_slave[i].state != EC_STATE_SAFE_OP) {
00342 LOG(info) << "Slave " << i << " State=" << ec_slave[i].state << " StatusCode=" << ec_slave[i].ALstatuscode << " : " << ec_ALstatuscode2string(ec_slave[i].ALstatuscode);
00343
00344 }
00345 }
00346 }
00347
00348
00349
00350
00351
00352 LOG(trace) << "Request operational state for all EtherCAT slaves";
00353
00354 ec_slave[0].state = EC_STATE_OPERATIONAL;
00355
00356
00357 ec_send_processdata();
00358 ec_receive_processdata(EC_TIMEOUTRET);
00359
00360 ec_writestate(0);
00361
00362
00363 ec_statecheck(0, EC_STATE_OPERATIONAL, EC_TIMEOUTSTATE);
00364 if (ec_slave[0].state == EC_STATE_OPERATIONAL) {
00365 LOG(trace) << "Operational state reached for all EtherCAT slaves.";
00366 } else {
00367 throw std::runtime_error("Not all EtherCAT slaves reached operational state.");
00368
00369 }
00370
00371 } else {
00372 throw std::runtime_error("No EtherCAT slaves found!");
00373 }
00374
00375 } else {
00376 throw std::runtime_error("No socket connection on " + ethernetDevice + "\nExcecute as root");
00377 }
00378
00379
00380
00381 std::string baseJointControllerName = "TMCM-174";
00382 std::string baseJointControllerNameAlternative = "TMCM-1632";
00383 std::string manipulatorJointControllerName = "TMCM-174";
00384 std::string ManipulatorJointControllerNameAlternative = "TMCM-1610";
00385 std::string actualSlaveName;
00386 nrOfSlaves = 0;
00387 YouBotSlaveMsg emptySlaveMsg;
00388 YouBotSlaveMsgThreadSafe emptySlaveMsgThreadSafe;
00389
00390 configfile->readInto(baseJointControllerName, "BaseJointControllerName");
00391 configfile->readInto(baseJointControllerNameAlternative, "BaseJointControllerNameAlternative");
00392 configfile->readInto(manipulatorJointControllerName, "ManipulatorJointControllerName");
00393 configfile->readInto(ManipulatorJointControllerNameAlternative, "ManipulatorJointControllerNameAlternative");
00394
00395
00396 for (int cnt = 1; cnt <= ec_slavecount; cnt++) {
00397 LOG(trace) << "Slave: " << cnt << " Name: " << ec_slave[cnt].name << " Output size: " << ec_slave[cnt].Obits
00398 << "bits Input size: " << ec_slave[cnt].Ibits << "bits State: " << ec_slave[cnt].state
00399 << " delay: " << ec_slave[cnt].pdelay;
00400
00401 ethercatSlaveInfo.push_back(ec_slave[cnt]);
00402
00403 actualSlaveName = ec_slave[cnt].name;
00404 if ((actualSlaveName == baseJointControllerName || actualSlaveName == baseJointControllerNameAlternative ||
00405 actualSlaveName == manipulatorJointControllerName || actualSlaveName == ManipulatorJointControllerNameAlternative
00406 ) && ec_slave[cnt].Obits > 0 && ec_slave[cnt].Ibits > 0) {
00407 nrOfSlaves++;
00408 ethercatOutputBufferVector.push_back((SlaveMessageOutput*) (ec_slave[cnt].outputs));
00409 ethercatInputBufferVector.push_back((SlaveMessageInput*) (ec_slave[cnt].inputs));
00410 YouBotSlaveMailboxMsgThreadSafe emptyMailboxSlaveMsg(cnt);
00411 mailboxMessages.push_back(emptyMailboxSlaveMsg);
00412 pendingMailboxMsgsReply.push_back(false);
00413 trajectoryControllers.push_back(NULL);
00414 jointLimitMonitors.push_back(NULL);
00415 slaveMessages.push_back(emptySlaveMsgThreadSafe);
00416 outstandingMailboxMsgFlag.push_back(false);
00417 newInputMailboxMsgFlag.push_back(false);
00418 dataTraces.push_back(NULL);
00419 }
00420 }
00421 automaticReceiveOffBufferVector.reserve(slaveMessages.size());
00422
00423 if (nrOfSlaves > 0) {
00424 LOG(info) << nrOfSlaves << " EtherCAT slaves found";
00425 } else {
00426 throw std::runtime_error("No EtherCAT slave could be found");
00427 return;
00428 }
00429
00430 stopThread = false;
00431 threads.create_thread(boost::bind(&EthercatMasterWithThread::updateSensorActorValues, this));
00432
00433 SLEEP_MILLISEC(10);
00434
00435 this->ethercatConnectionEstablished = true;
00436 return;
00437
00438 }
00439
00440
00441 bool EthercatMasterWithThread::closeEthercat() {
00442
00443
00444 this->ethercatConnectionEstablished = false;
00445
00446 ec_slave[0].state = EC_STATE_SAFE_OP;
00447
00448
00449 ec_writestate(0);
00450
00451
00452 ec_close();
00453
00454 return true;
00455
00456 }
00457
00458
00459
00460
00461 void EthercatMasterWithThread::setMsgBuffer(const YouBotSlaveMsg& msgBuffer, const unsigned int jointNumber) {
00462
00463
00464 if (this->automaticSendOn == true) {
00465 slaveMessages[jointNumber - 1].stctOutput.Set(msgBuffer.stctOutput);
00466 } else {
00467 YouBotSlaveMsg localMsg;
00468 localMsg.stctInput = msgBuffer.stctInput;
00469 localMsg.stctOutput = msgBuffer.stctOutput;
00470 localMsg.jointNumber = jointNumber;
00471 automaticSendOffBufferVector.push_back(localMsg);
00472 }
00473
00474
00475 }
00476
00477
00478
00479
00480 void EthercatMasterWithThread::getMsgBuffer(const unsigned int jointNumber, YouBotSlaveMsg& returnMsg) {
00481
00482
00483 if (this->automaticReceiveOn == true) {
00484 slaveMessages[jointNumber - 1].stctInput.Get(returnMsg.stctInput);
00485 slaveMessages[jointNumber - 1].stctOutput.Get(returnMsg.stctOutput);
00486 slaveMessages[jointNumber - 1].jointNumber.Get(returnMsg.jointNumber);
00487 } else {
00488 returnMsg = this->automaticReceiveOffBufferVector[jointNumber - 1];
00489 }
00490
00491
00492 }
00493
00494
00495
00496
00497 void EthercatMasterWithThread::setMailboxMsgBuffer(const YouBotSlaveMailboxMsg& msgBuffer, const unsigned int jointNumber) {
00498
00499 this->mailboxMessages[jointNumber - 1].stctOutput.Set(msgBuffer.stctOutput);
00500 outstandingMailboxMsgFlag[jointNumber - 1] = true;
00501 return;
00502
00503 }
00504
00505
00506
00507
00508 bool EthercatMasterWithThread::getMailboxMsgBuffer(YouBotSlaveMailboxMsg& mailboxMsg, const unsigned int jointNumber) {
00509
00510 if (newInputMailboxMsgFlag[jointNumber - 1] == true) {
00511 this->mailboxMessages[jointNumber - 1].stctInput.Get(mailboxMsg.stctInput);
00512 newInputMailboxMsgFlag[jointNumber - 1] = false;
00513 return true;
00514 }
00515 return false;
00516
00517 }
00518
00519
00520
00521 bool EthercatMasterWithThread::sendMailboxMessage(const YouBotSlaveMailboxMsg& mailboxMsg) {
00522
00523
00524 mailboxBufferSend[0] = mailboxMsg.stctOutput.moduleAddress;
00525 mailboxBufferSend[1] = mailboxMsg.stctOutput.commandNumber;
00526 mailboxBufferSend[2] = mailboxMsg.stctOutput.typeNumber;
00527 mailboxBufferSend[3] = mailboxMsg.stctOutput.motorNumber;
00528 mailboxBufferSend[4] = mailboxMsg.stctOutput.value >> 24;
00529 mailboxBufferSend[5] = mailboxMsg.stctOutput.value >> 16;
00530 mailboxBufferSend[6] = mailboxMsg.stctOutput.value >> 8;
00531 mailboxBufferSend[7] = mailboxMsg.stctOutput.value & 0xff;
00532 if (ec_mbxsend(mailboxMsg.slaveNumber, &mailboxBufferSend, mailboxTimeout)) {
00533 return true;
00534 } else {
00535 return false;
00536 }
00537
00538 }
00539
00540
00541
00542 bool EthercatMasterWithThread::receiveMailboxMessage(YouBotSlaveMailboxMsg& mailboxMsg) {
00543
00544 if (ec_mbxreceive(mailboxMsg.slaveNumber, &mailboxBufferReceive, mailboxTimeout)) {
00545
00546 mailboxMsg.stctInput.replyAddress = (int) mailboxBufferReceive[0];
00547 mailboxMsg.stctInput.moduleAddress = (int) mailboxBufferReceive[1];
00548 mailboxMsg.stctInput.status = (int) mailboxBufferReceive[2];
00549 mailboxMsg.stctInput.commandNumber = (int) mailboxBufferReceive[3];
00550 mailboxMsg.stctInput.value = (mailboxBufferReceive[4] << 24 | mailboxBufferReceive[5] << 16 | mailboxBufferReceive[6] << 8 | mailboxBufferReceive[7]);
00551 return true;
00552 }
00553 return false;
00554
00555 }
00556
00557
00558
00559 void EthercatMasterWithThread::updateSensorActorValues() {
00560
00561
00562 long timeToWait = 0;
00563 boost::posix_time::ptime startTime = boost::posix_time::microsec_clock::local_time();
00564 boost::posix_time::time_duration pastTime;
00565
00566 boost::posix_time::time_duration realperiode;
00567 boost::posix_time::time_duration timeSum = startTime - startTime;
00568 SlaveMessageOutput trajectoryContollerOutput;
00569 YouBotSlaveMailboxMsg tempMsg;
00570
00571
00572 while (!stopThread) {
00573
00574 pastTime = boost::posix_time::microsec_clock::local_time() - startTime;
00575 timeToWait = timeTillNextEthercatUpdate - pastTime.total_microseconds() - 100;
00576
00577 if (timeToWait < 0 || timeToWait > (int) timeTillNextEthercatUpdate) {
00578
00579 } else {
00580 boost::this_thread::sleep(boost::posix_time::microseconds(timeToWait));
00581 }
00582
00583
00584 startTime = boost::posix_time::microsec_clock::local_time();
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603 if (ec_send_processdata() == 0) {
00604 LOG(warning) << "Sending process data failed";
00605 }
00606
00607 if (ec_receive_processdata(this->ethercatTimeout) == 0) {
00608 if (communicationErrors == 0) {
00609 LOG(warning) << "Receiving data failed";
00610 }
00611 communicationErrors++;
00612 } else {
00613 communicationErrors = 0;
00614 }
00615
00616 if (communicationErrors > maxCommunicationErrors) {
00617 LOG(error) << "Lost EtherCAT connection";
00618 this->closeEthercat();
00619 stopThread = true;
00620 break;
00621 }
00622
00623 if (ec_iserror())
00624 LOG(warning) << "there is an error in the soem driver";
00625
00626
00627 for (unsigned int i = 0; i < nrOfSlaves; i++) {
00628
00629
00630 if(automaticSendOn == true)
00631 slaveMessages[i].stctOutput.Get(*(ethercatOutputBufferVector[i]));
00632
00633
00634 if(automaticReceiveOn == true)
00635 slaveMessages[i].stctInput.Set(*(ethercatInputBufferVector[i]));
00636
00637
00638
00639 if (jointLimitMonitors[i] != NULL) {
00640 this->jointLimitMonitors[i]->checkLimitsProcessData(*(ethercatInputBufferVector[i]), *(ethercatOutputBufferVector[i]));
00641
00642 slaveMessages[i].stctOutput.Set(*(ethercatOutputBufferVector[i]));
00643 }
00644
00645
00646
00647 if (outstandingMailboxMsgFlag[i]) {
00648 this->mailboxMessages[i].stctOutput.Get(tempMsg.stctOutput);
00649 this->mailboxMessages[i].slaveNumber.Get(tempMsg.slaveNumber);
00650 sendMailboxMessage(tempMsg);
00651 outstandingMailboxMsgFlag[i] = false;
00652 pendingMailboxMsgsReply[i] = true;
00653 }
00654
00655
00656 if (pendingMailboxMsgsReply[i]) {
00657 this->mailboxMessages[i].slaveNumber.Get(tempMsg.slaveNumber);
00658 if (receiveMailboxMessage(tempMsg)) {
00659 this->mailboxMessages[i].stctInput.Set(tempMsg.stctInput);
00660 newInputMailboxMsgFlag[i] = true;
00661 pendingMailboxMsgsReply[i] = false;
00662 }
00663 }
00664 }
00665
00666
00667 {
00668 boost::mutex::scoped_lock trajectoryControllerMutex(trajectoryControllerVectorMutex);
00669 for (unsigned int i = 0; i < nrOfSlaves; i++) {
00670 if (this->trajectoryControllers[i] != NULL) {
00671 if (this->trajectoryControllers[i]->updateTrajectoryController(*(ethercatInputBufferVector[i]), trajectoryContollerOutput)) {
00672
00673 (*(ethercatOutputBufferVector[i])).controllerMode = trajectoryContollerOutput.controllerMode;
00674 (*(ethercatOutputBufferVector[i])).value = trajectoryContollerOutput.value;
00675
00676 slaveMessages[i].stctOutput.Set(*(ethercatOutputBufferVector[i]));
00677 }
00678 }
00679 }
00680 }
00681
00682 for (unsigned int i = 0; i < nrOfSlaves; i++) {
00683 {
00684 boost::mutex::scoped_lock datatraceM(dataTracesMutex);
00685 if (dataTraces[i] != NULL) {
00686 ((DataTrace*)dataTraces[i])->updateTrace();
00687 }
00688 }
00689 }
00690 }
00691
00692 }
00693
00694 void EthercatMasterWithThread::parseYouBotErrorFlags(const YouBotSlaveMsg& messageBuffer) {
00695
00696 std::stringstream errorMessageStream;
00697 errorMessageStream << " ";
00698 std::string errorMessage;
00699 errorMessage = errorMessageStream.str();
00700
00701
00702 if (messageBuffer.stctInput.errorFlags & OVER_CURRENT) {
00703 LOG(error) << errorMessage << "got over current";
00704
00705 }
00706
00707 if (messageBuffer.stctInput.errorFlags & UNDER_VOLTAGE) {
00708 LOG(error) << errorMessage << "got under voltage";
00709
00710 }
00711
00712 if (messageBuffer.stctInput.errorFlags & OVER_VOLTAGE) {
00713 LOG(error) << errorMessage << "got over voltage";
00714
00715 }
00716
00717 if (messageBuffer.stctInput.errorFlags & OVER_TEMPERATURE) {
00718 LOG(error) << errorMessage << "got over temperature";
00719
00720 }
00721
00722 if (messageBuffer.stctInput.errorFlags & MOTOR_HALTED) {
00723
00724
00725 }
00726
00727 if (messageBuffer.stctInput.errorFlags & HALL_SENSOR_ERROR) {
00728 LOG(error) << errorMessage << "got hall sensor problem";
00729
00730 }
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747 if (messageBuffer.stctInput.errorFlags & VELOCITY_MODE) {
00748
00749
00750 }
00751
00752 if (messageBuffer.stctInput.errorFlags & POSITION_MODE) {
00753
00754
00755 }
00756
00757 if (messageBuffer.stctInput.errorFlags & TORQUE_MODE) {
00758
00759
00760 }
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772 if (messageBuffer.stctInput.errorFlags & POSITION_REACHED) {
00773
00774
00775 }
00776
00777 if (messageBuffer.stctInput.errorFlags & INITIALIZED) {
00778
00779
00780 }
00781
00782 if (messageBuffer.stctInput.errorFlags & TIMEOUT) {
00783 LOG(error) << errorMessage << "has a timeout";
00784
00785 }
00786
00787 if (messageBuffer.stctInput.errorFlags & I2T_EXCEEDED) {
00788 LOG(error) << errorMessage << "exceeded I2t";
00789
00790 }
00791
00792
00793 }
00794
00795 std::string EthercatMasterWithThread::configFileName;
00796
00797 std::string EthercatMasterWithThread::configFilepath;
00798
00799
00800 }