Changeset 8863
- Timestamp:
- 02/15/08 21:42:55 (17 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r8862 r8863 1 1 -*-*- END -*-*- 2 2 3 2008/02/13 Thomas Bretz (La Palma) 3 2008/02/15 Thomas Bretz (La Palma) 4 5 * candrv/network.cc, candrv/nodedrv.h: 6 - changed arguments and contents of HandleSDOError 7 8 * devdrv/macs.[h,cc]: 9 - added status/error handling for DKC status 10 11 * devdrv/shaftencoder.cc: 12 - changed some output 13 - handle all four bytes in case of the position 14 15 * gui/MGCosy.cc: 16 - increased width of shaftencoder labels 17 18 19 20 2008/02/15 Thomas Bretz (La Palma) 4 21 5 22 * cosy.cc: -
trunk/MagicSoft/Cosy/candrv/network.cc
r8862 r8863 111 111 112 112 case kSDO_TX_ERROR: // error message (instead of 0x60) 113 fNodes[node]->HandleSDOError( data);113 fNodes[node]->HandleSDOError(idx, subidx); 114 114 return; 115 115 } -
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r8843 r8863 167 167 // Print an error message with the corresponding data from this device. 168 168 // 169 void NodeDrv::HandleSDOError( LWORD_t data)170 { 171 gLog << warn << "WARNING - Nodedrv::HandleSDOError: Entry not found in dictionary (data=0x";172 gLog << hex << setfill('0') << setw(4) << data<< ")";169 void NodeDrv::HandleSDOError(WORD_t idx, BYTE_t subidx) 170 { 171 gLog << warn << "WARNING - Nodedrv::HandleSDOError: Node #" << dec << (int)fId << ": Entry not found in dictionary (idx=0x"; 172 gLog << hex << setfill('0') << setw(4) << idx << "/" << (int)subidx << dec << ")"; 173 173 gLog << endl; 174 174 } -
trunk/MagicSoft/Cosy/candrv/nodedrv.h
r8835 r8863 67 67 virtual void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv); 68 68 virtual void HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, const timeval_t &tv); 69 virtual void HandleSDOError( LWORD_t data);69 virtual void HandleSDOError(WORD_t idx, BYTE_t subidx); 70 70 71 71 virtual void HandlePDO1(const BYTE_t *data, const timeval_t &tv) {} -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r8835 r8863 4 4 5 5 #include "network.h" 6 6 7 #include "MLogManip.h" 8 9 #include "MString.h" 7 10 8 11 ClassImp(Macs); … … 42 45 } 43 46 47 TString Macs::EvalStatusDKC(UInt_t stat) const 48 { 49 switch (stat) 50 { 51 case 0: return "offline"; 52 case 0xa000: 53 case 0xa001: 54 case 0xa002: 55 case 0xa003: return MString::Format("Communication phase %d", stat&0xf); 56 case 0xa010: return "Drive HALT"; 57 case 0xa012: return "Control and power section ready for operation"; 58 case 0xa013: return "Ready for power on"; 59 case 0xa100: return "Drive in Torque mode"; 60 case 0xa101: return "Drive in Velocity mode"; 61 case 0xa102: return "Position control mode with encoder 1"; 62 case 0xa103: return "Position control mode with encoder 2"; 63 case 0xa104: return "Lagless position control mode with encoder 1"; 64 case 0xa105: return "Lagless position control mode with encoder 2"; 65 case 0xa106: return "Drive controlled interpolated positioning with encoder 1"; 66 case 0xa107: return "Drive controlled interpolated positioning with encoder 2"; 67 case 0xa108: return "Drive controlled interpolated absolute positioning lagless with encoder 1"; 68 case 0xa109: return "Drive controlled interpolated absolute positioning lagless with encoder 2"; 69 case 0xa146: return "Drive controlled interpolated relative positioning with encoder 1"; 70 case 0xa147: return "Drive controlled interpolated relative positioning with encoder 2"; 71 case 0xa148: return "Drive controlled interpolated relative positioning lagless with encoder 1"; 72 case 0xa149: return "Drive controlled interpolated relative positioning lagless with encoder 2"; 73 case 0xa208: return "Jog mode positive"; 74 case 0xa218: return "Jog mode negative"; 75 case 0xa400: return "Automatic drive check and adjustment"; 76 case 0xa401: return "Drive decelerating to standstill"; 77 case 0xa800: return "Unknown operation mode"; 78 case 0xc217: return "Motor encoder reading error"; 79 case 0xc218: return "Shaft encoder reading error"; 80 case 0xc220: return "Motor encoder initialization error"; 81 case 0xc221: return "Shaft encoder initialization error"; 82 case 0xc400: return "Switching to parameter mode"; 83 case 0xc500: return "Error reset"; 84 case 0xe225: return "Motor overload"; 85 case 0xe250: return "Drive overtemp warning"; 86 case 0xe251: return "Motor overtemp warning"; 87 case 0xe252: return "Bleeder overtemp warning"; 88 case 0xe834: return "Emergency-Stop"; 89 case 0xe843: return "Positive end-switch activated"; 90 case 0xe844: return "Negative end-switch activated"; 91 case 0xf218: return "Amplifier overtemp shutdown"; 92 case 0xf219: return "Motor overtemp shutdown"; 93 case 0xf220: return "Bleeder overload shutdown"; 94 case 0xf221: return "Motor temperature surveillance defective"; 95 case 0xf224: return "Maximum breaking time exceeded"; 96 case 0xf228: return "Excessive control deviation"; 97 case 0xf269: return "Error during release of the motor holding brake"; 98 case 0xf276: return "Absolute encoder out of allowed window"; 99 case 0xf409: return "Bus error on Profibus interface"; 100 case 0xf434: return "Emergency-Stop"; 101 case 0xf629: return "Positive sw end-switch"; 102 case 0xf630: return "Negative sw end-switch"; 103 case 0xf634: return "Emergency-Stop"; 104 case 0xf643: return "Positive hw end-switch"; 105 case 0xf644: return "Negative hw end-switch"; 106 case 0xf870: return "24V DC error."; 107 case 0xf878: return "Velocity loop error"; 108 } 109 return "unknown"; 110 } 111 112 Bool_t Macs::EvalStatus(LWORD_t val) const 113 { 114 const Int_t errnum = val&0xffff; 115 const Int_t errinf = val>>16; 116 117 if (errnum!=0xff) 118 return errnum==0; 119 120 const Int_t type = errinf&0xf000; 121 122 gLog << all << "DKC reports: "; 123 124 switch (type) 125 { 126 case 0xf000: gLog << "ERROR"; break; 127 case 0xe000: gLog << "WARNING"; break; 128 case 0xa000: gLog << "Status"; break; 129 default: gLog << "Unknown"; break; 130 } 131 132 gLog << " (" << MString::Format("%X", errinf) << "): " << EvalStatusDKC(errinf); 133 134 gLog << (type==0xf000 || type==0xe000 ? "!" : ".") << endl; 135 136 return type==0xa000; 137 } 138 44 139 void Macs::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv) 45 140 { … … 52 147 if (subidx!=2) 53 148 return; 54 gLog << inf2 << "- " << GetNodeName() << ": Error[0]=" << dec << val<< endl;55 SetError( val);149 gLog << inf2 << "- " << GetNodeName() << ": Error[0]=" << hex << val << dec << endl; 150 SetError(EvalStatus(val) ? 0 : val); 56 151 return; 57 152 … … 122 217 123 218 case 0x6002: 124 gLog << inf2 << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl;219 gLog << inf2 << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " (100%)" << endl; 125 220 fVelRes = val; 126 221 return; 127 222 128 223 case 0x6501: 129 gLog << inf2 << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks /min" << endl;224 gLog << inf2 << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks" << endl; 130 225 fRes = val; 131 226 return; … … 362 457 if (fSoftVersion<0x00000045) // 00.69 363 458 { 364 gLog << err << GetNodeName() << " - Software Version too old!" << endl;459 gLog << err << GetNodeName() << " - Software Version " << 0.01*fSoftVersion << " too old!" << endl; 365 460 SetZombie(); 366 461 return; … … 471 566 SendSDO(0x2002, vel); // velocity 472 567 WaitForSdo(0x2002, 0); 568 cout << "SET VEL: " << vel << endl; 473 569 } 474 570 … … 477 573 SendSDO(0x2003, 0, acc); // acceleration 478 574 WaitForSdo(0x2003, 0); 575 cout << "SET ACC: " << acc << endl; 479 576 } 480 577 … … 483 580 SendSDO(0x2003, 1, dec); // acceleration 484 581 WaitForSdo(0x2003, 1); 582 cout << "SET DEC: " << dec << endl; 485 583 } 486 584 … … 503 601 { 504 602 SendSDO(0x6004, 1, (LWORD_t)pos); 603 cout << "REL POS: " << (LWORD_t)pos << endl; 505 604 } 506 605 … … 508 607 { 509 608 SendSDO(0x6004, 0, (LWORD_t)pos); 609 cout << "ABS POS: " << (LWORD_t)pos << endl; 510 610 } 511 611 … … 585 685 LWORDS_t errinf = (data[4]<<24) | (data[5]<<16) | (data[6]<<8) | data[7]; 586 686 587 // 687 // Check if the DKC changed its status message 688 if (errnum==0xff && (errinf&0xf000)<=0xe000) 689 { 690 EvalStatus(errnum, errinf); 691 SetError(0); 692 return; 693 } 694 695 // Check if MACS report error occursion. 588 696 // errnum==0 gives a sudden information that something happened. Now the 589 697 // microcontroller is running inside its interrupt procedure which … … 606 714 if (GetError()>0) 607 715 { 608 gLog << warn << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl;716 gLog << warn << GetNodeName() << ": WARNING! Previous error #" << GetError() << " unhandled (not cleared) by software." << endl; 609 717 610 718 // … … 724 832 return; 725 833 834 case 0xff: 835 EvalStatus(errnum, errinf); 836 return; 837 726 838 default: 727 gLog << "Error Nr. " << errnum << ", " << errinf << endl;839 gLog << "Error Nr. " << dec << errnum << ", " << errinf << endl; 728 840 } 729 841 } … … 800 912 DelError(); 801 913 return; 914 915 case 0xff: 916 gLog << err << "DKC error! Go and check what is going on!" << endl; 917 DelError(); 918 return; 802 919 /* 803 920 case 101: … … 870 987 gLog << inf2 << "- " << GetNodeName() << ": Hostguarding stopped." << endl; 871 988 } 872 -
trunk/MagicSoft/Cosy/devdrv/macs.h
r8835 r8863 37 37 void Init(); 38 38 void StopDevice(); 39 40 TString EvalStatusDKC(UInt_t stat) const; 41 Bool_t EvalStatus(LWORD_t val) const; 42 Bool_t EvalStatus(UInt_t errnum, UInt_t errinf) const 43 { 44 return EvalStatus(errnum|(errinf<<16)); 45 } 39 46 40 47 void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv); -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r8862 r8863 92 92 93 93 case 0x6004: 94 gLog << inf2 << "- Position: " << dec <<val << endl;94 gLog << inf2 << "- Reported position: " << dec << (Int_t)val << endl; 95 95 fPos = val; 96 96 fTurn = 0; … … 237 237 // Decode information, we have a 14bit only 238 238 // 239 LWORDS_t pos = data[0] | (data[1]<<8) | (data[2]<<16) ; //| (data[3]<<24);239 LWORDS_t pos = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24); 240 240 BYTE_t flag = data[4]; 241 241 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r8856 r8863 165 165 fList->Add(fWeather); 166 166 167 fLabel1 = new TGLabel(f, "00000 "); // Max: 16384168 fLabel2 = new TGLabel(f, "00000 ");169 fLabel3 = new TGLabel(f, "00000 ");167 fLabel1 = new TGLabel(f, "00000000"); // Max: 16384 168 fLabel2 = new TGLabel(f, "00000000"); 169 fLabel3 = new TGLabel(f, "00000000"); 170 170 fLabel1->SetTextJustify(kTextRight); 171 171 fLabel2->SetTextJustify(kTextRight);
Note:
See TracChangeset
for help on using the changeset viewer.