Changeset 926
- Timestamp:
- 09/10/01 14:32:27 (23 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r925 r926 1 1 -*-*- END -*-*- 2 3 2001/09/10 - Thomas Bretz: 4 5 * base/timer.[h,cc]: 6 - added dome comments 7 8 * candrv/canopen.[cc,h]: 9 - added boolean in SendSDO to suppress occurance in SDO list 10 11 * candrv/nodedrv.[h,cc]: 12 - added Names for Node 13 - added boolean in SendSDO to suppress occurance in SDO list 14 15 * devdrv/macs.[h,cc]: 16 - changed GetId() to GetNodeName() in logging output 17 - made timeout timer periodic again 18 - added timeout for Mac response (added SDOOK) 19 - added Name for Node 20 21 * devdrv/shaftencoder.[h,cc]: 22 - changed GetId() to GetNodeName() in logging output 23 - added Name for Node 24 25 * main/MCosy.[h,cc]: 26 - renamed fAlt1 to fZd1 27 - renamed fAlt2 to fZd2 28 29 30 2 31 2001/09/07 - Thomas Bretz: 3 32 -
trunk/MagicSoft/Cosy/ToDo
r921 r926 21 21 22 22 - Devide MTTalk into NetworkInit and MCalcTrackingError/Offset-Class 23 24 - Add possibility to check for timeout when WaitForSDO returns 25 (switching on Guarding!) 26 27 - If an Error state is set, the first call to Track/Positioning only 28 results in Error Handling. The second one gives the requested 29 action 23 30 -
trunk/MagicSoft/Cosy/base/timer.cc
r912 r926 75 75 } 76 76 77 double Timer::Now() 77 double Timer::Now() //[s] 78 78 { 79 79 struct timeval tv; … … 97 97 } 98 98 99 Timer::operator double() 99 Timer::operator double() //[s] 100 100 { 101 101 return fMs+fSecs; -
trunk/MagicSoft/Cosy/base/timer.h
r912 r926 31 31 32 32 int GetSecs() { return fSecs; } 33 double Now(); 33 double Now(); //[s] 34 34 double CalcMjd(); 35 35 … … 42 42 void Print(); 43 43 44 operator double(); 44 operator double(); //[s] 45 45 }; 46 46 -
trunk/MagicSoft/Cosy/candrv/canopen.cc
r920 r926 184 184 } 185 185 186 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, BYTE_t val) 187 { 188 fSdoList.Add(node, idx, subidx); 186 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, BYTE_t val, bool store) 187 { 188 if (store) 189 fSdoList.Add(node, idx, subidx); 189 190 190 191 SendCanFrame(CobId(node, kSDO_TX), kSDO_RX1, … … 192 193 } 193 194 194 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, WORD_t val) 195 { 196 fSdoList.Add(node, idx, subidx); 195 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, WORD_t val, bool store) 196 { 197 if (store) 198 fSdoList.Add(node, idx, subidx); 197 199 198 200 SendCanFrame(CobId(node, kSDO_TX), kSDO_RX2, … … 201 203 } 202 204 203 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, LWORD_t val) 204 { 205 fSdoList.Add(node, idx, subidx); 205 void CanOpen::SendSDO(BYTE_t node, WORD_t idx, BYTE_t subidx, LWORD_t val, bool store) 206 { 207 if (store) 208 fSdoList.Add(node, idx, subidx); 206 209 207 210 SendCanFrame(CobId(node, kSDO_TX), kSDO_RX4, -
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r925 r926 7 7 #include "MLogManip.h" 8 8 9 NodeDrv::NodeDrv(BYTE_t nodeid, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0)9 NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0) 10 10 { 11 11 if (nodeid>31) … … 16 16 17 17 fId = nodeid; 18 19 if (name) 20 { 21 fName = new char[strlen(name)+1]; 22 strcpy(fName, name); 23 } 24 else 25 { 26 fName = new char[9]; 27 sprintf(fName, "Node#%d", nodeid); 28 } 29 } 30 31 NodeDrv::~NodeDrv() 32 { 33 delete fName; 18 34 } 19 35 … … 80 96 } 81 97 82 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val )98 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val, bool store) 83 99 { 84 fNetwork->SendSDO(fId, idx, subidx, val );100 fNetwork->SendSDO(fId, idx, subidx, val, store); 85 101 } 86 102 87 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val )103 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val, bool store) 88 104 { 89 fNetwork->SendSDO(fId, idx, subidx, val );105 fNetwork->SendSDO(fId, idx, subidx, val, store); 90 106 } 91 107 92 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val )108 void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, bool store) 93 109 { 94 fNetwork->SendSDO(fId, idx, subidx, val );110 fNetwork->SendSDO(fId, idx, subidx, val, store); 95 111 } 96 112 97 113 void NodeDrv::SendSDO(WORD_t idx, BYTE_t val) 98 114 { 99 fNetwork->SendSDO(fId, idx, val );115 fNetwork->SendSDO(fId, idx, val, true); 100 116 } 101 117 102 118 void NodeDrv::SendSDO(WORD_t idx, WORD_t val) 103 119 { 104 fNetwork->SendSDO(fId, idx, val );120 fNetwork->SendSDO(fId, idx, val, true); 105 121 } 106 122 107 123 void NodeDrv::SendSDO(WORD_t idx, LWORD_t val) 108 124 { 109 fNetwork->SendSDO(fId, idx, val );125 fNetwork->SendSDO(fId, idx, val, true); 110 126 } 111 127 112 void NodeDrv::RequestSDO(WORD_t idx, BYTE_t subidx =0)128 void NodeDrv::RequestSDO(WORD_t idx, BYTE_t subidx) 113 129 { 114 130 fNetwork->RequestSDO(fId, idx, subidx); -
trunk/MagicSoft/Cosy/candrv/nodedrv.h
r925 r926 13 13 BYTE_t fId; 14 14 15 char *fName; 16 15 17 int fError; 16 18 … … 21 23 22 24 public: 23 NodeDrv(BYTE_t nodeid, MLog &out=gLog); 25 NodeDrv(BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); 26 virtual ~NodeDrv(); 24 27 25 BYTE_t GetId() { return fId; } 26 Network *GetNetwork() { return fNetwork; } 28 BYTE_t GetId() const { return fId; } 29 char *GetNodeName() const { return fName; } 30 Network *GetNetwork() { return fNetwork; } 27 31 28 32 virtual void InitDevice(Network *net); … … 47 51 BYTE_t m4=0, BYTE_t m5=0, BYTE_t m6=0, BYTE_t m7=0); 48 52 49 void SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val );50 void SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val );51 void SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val );53 void SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val, bool store=true); 54 void SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val, bool store=true); 55 void SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, bool store=true); 52 56 53 57 void SendSDO(WORD_t idx, BYTE_t val); -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r925 r926 6 6 #include "timer.h" 7 7 #include "network.h" 8 9 Macs::Macs(BYTE_t nodeid, MLog &out) 10 : NodeDrv(nodeid, out), fMacId(2*nodeid+1), 8 #include "MLogManip.h" 9 10 Macs::Macs(const BYTE_t nodeid, const char *name, MLog &out) 11 : NodeDrv(nodeid, name, out), fMacId(2*nodeid+1), 11 12 fPos(0), fPosTime(0.0), fPdoPos(0), fPdoTime(0.0), 12 13 fPosActive(0), fRpmActive(0) … … 26 27 { 27 28 case 0x100a: 28 lout << "- Mac using Software Version V" << dec << (int)(val>>16) << "." << (int)(val&0xff) << endl;29 lout << "- " << GetNodeName() << ": Using Software Version V" << dec << (int)(val>>16) << "." << (int)(val&0xff) << endl; 29 30 return; 30 31 31 32 case 0x2002: 32 cout << "Actual velocity: " << dec << val << endl;33 cout << GetNodeName() << ": Actual velocity: " << dec << val << endl; 33 34 fVel = val; 34 35 return; … … 38 39 { 39 40 case 1: 40 cout << "Timeout timer is " << (val?"en":"dis") << "abled." << endl;41 cout << GetNodeName() << ": Timeout timer is " << (val?"en":"dis") << "abled." << endl; 41 42 return; 42 43 case 2: 43 cout << "Actual timeout time: " << dec << val << "ms" << endl;44 cout << GetNodeName() << ": Actual timeout time: " << dec << val << "ms" << endl; 44 45 return; 45 46 } … … 89 90 90 91 case 0x6002: 91 lout << "- Velocity resolution Node#" << (int)GetId() << ": " << dec << val << " ticks/min" << endl;92 lout << "- Velocity resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl; 92 93 fVelRes = val; 93 94 return; … … 97 98 } 98 99 99 void Macs::SetTimeoutTime(LWORD_t ms) 100 { 101 fTimeoutTime = ms/2; 102 103 SendSDO(0x4000, 2, ms); 104 WaitForSdo(0x4000, 2); 105 } 106 107 void Macs::ReqTimeoutTime() 108 { 109 RequestSDO(0x4000, 2); 110 WaitForSdo(0x4000, 2); 111 } 112 113 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 114 { 115 if (!enable) 116 { 117 SendSDO(0x4000, 1, string('o', 'f', 'f')); 118 WaitForSdo(0x4000, 1); 119 120 cout << "--> Turn Off. " << endl; 121 fTimerOn = kFALSE; 122 } 123 else 124 { 125 if (ms>0) 126 SetTimeoutTime(ms); 127 128 cout << "--> Turn On." << endl; 129 fTimerOn = kTRUE; 130 fTimeout->Start(fTimeoutTime, kTRUE); 131 132 SendSDO(0x4000, 1, string('o', 'n')); 133 WaitForSdo(0x4000, 1); 134 } 135 } 100 void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx) 101 { 102 if (idx==0x4000 && subidx==0 && fTimerOn) 103 { 104 ResetTimeout(); 105 return; 106 } 107 NodeDrv::HandleSDOOK(idx, subidx); 108 } 109 136 110 137 111 void Macs::ReqVelRes() 138 112 { 139 lout << "- Requesting velocity resolution (velres, 0x6002) of " << (int)GetId() << endl;113 lout << "- Requesting velocity resolution (velres, 0x6002) of " << GetNodeName() << endl; 140 114 RequestSDO(0x6002); 141 115 WaitForSdo(0x6002); … … 144 118 void Macs::SetPDO1On(BYTE_t flag) 145 119 { 146 lout << "- " << (flag?"Enable":"Disable") << " PDO1 of #" << (int)GetId() << endl;120 lout << "- " << (flag?"Enable":"Disable") << " PDO1 of " << GetNodeName() << endl; 147 121 SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 148 122 WaitForSdo(0x1800, 1); … … 171 145 EnableTimeout(kFALSE); 172 146 173 lout << "- Requesting Mac Software Version of " << (int)GetId() << endl;147 lout << "- Requesting Mac Software Version of " << GetNodeName() << endl; 174 148 RequestSDO(0x100a); 175 149 WaitForSdo(0x100a); … … 179 153 ReqVelRes(); // Init fVelRes 180 154 181 lout << "- Motor on of " << (int)GetId() << endl;155 lout << "- Motor on of " << GetNodeName() << endl; 182 156 SendSDO(0x3000, string('o', 'n')); 183 157 WaitForSdo(0x3000); … … 219 193 SetPDO1On(FALSE); 220 194 221 lout << "- Motor off of " << (int)GetId() << endl;195 lout << "- Motor off of " << GetNodeName() << endl; 222 196 SendSDO(0x3000, string('o', 'f', 'f')); 223 197 WaitForSdo(0x3000); … … 232 206 void Macs::ReqPos() 233 207 { 234 lout << "- Requesting Position of #" << (int)GetId() << endl;208 lout << "- Requesting Position of " << GetNodeName() << endl; 235 209 RequestSDO(0x6004); 236 210 WaitForSdo(0x6004); … … 239 213 void Macs::ReqVel() 240 214 { 241 lout << "- Requesting Velocity of #" << (int)GetId() << endl;215 lout << "- Requesting Velocity of " << GetNodeName() << endl; 242 216 RequestSDO(0x2002); 243 217 WaitForSdo(0x2002); … … 246 220 void Macs::SetHome(LWORDS_t pos, WORD_t maxtime) 247 221 { 248 lout << "- Driving #" << (int)GetId() << " to home position, Offset=" << dec << pos << endl;222 lout << "- Driving " << GetNodeName() << " to home position, Offset=" << dec << pos << endl; 249 223 SendSDO(0x6003, 2, (LWORD_t)pos); // home 250 224 WaitForSdo(0x6003, 2); … … 254 228 SendSDO(0x3001, string('h','o','m','e')); // home 255 229 WaitForSdo(0x3001, 0, maxtime*1000); 256 lout << "- Home position of #" << (int)GetId() << " reached. " << endl;230 lout << "- Home position of " << GetNodeName() << " reached. " << endl; 257 231 258 232 SendSDO(0x6003, 0, string('s','e','t')); // home … … 305 279 void Macs::SetNoWait(BYTE_t flag) 306 280 { 307 lout << "- Setting NOWAIT " << (flag?"ON ":"OFF") << " #" << (int)GetId() << endl;281 lout << "- Setting NOWAIT " << (flag?"ON ":"OFF ") << GetNodeName() << endl; 308 282 SendSDO(0x3008, flag ? string('o', 'n') : string('o', 'f', 'f')); 309 283 WaitForSdo(0x3008); … … 316 290 // or by a positioning command (POSA, ...) 317 291 // 318 lout << "- Setting Vel Sync Mode #" << (int)GetId() << endl;292 lout << "- Setting Vel Sync Mode of " << GetNodeName() << endl; 319 293 SendSDO(0x3007, 0, string('s', 'y', 'n', 'c')); 320 294 WaitForSdo(0x3007, 0); … … 327 301 // or by a positioning command (POSA, ...) 328 302 // 329 lout << "- Setting Pos Sync Mode #" << (int)GetId() << endl;303 lout << "- Setting Pos Sync Mode of " << GetNodeName() << endl; 330 304 SendSDO(0x3007, 1, string('s', 'y', 'n', 'c')); 331 305 WaitForSdo(0x3007, 1); … … 372 346 if (!errnum) 373 347 { 374 cout << "Mac #" << (int)GetId() << " reports Error occursion." << endl;348 cout << "Mac " << GetNodeName() << " reports Error occursion." << endl; 375 349 SetError(-1); 376 350 return; … … 382 356 // 383 357 if (GetError()>0) 384 cout << "Mac #" << (int)GetId() << " WARNING! Error #" << GetError() << " unhandled by software." << endl;358 cout << "Mac " << GetNodeName() << " WARNING! Error #" << GetError() << " unhandled by software." << endl; 385 359 386 360 SetError(errnum); 387 361 388 cout << "Mac #" << (int)GetId() << " reports: ";362 cout << "Mac " << GetNodeName() << " reports: "; 389 363 switch (errnum) 390 364 { … … 429 403 return; 430 404 405 case 100: 406 cout << "Connection timed out." << endl; 407 return; 408 431 409 default: 432 410 cout << "Error Nr. " << errnum << ", " << errinf << endl; … … 456 434 // we can go on working 'as usual' Eg. Initialize a Display Update 457 435 // 458 cout << "Mac #" << (int)GetId() << " Handling Error #" << GetError() << endl;436 cout << "Mac " << GetNodeName() << " Handling Error #" << GetError() << endl; 459 437 switch (GetError()) 460 438 { … … 463 441 case 9: // zero idx 464 442 case 84: // ON TIME 465 case 100: // timeout466 443 // Stop program? 467 444 return; 468 445 469 case 11: // software endswitch 470 case 25: // hardware endswitch 446 case 11: // software endswitch 447 case 25: // hardware endswitch 448 case 100: // timeout (movement has been stopped, so we can go on) 449 DelError(); 450 return; 451 452 case 101: 453 lout << "Warning: " << GetNodeName() << " didn't respond in timeout window - try again." << endl; 471 454 DelError(); 472 455 return; … … 513 496 SendSDO(0x2000, 3, (LWORD_t)(neg|(pos<<1))); 514 497 WaitForSdo(0x2000, 3); 498 } 499 500 void Macs::ReqTimeoutTime() 501 { 502 RequestSDO(0x4000, 2); 503 WaitForSdo(0x4000, 2); 504 } 505 506 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 507 { 508 if (!enable) 509 { 510 SendSDO(0x4000, 1, string('o', 'f', 'f')); 511 WaitForSdo(0x4000, 1); 512 513 fTimeout->Stop(); //kTRUE); 514 515 fTimerOn = kFALSE; 516 } 517 else 518 { 519 if (ms>0) 520 SetTimeoutTime(ms); 521 522 ResetTimeout(); 523 524 fTimerOn = kTRUE; 525 fTimeout->Start(fGuardTime, kFALSE); //kTRUE); 526 527 SendSDO(0x4000, 1, string('o', 'n')); 528 WaitForSdo(0x4000, 1); 529 } 530 lout << "- Timeout timer of " << GetNodeName() << " turned " 531 << (enable?"on.":"off.") << endl; 515 532 } 516 533 … … 542 559 time. 543 560 */ 544 SendSDO(0x4000); 545 WaitForSdo(0x4000, 0, kDontWait); 546 if (fTimerOn) 547 fTimeout->Start(fTimeoutTime, kTRUE); 561 562 // 563 // FIXME! Use NMT! 564 // 565 SendSDO(0x4000, 0, (LWORD_t)0, false); 566 567 Timer time; 568 if (time.Now() > fTimeoutTime) 569 { 570 lout << ddev(MLog::eGui); 571 lout << "Warning: " << GetNodeName() << " didn't respond in timeout window." << endl; 572 lout << edev(MLog::eGui); 573 SetError(101); 574 } 575 576 577 //WaitForSdo(0x4000, 0, kDontWait); 578 // if (fTimerOn) 579 // fTimeout->Start(fGuardTime, kTRUE); 580 548 581 return kTRUE; 549 582 } 583 584 void Macs::ResetTimeout() 585 { 586 Timer time; 587 fTimeoutTime = time.Now() + 2.*fGuardTime/1000.; //[usec] 588 } 589 590 void Macs::SetTimeoutTime(LWORD_t ms) 591 { 592 fGuardTime = ms/2; // FIXME: Is '/2' the best choose? 593 594 SendSDO(0x4000, 2, ms); 595 WaitForSdo(0x4000, 2); 596 } 597 -
trunk/MagicSoft/Cosy/devdrv/macs.h
r925 r926 26 26 TTimer *fTimeout; 27 27 Bool_t fTimerOn; 28 LWORD_t fTimeoutTime; 28 LWORD_t fGuardTime; 29 double fTimeoutTime; 29 30 30 31 LWORD_t string(BYTE_t b0=0, BYTE_t b1=0, BYTE_t b2=0, BYTE_t b3=0) … … 33 34 } 34 35 36 void ResetTimeout(); 35 37 Bool_t HandleTimer(TTimer *t); 36 38 37 39 public: 38 Macs( BYTE_t nodeid, MLog &out=gLog);40 Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); 39 41 virtual ~Macs(); 40 42 … … 45 47 46 48 void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, struct timeval *tv); 47 void HandleSDOOK(WORD_t idx, BYTE_t subidx) { NodeDrv::HandleSDOOK(idx, subidx); }49 void HandleSDOOK(WORD_t idx, BYTE_t subidx); 48 50 void HandleSDOError(LWORD_t data) { NodeDrv::HandleSDOError(data); } 49 51 -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r921 r926 13 13 #include <sys/resource.h> // PRIO_PROCESS 14 14 15 ShaftEncoder::ShaftEncoder(BYTE_t nodeid, MLog &out) : NodeDrv(nodeid, out), fLabel(NULL), fPosHasChanged(false) 15 ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name, MLog &out) 16 : NodeDrv(nodeid, name, out), fLabel(NULL), fPosHasChanged(false) 16 17 { 17 18 } … … 195 196 // Requesting and checking (FIXME) type of encoder 196 197 // 197 lout << "- Requesting Hardware Type (SDO 0x1000) of " << (int)GetId() << endl;198 lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName() << endl; 198 199 RequestSDO(0x1000); 199 200 WaitForSdo(0x1000); … … 202 203 // Read physical ticks per revolution 203 204 // 204 lout << "- Requesting physical ticks/revolution (SDO 0x6501) of " << (int)GetId() << endl;205 lout << "- Requesting physical ticks/revolution (SDO 0x6501) of " << GetNodeName() << endl; 205 206 RequestSDO(0x6501); 206 207 WaitForSdo(0x6501); … … 209 210 // Read number of possible ticks per revolution 210 211 // 211 lout << "- Requesting possible ticks/revolution (SDO 0x6502) of " << (int)GetId() << endl;212 lout << "- Requesting possible ticks/revolution (SDO 0x6502) of " << GetNodeName() << endl; 212 213 RequestSDO(0x6502); 213 214 WaitForSdo(0x6502); … … 216 217 // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1 217 218 // 218 lout << "- Configuring SDO 0x6001 of " << (int)GetId() << endl;219 lout << "- Configuring SDO 0x6001 of " << GetNodeName() << endl; 219 220 SendSDO(0x6001, fTicks); 220 221 WaitForSdo(0x6001); … … 223 224 // Set maximum number of ticks (ticks * turns) 224 225 // 225 lout << "- Configuring SDO 0x6002 of " << (int)GetId() << endl;226 lout << "- Configuring SDO 0x6002 of " << GetNodeName() << endl; 226 227 SendSDO(0x6002, (LWORD_t)(fTicks*fTurns)); 227 228 WaitForSdo(0x6002); … … 230 231 // Configure PDOs 231 232 // 232 lout << "- Configuring SDO 0x1802 of " << (int)GetId() << endl;233 lout << "- Configuring SDO 0x1802 of " << GetNodeName() << endl; 233 234 SendSDO(0x1802, 1, (LWORD_t)0x281); 234 235 WaitForSdo(0x1802, 1); … … 237 238 // Delete preset Value 238 239 // 239 lout << "- Configuring SDO 0x6003 of " << (int)GetId() << endl;240 lout << "- Configuring SDO 0x6003 of " << GetNodeName() << endl; 240 241 SendSDO(0x6003, (LWORD_t)0xffffffff); 241 242 WaitForSdo(0x6003); … … 244 245 // Request Parameter 245 246 // 246 lout << "- Requesting SDO 0x6000 of " << (int)GetId() << endl;247 lout << "- Requesting SDO 0x6000 of " << GetNodeName() << endl; 247 248 RequestSDO(0x6000); 248 249 WaitForSdo(0x6000); … … 250 251 ReqPos(); 251 252 252 lout << "- Start Node " << (int)GetId() << endl;253 lout << "- Start Node " << GetNodeName() << endl; 253 254 SendNMT(kNMT_START); 254 255 } … … 259 260 // Request Position 260 261 // 261 lout << "- Requesting Position of #" << (int)GetId() << endl;262 lout << "- Requesting Position of " << GetNodeName() << endl; 262 263 RequestSDO(0x6004); 263 264 WaitForSdo(0x6004); … … 269 270 fTurn = pre/16384; 270 271 271 lout << " - Setting Preset #" << (int)GetId() << endl;272 lout << " - Setting Preset " << GetNodeName() << endl; 272 273 SendSDO(0x6003, (LWORD_t)fPos); 273 274 WaitForSdo(0x6003); … … 276 277 void ShaftEncoder::StopDevice() 277 278 { 278 lout << "- Start Node " << (int)GetId() << endl;279 lout << "- Start Node " << GetNodeName() << endl; 279 280 SendNMT(kNMT_STOP); 280 281 } -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.h
r924 r926 33 33 34 34 public: 35 ShaftEncoder( BYTE_t nodeid, MLog &out=gLog);35 ShaftEncoder(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); 36 36 virtual ~ShaftEncoder(); 37 37 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r921 r926 437 437 438 438 // TGMainFrame::CloseWindow(); 439 cout << "Closing window - waiting until all nodes are stopped." << endl; 439 440 fQueue->PostMsg(WM_QUIT, 0, 0); 440 441 // gApplication->Terminate(0); -
trunk/MagicSoft/Cosy/main/MCosy.cc
r925 r926 125 125 ZdAz MCosy::GetSePos() 126 126 { 127 const int p0 = f Alt1->GetPos();128 const int p1 = f Alt2->GetPos();127 const int p0 = fZd1->GetPos(); 128 const int p1 = fZd2->GetPos(); 129 129 const int p2 = fAz->GetPos(); 130 130 … … 362 362 else 363 363 if (fabs(vt->Az()) > 0.9*vraz) 364 { 365 lout << "Warning: Azimuth speed limit exceeded. Limiting speed to 90% max." << endl; 364 366 vt->Az(0.9*vraz*sgn(vt->Az())); 367 } 365 368 366 369 if (sgn(vt->Zd()) != sgn(vcalc.Zd()) && … … 369 372 else 370 373 if (fabs(vt->Zd()) > 0.9*vrzd) 374 { 375 lout << "Warning: Altitude speed limit exceeded. Limiting speed to 90% max." << endl; 371 376 vt->Zd(0.9*vrzd*sgn(vt->Zd())); 377 } 372 378 } 373 379 … … 568 574 case WM_PRESET: 569 575 cout << "WM_Preset: start." << endl; 570 f Alt1->SetPreset();571 f Alt2->SetPreset();576 fZd1->SetPreset(); 577 fZd2->SetPreset(); 572 578 fAz->SetPreset(); 573 579 cout << "WM_Preset: done. (return 0xaffe)" << endl; … … 588 594 cout << "Got Zd: " << sepos.Zd() << " Az: " << sepos.Az() << endl; 589 595 590 f Alt1->SetPreset(za.Zd());591 f Alt2->SetPreset(-za.Zd());596 fZd1->SetPreset(za.Zd()); 597 fZd2->SetPreset(-za.Zd()); 592 598 fAz->SetPreset(za.Az()); 593 599 … … 759 765 do 760 766 { 761 phca1 = f Alt1->PosHasChanged();762 phca2 = f Alt2->PosHasChanged();767 phca1 = fZd1->PosHasChanged(); 768 phca2 = fZd2->PosHasChanged(); 763 769 phcaz = fAz->PosHasChanged(); 764 770 usleep(1); … … 786 792 // FIXME: I cannot take the avarage 787 793 // 788 time.Zd((f Alt1->GetMjd()+fAlt2->GetMjd())/2.0);794 time.Zd((fZd1->GetMjd()+fZd2->GetMjd())/2.0); 789 795 time.Az(fAz->GetMjd()); 790 796 … … 823 829 // Update Gui, foremer MTGui. 824 830 // 825 f Alt1->DisplayVal();826 f Alt2->DisplayVal();831 fZd1->DisplayVal(); 832 fZd2->DisplayVal(); 827 833 fAz->DisplayVal(); 828 834 … … 874 880 // Create Nodes 875 881 // 876 fMac1=new Macs(1, lout); 877 fMac2=new Macs(2, lout); 878 fMac3=new Macs(3, lout); 879 fAlt1=new ShaftEncoder(4, lout); 880 fAlt2=new ShaftEncoder(5, lout); 881 fAz =new ShaftEncoder(6, lout); 882 fMac1=new Macs(1, "Mac.1/Az", lout); 883 fMac2=new Macs(2, "Mac.2/Zd", lout); 884 fMac3=new Macs(3, "Mac.3/Az-Sync", lout); 885 886 fZd1=new ShaftEncoder(4, "SE.4/Zd1", lout); 887 fZd2=new ShaftEncoder(5, "SE.5/Zd2", lout); 888 fAz =new ShaftEncoder(6, "SE.6/Az", lout); 882 889 883 890 // … … 887 894 SetNode(fMac2); 888 895 SetNode(fMac3); 889 SetNode(f Alt1);890 SetNode(f Alt2);896 SetNode(fZd1); 897 SetNode(fZd2); 891 898 SetNode(fAz); 892 899 … … 899 906 900 907 fAz->SetDisplay(fWin->GetLabel1()); 901 f Alt1->SetDisplay(fWin->GetLabel2());902 f Alt2->SetDisplay(fWin->GetLabel3());908 fZd1->SetDisplay(fWin->GetLabel2()); 909 fZd2->SetDisplay(fWin->GetLabel3()); 903 910 904 911 lout.SetOutputGui(fWin->GetLog(), kTRUE); … … 930 937 931 938 delete fAz; 932 delete f Alt2;933 delete f Alt1;939 delete fZd2; 940 delete fZd1; 934 941 delete fMac1; 935 942 delete fMac2; -
trunk/MagicSoft/Cosy/main/MCosy.h
r924 r926 50 50 51 51 private: 52 ShaftEncoder *f Alt1;53 ShaftEncoder *f Alt2;52 ShaftEncoder *fZd1; 53 ShaftEncoder *fZd2; 54 54 ShaftEncoder *fAz; 55 55
Note:
See TracChangeset
for help on using the changeset viewer.