- Timestamp:
- 01/13/03 18:18:15 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r1701 r1702 1 1 -*-*- END -*-*- 2 3 2003/01/13 - Thomas Bretz: 4 5 * bending.txt: 6 - changed to fit the parameters of the model 7 8 * cosy.cc: 9 - made the 'standard mode' the default 10 11 * base/MTimeout.h: 12 - fixed the change of the base member function name of Notify 13 14 * candrv/network.[h,cc]: 15 - don't set fNodes[i] to NULL if Node is Zombie 16 - implemented HasZombie and RebootZomies 17 18 * candrv/nodedrv.[h,cc]: 19 - implemented a base function Reboot 20 - set node to Zombie status if waitforsdo timed out 21 22 * candrv/vmodican.cc: 23 - added more precise output for CTXcon 24 25 * devdrv/macs.[h,cc]: 26 - if first waitforsdo fails set don't go on 27 - implemented fStatus 28 - implemented enum for fStatus 29 30 * gui/MGAccuracy.cc, gui/MGSkyPosition.cc, gui/MGVelocity.cc: 31 - call SetNoContextMenu in constructor 32 33 * gui/MGCosy.[h,cc]: 34 - some new labels 35 - implemented SetLabelColor 36 37 * gui/MGEmbeddedCanvas.[h,cc]: 38 - implemented SetNoContextMenu 39 40 * main/MCosy.cc: 41 - exchanged all conditionals for the pointers to the nodes 42 by IsZombieNode 43 - implemented check for zombies in Proc 44 45 46 2 47 2003/01/10 - Thomas Bretz: 3 48 -
trunk/MagicSoft/Cosy/base/MTimeout.h
r925 r1702 6 6 class MTimeout : public TTimer 7 7 { 8 Bool_t Notify( TTimer *t)8 Bool_t Notify() 9 9 { 10 10 TurnOff(); // remove from system list -
trunk/MagicSoft/Cosy/bending.txt
r1699 r1702 1 1 MMT 1987 July 8 2 2 S 36 7.3622 41.448 -0.0481 3 IA 136.6 -1 4 IE -45.5 -1 5 END 3 IA 157 -1 4 IE -35 -1 END -
trunk/MagicSoft/Cosy/candrv/network.cc
r1701 r1702 240 240 if (!fNodes[i]->IsZombieNode()) 241 241 fNodeInitialized[i] = TRUE; 242 else243 fNodes[i]=NULL; 242 /*else 243 fNodes[i]=NULL;*/ 244 244 } 245 245 lout << "- All Nodes setup." << endl; … … 288 288 return rc; 289 289 } 290 291 // -------------------------------------------------------------------------- 292 // 293 // returns true if one of the nodes is a zombie node 294 // 295 bool Network::HasZombie() const 296 { 297 for (int i=0; i<32; i++) 298 if (fNodes[i]) 299 if (fNodes[i]->IsZombieNode()) 300 return true; 301 302 return false; 303 } 304 305 // -------------------------------------------------------------------------- 306 // 307 // try to reboot all zombie nodes to get them working again. all other 308 // nodes are left untouched. 309 // 310 bool Network::RebootZombies() 311 { 312 lout << "- Trying to reboot all Zombies..." << endl; 313 for (int i=0; i<32; i++) 314 if (fNodes[i]) 315 if (fNodes[i]->IsZombieNode()) 316 if (!fNodes[i]->Reboot()) 317 { 318 lout << "- Failed to reboot " << fNodes[i]->GetNodeName() << "." << endl; 319 return false; 320 } 321 322 lout << "- All Zombies rebooted." << endl; 323 324 return true; 325 } -
trunk/MagicSoft/Cosy/candrv/network.h
r1140 r1702 32 32 33 33 bool HasError() const; 34 bool HasZombie() const; 35 36 bool RebootZombies(); 34 37 35 38 ClassDef(Network, 0) // collection of nodes (nodedrv) -
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r1690 r1702 87 87 // -------------------------------------------------------------------------- 88 88 // 89 // This should be called from a master or main thread to get a node out 90 // of the Zombie-Status. Overload it by your needs. 91 // 92 bool NodeDrv::Reboot() 93 { 94 fIsZombie = false; 95 return true; 96 } 97 98 // -------------------------------------------------------------------------- 99 // 89 100 // Init device, sets the pointer to the whole network and enables 90 101 // the Can messages to be passed through the interface: … … 315 326 bool NodeDrv::WaitForSdo(WORD_t idx, BYTE_t subidx, WORDS_t timeout) 316 327 { 317 return fNetwork->WaitForSdo(fId, idx, subidx, timeout); 328 bool rc = fNetwork->WaitForSdo(fId, idx, subidx, timeout); 329 330 if (!rc) 331 fIsZombie = kTRUE; 332 333 return rc; 318 334 } 319 335 -
trunk/MagicSoft/Cosy/candrv/nodedrv.h
r1690 r1702 34 34 void DelError() { fError = 0; } 35 35 36 Bool_t fIsZombie; 36 Bool_t fIsZombie; // A Zombie node is a node which doesn't answer... 37 37 38 38 public: … … 60 60 virtual void HandlePDO3(BYTE_t *data, timeval_t *tv) {}; 61 61 virtual void HandlePDO4(BYTE_t *data, timeval_t *tv) {}; 62 63 virtual bool Reboot(); 62 64 63 65 void SendPDO1(BYTE_t data[8]); -
trunk/MagicSoft/Cosy/candrv/vmodican.cc
r1699 r1702 202 202 const WORD_t cobid = desc>>5; 203 203 204 switch (msg->cmd) 204 switch (msg->cmd) // FROM mican.h 205 205 { 206 206 case M_MSG_LOST: … … 208 208 return; 209 209 210 case M_BCAN_TX_con: /* confirm (+/-) transmission */ 211 cout << "VmodIcan reports: CTXcon=0x35" << endl; 212 cout << "This normally means, that the transmission of the following CAN frame failed:" << hex << endl; 213 cout << "Descr: 0x" << cobid << dec; 214 cout << " Rtr: " << (rtr?"Yes":"No"); 215 cout << " Len: " << (int)len << endl; 216 return; 217 210 218 case M_BCAN_EVENT_ind: 211 cout << "VmodIcan reports: CEVTind=0x37 ," << hex;219 cout << "VmodIcan reports: CEVTind=0x37: " << hex; 212 220 switch (msg->data[0]) // error indicator 213 221 { -
trunk/MagicSoft/Cosy/cosy.cc
r1531 r1702 50 50 // check for the right usage of the program 51 51 // 52 int mode = 2;52 int mode = 0; 53 53 if (argc==2 && (argv[1][0]=='-' || argv[1][1]=='m')) 54 54 switch (argv[1][2]) … … 59 59 case '1': // SE mode 60 60 mode = 1; 61 break; 62 case '2': // GUI demo mode 63 mode = 2; 61 64 break; 62 65 } -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1701 r1702 243 243 WaitForSdo(0x2004); 244 244 */ 245 EnableTimeout(kFALSE);246 247 245 lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl; 248 246 RequestSDO(0x100a); 249 247 WaitForSdo(0x100a); 250 248 249 if (IsZombie()) 250 return; 251 252 EnableTimeout(kFALSE); 251 253 SetRpmMode(FALSE); 252 254 … … 437 439 fPdoPos = (data[4]<<24) | (data[5]<<16) | (data[6]<<8) | data[7]; 438 440 439 fPosActive = data[3]&0x02; 440 fRpmActive = data[3]&0x04; 441 // data[3]&0x01; // motor not moving 442 fPosActive = data[3]&kPosActive; // positioning active 443 fRpmActive = data[3]&kRpmActive; // RPM mode switched on 444 // data[3]&0x08; // - unused - 445 // data[3]&0x10; // - unused - 446 // data[3]&0x20; // - unused - 447 fInControl = data[3]&0x40; // motor uncontrolled 448 // data[3]&0x80; // axis resetted (after errclr, motor stop, motor on) 449 450 fStatus = data[3]; 441 451 442 452 fPdoTime.SetTimer(tv); … … 450 460 // 451 461 // errnum==0 gives a sudden information that something happened. Now the 452 // microcontroller is running inside its interrup procedure which462 // microcontroller is running inside its interrupt procedure which 453 463 // stopped the normal program. The interrupt procedure should try to clear 454 464 // the error state of the hardware. This should never create a new error! -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1701 r1702 25 25 BYTE_t fPosActive; 26 26 BYTE_t fRpmActive; 27 BYTE_t fInControl; 28 BYTE_t fStatus; 27 29 28 30 TTimer *fTimeout; … … 40 42 41 43 public: 44 enum 45 { 46 kNotMoving = BIT(0), // motor not moving 47 kPosActive = BIT(1), // positioning active 48 kRpmActive = BIT(2), // RPM mode switched on 49 // BIT(3-5) unsused 50 kOutOfControl = BIT(6), // motor uncontrolled 51 kAxisReset = BIT(7) // axis resetted (after errclr, motor stop, motor on) 52 }; 53 42 54 Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); 43 55 virtual ~Macs(); … … 90 102 void StopMotor(); 91 103 92 int IsPositioning() { return fPosActive; } 104 int IsPositioning() const { return fPosActive; } 105 BYTE_t GetStatus() const { return fStatus; } 93 106 94 107 double GetTime(); … … 98 111 double GetPdoMjd(); 99 112 100 LWORDS_t GetPdoPos() { return fPdoPos; }113 LWORDS_t GetPdoPos() const { return fPdoPos; } 101 114 102 LWORDS_t GetPos() { return fPos; }103 LWORDS_t GetVel() { return fVel; }104 LWORD_t GetVelRes() { return fVelRes; } // Velocity units (would be 100 for %)105 LWORD_t GetRes() { return fRes; } // Encoder resolution115 LWORDS_t GetPos() const { return fPos; } 116 LWORDS_t GetVel() const { return fVel; } 117 LWORD_t GetVelRes() const { return fVelRes; } // Velocity units (would be 100 for %) 118 LWORD_t GetRes() const { return fRes; } // Encoder resolution 106 119 107 120 void HandleError(); -
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r1701 r1702 178 178 179 179 InitCanvas(); 180 181 SetNoContextMenu(); 180 182 } 181 183 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1701 r1702 238 238 fList->Add(fAzSoll); 239 239 240 241 fError = new TGLabel(f, "Error"); 242 fMoving = new TGLabel(f, "Moving"); 243 fTracking = new TGLabel(f, "Tracking"); 244 fStopping = new TGLabel(f, "Stopping"); 245 fStopped = new TGLabel(f, "Stopped"); 246 240 fError = new TGLabel(f, "Error"); 241 fMoving = new TGLabel(f, "Moving"); 242 fTracking = new TGLabel(f, "Tracking"); 243 fStopping = new TGLabel(f, "Stopping"); 244 fStopped = new TGLabel(f, "Stopped"); 245 fAvailMac1 = new TGLabel(f, "- MAC1 -"); 246 fAvailMac2 = new TGLabel(f, "- MAC2 -"); 247 fAvailMac3 = new TGLabel(f, "- MAC3 -"); 248 fAvailSe1 = new TGLabel(f, "-SE/Zd1-"); 249 fAvailSe2 = new TGLabel(f, "-SE/Zd2-"); 250 fAvailSe3 = new TGLabel(f, "- SE/Az -"); 247 251 248 252 ULong_t color; … … 250 254 gClient->GetColorByName("Red", color); 251 255 fError->SetBackgroundColor(color); 256 fAvailMac1->SetBackgroundColor(color); 257 fAvailMac2->SetBackgroundColor(color); 258 fAvailMac3->SetBackgroundColor(color); 259 fAvailSe1->SetBackgroundColor(color); 260 fAvailSe2->SetBackgroundColor(color); 261 fAvailSe3->SetBackgroundColor(color); 252 262 gClient->GetColorByName("LightBlue", color); 253 263 fMoving->SetBackgroundColor(color); … … 264 274 fStopping->Move(10, 25+60); 265 275 fStopped ->Move(10, 25+80); 276 fAvailMac1->Move(10, 25+120); 277 fAvailMac2->Move(10, 25+140); 278 fAvailMac3->Move(10, 25+160); 279 fAvailSe1->Move(10, 25+180); 280 fAvailSe2->Move(10, 25+200); 281 fAvailSe3->Move(10, 25+220); 266 282 267 283 fError ->Resize(60, 20); … … 270 286 fStopping->Resize(60, 20); 271 287 fStopped ->Resize(60, 20); 288 fAvailMac1->Resize(60, 20); 289 fAvailMac2->Resize(60, 20); 290 fAvailMac3->Resize(60, 20); 291 fAvailSe1->Resize(60, 20); 292 fAvailSe2->Resize(60, 20); 293 fAvailSe3->Resize(60, 20); 272 294 273 295 fList->Add(fError); … … 276 298 fList->Add(fStopping); 277 299 fList->Add(fStopped); 300 fList->Add(fAvailMac1); 301 fList->Add(fAvailMac2); 302 fList->Add(fAvailMac3); 303 fList->Add(fAvailSe1); 304 fList->Add(fAvailSe2); 305 fList->Add(fAvailSe3); 278 306 } 279 307 … … 679 707 cout << "MGCosy::~MGCosy done." << endl; 680 708 } 709 710 void MGCosy::SetLabelColor(TGLabel *label, Bool_t col) 711 { 712 ULong_t red, green; 713 714 gClient->GetColorByName("Red", red); 715 gClient->GetColorByName("Green", green); 716 717 if (col && label->TestBit(BIT(14))) 718 return; 719 720 if (!col && !label->TestBit(BIT(14))) 721 return; 722 723 col ? label->SetBit(BIT(14)) : label->ResetBit(BIT(14)); 724 725 label->UnmapWindow(); 726 label->SetBackgroundColor(col ? green : red); 727 label->MapWindow(); 728 } 729 681 730 // ====================================================================== 682 731 void MGCosy::EnableLabel(TGLabel *label, Bool_t stat) … … 823 872 824 873 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, 825 ZdAz soll, UInt_t stat )874 ZdAz soll, UInt_t stat, UInt_t stat2) 826 875 { 827 876 double mjd = UpdateTime(); … … 848 897 EnableLabel(fZdSoll, stat&kMoving); 849 898 EnableLabel(fAzSoll, stat&kMoving); 899 900 SetLabelColor(fAvailMac1, stat2&0x01); 901 SetLabelColor(fAvailMac2, stat2&0x02); 902 SetLabelColor(fAvailMac3, stat2&0x04); 903 SetLabelColor(fAvailSe1, stat2&0x08); 904 SetLabelColor(fAvailSe2, stat2&0x10); 905 SetLabelColor(fAvailSe3, stat2&0x20); 850 906 851 907 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow(); -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r1701 r1702 77 77 TGLabel *fStopping; 78 78 TGLabel *fStopped; 79 TGLabel *fAvailMac1; 80 TGLabel *fAvailMac2; 81 TGLabel *fAvailMac3; 82 TGLabel *fAvailSe1; 83 TGLabel *fAvailSe2; 84 TGLabel *fAvailSe3; 79 85 80 86 TGListBox *fLog; … … 91 97 92 98 void EnableLabel(TGLabel *label, Bool_t stat); 99 void SetLabelColor(TGLabel *label, Bool_t col); 93 100 void UpdateOffset(ZdAz &off); 94 101 void UpdateZdAz(ZdAz &off); … … 108 115 TGListBox *GetLog() const { return fLog; } 109 116 110 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, ZdAz soll, UInt_t stat );117 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, ZdAz soll, UInt_t stat, UInt_t stat2); 111 118 112 119 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r1690 r1702 52 52 } 53 53 54 // ------------------------------------------------------------------------ 55 // 56 // Map the subwindows, resize to its quadratic size, map the window itself 57 // and set it to Non-Editable. 58 // 54 59 void MGEmbeddedCanvas::InitCanvas() 55 60 { … … 71 76 // X11 Pixmap error) Update hangs the Gui system. 72 77 // 73 // Fixed: Using root 3.01/06 and doing the update from within the78 // Fixed: By using root 3.01/06 and doing the update from within the 74 79 // mainthread. 75 80 // … … 80 85 fModified = kFALSE; 81 86 } 87 88 // ------------------------------------------------------------------------ 89 // 90 // Set's the kNoContextMenu bit for all primitives in the embedded canvas 91 // and the canvas itself, so that no context menu is displayed. 92 // 93 void MGEmbeddedCanvas::SetNoContextMenu() 94 { 95 TList &list = *fCanvas->GetListOfPrimitives(); 96 list.ForEach(TObject, SetBit)(kNoContextMenu); 97 98 fCanvas->SetBit(kNoContextMenu); 99 } -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h
r1111 r1702 41 41 void SetModified() { fModified = kTRUE; } 42 42 43 void SetNoContextMenu(); 44 43 45 ClassDef(MGEmbeddedCanvas, 0) 44 46 }; -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r1690 r1702 177 177 InitText(); 178 178 InitCanvas(); 179 SetNoContextMenu(); 179 180 } 180 181 -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r1701 r1702 188 188 189 189 InitCanvas(); 190 191 SetNoContextMenu(); 190 192 } 191 193 -
trunk/MagicSoft/Cosy/main/MCosy.cc
r1701 r1702 150 150 // Get the values 151 151 // 152 const int p0 = fZd1? fZd1->GetPos() : 0;153 const int p1 = fZd2? fZd2->GetPos() : 0;154 const int p2 = fAz? fAz->GetPos() : 0;152 const int p0 = !fZd1->IsZombieNode() ? fZd1->GetPos() : 0; 153 const int p1 = !fZd2->IsZombieNode() ? fZd2->GetPos() : 0; 154 const int p2 = !fAz->IsZombieNode() ? fAz->GetPos() : 0; 155 155 156 156 const int a0 = p0; //p0>8192?p0-16384:p0; … … 177 177 Bool_t MCosy::RequestRePos() 178 178 { 179 if ( !(fMac1 && fMac2))179 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 180 180 return kTRUE; 181 181 … … 192 192 193 193 // 194 // If wait ng was not interrupted everything is ok. return.194 // If waiting was not interrupted everything is ok. return. 195 195 // 196 196 if (!StopWaitingForSDO()) … … 216 216 ZdAz MCosy::GetRePos() 217 217 { 218 return fMac1 && fMac2? ZdAz(fMac2->GetPos(), fMac1->GetPos()) : ZdAz(0,0);218 return !fMac1->IsZombieNode() && !fMac2->IsZombieNode() ? ZdAz(fMac2->GetPos(), fMac1->GetPos()) : ZdAz(0,0); 219 219 } 220 220 … … 304 304 int MCosy::StopWaitingForSDO() const 305 305 { 306 return Break() || HasError() ;306 return Break() || HasError() || HasZombie(); 307 307 } 308 308 … … 346 346 347 347 // 348 // No try to handle the error.348 // Now try to handle the error. 349 349 // 350 350 fMac1->HandleError(); … … 378 378 // FIXME: Correct by fOffset ? 379 379 380 if ( !(fMac1 && fMac2))380 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 381 381 { 382 cout << "SetPosition: No MACS!" << endl;382 cout << "SetPosition: No connection to at least one of the MACS!" << endl; 383 383 return TRUE; 384 384 } … … 515 515 void MCosy::InitTracking() 516 516 { 517 if ( !(fMac1 && fMac2))517 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 518 518 return; 519 519 … … 656 656 fRaDec = dst; 657 657 658 if ( !(fMac1 && fMac2))658 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 659 659 return; 660 660 … … 774 774 void MCosy::StopMovement() 775 775 { 776 if ( !fMac1 || !fMac2)776 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 777 777 return; 778 778 779 // 779 780 // Set status to Stopping … … 810 811 void *MCosy::Proc(int msg, void *mp) 811 812 { 813 lout << "Checking for Zombies" << endl; 814 if (HasZombie()) 815 { 816 lout << "Found Zombies" << endl; 817 if (!RebootZombies()) 818 return (void*)0xebb0; 819 } 820 812 821 switch (msg) 813 822 { … … 823 832 case WM_PRESET: 824 833 cout << "WM_Preset: start." << endl; 825 if ( fZd1) fZd1->SetPreset();826 if ( fZd2) fZd2->SetPreset();827 if ( fAz) fAz->SetPreset();834 if (!fZd1->IsZombieNode()) fZd1->SetPreset(); 835 if (!fZd2->IsZombieNode()) fZd2->SetPreset(); 836 if (!fAz->IsZombieNode()) fAz->SetPreset(); 828 837 cout << "WM_Preset: done. (return 0xaffe)" << endl; 829 838 return (void*)0xaffe; … … 849 858 cout << "Got Zd: " << sepos.Zd() << " Az: " << sepos.Az() << endl; 850 859 851 if ( fZd1)860 if (!fZd1->IsZombieNode()) 852 861 fZd1->SetPreset(za.Zd()); 853 if (fZd2)862 if (!fZd2->IsZombieNode()) 854 863 fZd2->SetPreset(-za.Zd()); 855 if (fAz)864 if (!fAz->IsZombieNode()) 856 865 fAz->SetPreset(za.Az()); 857 866 … … 924 933 case WM_HOME: 925 934 cout << "WM_Home: START" << endl; 926 if ( fMac1 && fMac2)935 if (!fMac1->IsZombieNode() && !fMac2->IsZombieNode()) 927 936 { 928 937 cout << "Going Home..." << endl; 929 fMac1->SetHome(250000, 100); 930 fMac2->SetHome(250000, 100); 938 TEnv env(".cosyrc"); 939 fMac1->SetHome(250000, env.GetValue("Az_MaxTime2ReachHome[s]", 100)); 940 fMac2->SetHome(250000, env.GetValue("Zd_MaxTime2ReachHome[s]", 100)); 931 941 932 942 fAz->SetPreset(); … … 991 1001 992 1002 Double_t resreaz = 0; 993 if ( fMac1)1003 if (!fMac1->IsZombieNode()) 994 1004 resreaz = fMac1->GetRes(); 995 1005 else 996 if ( fMac3)1006 if (!fMac3->IsZombieNode()) 997 1007 resreaz = fMac3->GetRes(); 998 1008 else … … 1000 1010 1001 1011 Double_t resrezd = 0; 1002 if ( fMac2)1012 if (!fMac2->IsZombieNode()) 1003 1013 resrezd = fMac2->GetRes(); 1004 1014 else … … 1006 1016 1007 1017 Double_t ressezd = 0; 1008 if ( fZd1)1018 if (!fZd1->IsZombieNode()) 1009 1019 ressezd = fZd1->GetPhysRes(); 1010 1020 else 1011 if ( fZd2)1021 if (!fZd2->IsZombieNode()) 1012 1022 ressezd = fZd2->GetPhysRes(); 1013 1023 else … … 1015 1025 1016 1026 Double_t resseaz = 0; 1017 if ( fAz)1027 if (!fAz->IsZombieNode()) 1018 1028 resseaz = fAz->GetPhysRes(); 1019 1029 else … … 1024 1034 cout << "done." << endl; 1025 1035 1026 cout << " Setting Gear Ratios:" << endl;1027 cout << " --------------------" << endl;1028 cout << " X: " << gzd << "*" << resrezd << "/" << ressezd << "=" << kGearRatio.X() << endl;1029 cout << " Y: " << gaz << "*" << resreaz << "/" << resseaz << "=" << kGearRatio.Y() << endl;1036 cout << " * Setting Gear Ratios:" << endl; 1037 cout << " --------------------" << endl; 1038 cout << " * X: " << gzd << "*" << resrezd << "/" << ressezd << "=" << kGearRatio.X() << endl; 1039 cout << " * Y: " << gaz << "*" << resreaz << "/" << resseaz << "=" << kGearRatio.Y() << endl; 1030 1040 } 1031 1041 1032 1042 void MCosy::TalkThread() 1033 1043 { 1034 if ( !(fMac1 && fMac2))1044 if (fMac1->IsZombieNode() || fMac2->IsZombieNode()) 1035 1045 return; 1036 1046 … … 1048 1058 } 1049 1059 1050 //fMac1->EnableTimeout(kTRUE, 500); 1051 //fMac2->EnableTimeout(kTRUE, 500); 1052 1053 if (!(fZd1 && fZd2 && fAz)) 1060 if (fZd1->IsZombieNode() || fZd2->IsZombieNode() || fAz->IsZombieNode()) 1054 1061 return; 1055 1062 … … 1058 1065 // Start the Network 1059 1066 // 1060 cout << "Reading configuration file..." << flush;1061 TEnv env(".cosyrc");1062 cout << "done." << endl;1067 //cout << "Reading configuration file..." << flush; 1068 //TEnv env(".cosyrc"); 1069 //cout << "done." << endl; 1063 1070 /* 1064 1071 const int res = fMac3->GetVelRes(); … … 1067 1074 fMac3->SetAcceleration(res); 1068 1075 fMac3->SetDeceleration(res); 1069 1070 cout << "Going Home..." << endl;1071 fMac1->SetHome(250000, env.GetValue("Az_MaxTime2ReachHome[s]", 100));1072 fMac2->SetHome(250000, env.GetValue("Zd_MaxTime2ReachHome[s]", 100));1073 PostMsg(WM_PRESET, 0, 0);1074 PostMsg(WM_WAIT, 0, 0);1075 1076 1076 1077 fMac1->ReqPos(); … … 1098 1099 fMac2->EnableTimeout(kTRUE, 500); 1099 1100 1100 const Double_t gaz = env.GetValue("Az_GearRatio[U_mot/U_tel]");1101 const Double_t gzd = env.GetValue("Zd_GearRatio[U_mot/U_tel]");1102 1103 const Double_t resreaz = env.GetValue("Az_ResRE[re/U_mot]");1104 const Double_t resrezd = env.GetValue("Zd_ResRE[re/U_mot]");1105 1106 kGearRatio.Set (gzd*resrezd/RES_SE, gaz*resreaz/RES_SE); //[re/se]1107 kGearRatio2.Set(gzd*resrezd/360.0, gaz*resreaz/360.0); //[re/deg]1108 1109 1101 //fMac2->SetNegEndswitch(Deg2ZdRE(env.GetValue("MinZd[Deg]", -1.0))); 1110 1102 //fMac2->SetPosEndswitch(Deg2ZdRE(env.GetValue("MaxZd[Deg]", +1.0))); 1111 1103 // fMac3->StartVelSync(); 1112 1113 //cout << "PostMsg(WM_PRESET)" << endl;1114 //void *rc =1115 //cout << hex << "WM_PRESET: ret=" << rc << endl;1116 1117 //RaDec dest = RaDec(45.0, 30.0)*D2PI/360.0;1118 1119 //cout << "PostMsg(WM_TRACK)" << endl;1120 //cout << sizeof(RaDec) << "==" << sizeof(dest) << endl;1121 //rc=PostMsg(WM_TRACK, &dest, sizeof(dest));1122 //cout << "DEST killed." << endl;1123 1124 // AltAz dest = AltAz(45.0, 30.0);1125 // double ra, dec;1126 // slaDaf2r( 71, 0, 0, &ra, &status); // 0 WARNING: RANGE1127 // slaDaf2r( 89, 0, 0, &dec, &status); // 491128 // cout << "Start tracking: Ra: " << Rad2Deg(ra) << kDEG << " Dec: " << Rad2Deg(dec) << kDEG << endl;1129 1130 // dest = AltAz(-46.0, 210);1131 // SetPosition(dest);1132 1104 */ 1133 1105 SlaStars sla; … … 1255 1227 // Update Gui, foremer MTGui. 1256 1228 // 1257 if ( fZd1) fZd1->DisplayVal();1258 if ( fZd2) fZd2->DisplayVal();1259 if ( fAz) fAz->DisplayVal();1229 if (!fZd1->IsZombieNode()) fZd1->DisplayVal(); 1230 if (!fZd2->IsZombieNode()) fZd2->DisplayVal(); 1231 if (!fAz->IsZombieNode()) fAz->DisplayVal(); 1260 1232 1261 1233 ZdAz seist = GetSePos()*2*TMath::Pi()/16384; // [se] 1262 1234 ZdAz bendist = fBending.CorrectBack(seist); 1263 1235 1236 Byte_t avail = 0; 1237 1238 avail |= !fMac1->IsZombieNode() ? 0x01 : 0; 1239 avail |= !fMac2->IsZombieNode() ? 0x02 : 0; 1240 avail |= !fMac3->IsZombieNode() ? 0x04 : 0; 1241 avail |= !fZd1->IsZombieNode() ? 0x08 : 0; 1242 avail |= !fZd2->IsZombieNode() ? 0x10 : 0; 1243 avail |= !fAz->IsZombieNode() ? 0x20 : 0; 1244 1264 1245 fWin->Update(bendist*(360.0/2/TMath::Pi()), fTrackingError/kGearRatio2, 1265 fVelocity, fOffset/*/kGearRatio2*/, fRaDec, fZdAzSoll, 1266 fStatus); 1246 fVelocity, fOffset, fRaDec, fZdAzSoll, fStatus, avail); 1247 1248 /* 1249 cout << (int)(fMac1->GetStatus()&Macs::kOutOfControl) << " "; 1250 cout << (int)(fMac2->GetStatus()&Macs::kOutOfControl) << " "; 1251 cout << (int)(fMac3->GetStatus()&Macs::kOutOfControl) << endl; 1252 */ 1267 1253 1268 1254 return kTRUE; … … 1282 1268 // Don't call this function twice! 1283 1269 Network::Start(); 1284 1270 /* 1285 1271 if (fMac1) 1286 1272 if (fMac1->IsZombieNode()) { delete fMac1; fMac1=NULL; } … … 1289 1275 if (fMac3) 1290 1276 if (fMac3->IsZombieNode()) { delete fMac3; fMac3=NULL; } 1291 1292 if (fZd1)1277 */ 1278 /* if (fZd1) 1293 1279 if (fZd1->IsZombieNode()) { delete fZd1; fZd1=NULL; } 1294 else fZd1->SetDisplay(fWin->GetLabel2());1295 1296 if (fZd2)1280 else */fZd1->SetDisplay(fWin->GetLabel2()); 1281 1282 /* if (fZd2) 1297 1283 if (fZd2->IsZombieNode()) { delete fZd2; fZd2=NULL; } 1298 else fZd2->SetDisplay(fWin->GetLabel3());1299 1300 if (fAz)1284 else */fZd2->SetDisplay(fWin->GetLabel3()); 1285 1286 /* if (fAz) 1301 1287 if (fAz->IsZombieNode()) { delete fAz; fAz=NULL; } 1302 else fAz->SetDisplay(fWin->GetLabel1());1288 else */fAz->SetDisplay(fWin->GetLabel1()); 1303 1289 1304 1290 ReadConfig(); … … 1345 1331 lout << "- Setting up network." << endl; 1346 1332 1347 fMac1=new Macs(id1, "Mac/Az", 1348 fMac2=new Macs(id3, "Mac/Zd", 1333 fMac1=new Macs(id1, "Mac/Az", lout); 1334 fMac2=new Macs(id3, "Mac/Zd", lout); 1349 1335 if (id2>=0) 1350 1336 fMac3=new Macs(id2, "Mac/Az-Sync", lout);
Note:
See TracChangeset
for help on using the changeset viewer.