Changeset 8814 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 01/16/08 14:26:10 (17 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MPointing.cc
r8376 r8814 1 #include "M Pointing.h"1 #include "MSlewing.h" 2 2 3 3 #include "MCosy.h" … … 5 5 #include "MDriveCom.h" 6 6 7 ClassImp(MPointing); 7 #include "MPointing.h" 8 9 ClassImp(MSlewing); 8 10 9 11 using namespace std; … … 22 24 // target position at the same time. 23 25 // 24 void M Pointing::SetPosVelocity(const Float_t ratio, Float_t vel)26 void MSlewing::SetPosVelocity(const Float_t ratio, Float_t vel) 25 27 { 26 28 // … … 51 53 // if Axis 2==kTRUE. The function waits for the movement to be finished. 52 54 // 53 void M Pointing::DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2)55 void MSlewing::DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2) 54 56 { 55 57 if (fCosy->HasZombie()) … … 72 74 } 73 75 74 bool M Pointing::SetAccDec(Macs *mac, Float_t acc, Float_t dec)76 bool MSlewing::SetAccDec(Macs *mac, Float_t acc, Float_t dec) 75 77 { 76 78 const int vr = mac->GetVelRes(); … … 80 82 } 81 83 82 bool M Pointing::Break()84 bool MSlewing::Break() 83 85 { 84 86 return fCosy->Break() || fCosy->HasError() || fCosy->HasZombie(); … … 96 98 // As a reference the shaftencoder values are used. 97 99 // 98 int M Pointing::SetPosition(const ZdAz &dst, Bool_t track) // [rad]100 int MSlewing::SetPosition(const ZdAz &dst, Bool_t track) // [rad] 99 101 { 100 102 const ZdAz d = dst*kRad2Deg; 101 103 102 104 MTime t(-1); 103 lout<< t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl;105 gLog << t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl; 104 106 105 107 // … … 148 150 { 149 151 150 lout<< "- Step #" << i << endl;152 gLog << "- Step #" << i << endl; 151 153 152 154 // Get Shaft Encoder Positions … … 171 173 { 172 174 t.Now(); 173 lout<< t << " - Positioning done in " << i << (i==1?" step.":" steps.") << endl;175 gLog << t << " - Positioning done in " << i << (i==1?" step.":" steps.") << endl; 174 176 fCosy->SetStatus(MDriveCom::kStopped); 175 177 fCosy->fCom->SendStatus("Target position reached."); … … 206 208 const Double_t y = 15*fCosy->kGearTot.Y()/fCosy->kResSE.Y(); 207 209 208 // lout << "M Pointing::SetPosition y: " << y << " rd.Az(): " << rd.Az() << endl;209 // lout << "M Pointing::SetPosition fCosy->kGearTot.Y(): " << fCosy->kGearTot.Y() << " fCosy->kResSE.Y(): " << fCosy->kResSE.Y() << endl;210 // lout << "MSlewing::SetPosition y: " << y << " rd.Az(): " << rd.Az() << endl; 211 // lout << "MSlewing::SetPosition fCosy->kGearTot.Y(): " << fCosy->kGearTot.Y() << " fCosy->kResSE.Y(): " << fCosy->kResSE.Y() << endl; 210 212 211 213 if (rd.Az()>-y && rd.Az()<y) … … 217 219 { 218 220 219 //lout << "M Pointing::SetPosition SetAccDec Mac1: " << fAcc << fDec << endl;221 //lout << "MSlewing::SetPosition SetAccDec Mac1: " << fAcc << fDec << endl; 220 222 221 223 SetAccDec(fCosy->fMac1, fAcc, fDec); … … 243 245 244 246 // repositioning (relative) 245 lout<< "- Do Relative Positioning..." << endl;247 gLog << "- Do Relative Positioning..." << endl; 246 248 DoRelPos(rd, cdzd, cdaz); 247 lout<< "- Relative Positioning Done" << endl;249 gLog << "- Relative Positioning Done" << endl; 248 250 } 249 251 if (i==1 && track && !Break()/*(fCosy->Break() || fCosy->HasError() || fCosy->HasZombie())*/) 250 252 { 251 253 t.Now(); 252 lout<< t << " - Positioning done." << endl;254 gLog << t << " - Positioning done." << endl; 253 255 fCosy->SetStatus(MDriveCom::kStopped); 254 256 fCosy->fCom->SendStatus("Tracking preposition reached."); … … 262 264 263 265 t.Now(); 264 lout<< t << " - Warning: Requested position not reached (i=" << dec << i << ")" << endl;266 gLog << t << " - Warning: Requested position not reached (i=" << dec << i << ")" << endl; 265 267 266 268 fCosy->fCom->SendStatus("Target position missed!"); -
trunk/MagicSoft/Cosy/main/MPointing.h
r3935 r8814 1 #ifndef COSY_M Pointing2 #define COSY_M Pointing1 #ifndef COSY_MSlewing 2 #define COSY_MSlewing 3 3 4 #include "coord.h" 5 #include "log.h" 6 7 #ifndef ROOT_TObject 8 #include <TObject.h> 4 #ifndef MARS_MLog 5 #include "MLog.h" 9 6 #endif 10 7 11 8 class Macs; 12 9 class MCosy; 10 class ZdAz; 13 11 14 class M Pointing : public Log, public TObject12 class MSlewing : public MLog 15 13 { 16 14 protected: … … 29 27 30 28 public: 31 M Pointing(MCosy *cosy, const Log &log) : Log(log),fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1) { }29 MSlewing(MCosy *cosy) : fCosy(cosy), fVel(0.1), fAcc(0.2), fDec(0.1) { } 32 30 33 31 void SetPointAccDec(Float_t acc, Float_t dec) { fAcc = acc; fDec = dec; } 34 32 void SetPointVelocity(Float_t vel) { fVel = vel; } 35 33 int SetPosition(const ZdAz &dst, Bool_t track=kFALSE); 36 37 ClassDef(M Pointing, 0)34 35 ClassDef(MSlewing, 0) 38 36 }; 39 37 -
trunk/MagicSoft/Cosy/main/MTracking.cc
r8377 r8814 52 52 // 53 53 if (fCosy->HasError()) 54 lout<< "Error while requesting re pos from Macs (SDO #6004)" << endl;54 gLog << "Error while requesting re pos from Macs (SDO #6004)" << endl; 55 55 56 56 return false; … … 93 93 // 94 94 if (fCosy->HasError()) 95 lout<< "Error while setting tracking velocity (SDO #3006)" << endl;95 gLog << "Error while setting tracking velocity (SDO #3006)" << endl; 96 96 97 97 return kFALSE; … … 223 223 { 224 224 vt->Az(maxtrack*vraz*4*sgn(vcalc.Az())); 225 lout<< "Warning: Azimuth speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Az()) << " > " << maxtrack*vraz << ")... limited." << endl;226 lout<< "Vcalc: " << vcalc.Zd() << " " << vcalc.Az() << "re/min" <<endl;225 gLog << "Warning: Azimuth speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Az()) << " > " << maxtrack*vraz << ")... limited." << endl; 226 gLog << "Vcalc: " << vcalc.Zd() << " " << vcalc.Az() << "re/min" <<endl; 227 227 rc=kTRUE; 228 228 } … … 230 230 { 231 231 vt->Zd(maxtrack*vrzd*4*sgn(vcalc.Zd())); 232 lout<< "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Zd()) <<" > " << maxtrack*vrzd << ")... limited." << endl;233 lout<< "Vcalc: " << vcalc.Zd() << " " << vcalc.Az() << "re/min" <<endl;232 gLog << "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded (" << fabs(vt->Zd()) <<" > " << maxtrack*vrzd << ")... limited." << endl; 233 gLog << "Vcalc: " << vcalc.Zd() << " " << vcalc.Az() << "re/min" <<endl; 234 234 rc=kTRUE; 235 235 } … … 329 329 ZdAz dest = sla.CalcZdAz(dst); 330 330 331 lout<< sla.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl;331 gLog << sla.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl; 332 332 333 333 // If the star is culminating behind the zenith (South) we want to … … 338 338 { 339 339 // align az from -180/180 to 0/360 340 lout<< "Star culminating behind zenith: Adding 360deg to Azimuth " << dest.Az()*kRad2Deg << endl;340 gLog << "Star culminating behind zenith: Adding 360deg to Azimuth " << dest.Az()*kRad2Deg << endl; 341 341 dest.Az(dest.Az() + TMath::TwoPi()); 342 342 } … … 347 347 if (!SetPosition(dest, kTRUE)) 348 348 { 349 lout<< "Error: Cannot start tracking, positioning failed." << endl;349 gLog << "Error: Cannot start tracking, positioning failed." << endl; 350 350 return; 351 351 } … … 369 369 fCosy->fRaDec = dst; 370 370 371 // StartThread 372 Start(); 371 RunThread(); 373 372 374 373 // … … 387 386 // Some output 388 387 XY xy(Rad2Deg(dst.Ra())*24/360, Rad2Deg(dst.Dec())); 389 lout<< sla.GetTime() << " - Start Tracking: Ra=" << xy.X() << "h Dec=";390 lout<< xy.Y() << "\xb0 @ Zd=" << pos.Zd()*kRad2Deg <<"deg Az=" << pos.Az()*kRad2Deg <<"deg" << endl;388 gLog << sla.GetTime() << " - Start Tracking: Ra=" << xy.X() << "h Dec="; 389 gLog << xy.Y() << "\xb0 @ Zd=" << pos.Zd()*kRad2Deg <<"deg Az=" << pos.Az()*kRad2Deg <<"deg" << endl; 391 390 392 391 // … … 470 469 if (LimitSpeed(&v, sla)) 471 470 { 472 lout<< "vt: " << v.Zd() << " " << v.Az() << "re/min" << endl;473 lout<< "Dest: " << dest.Zd() << " " << dest.Az() << endl;474 } 471 gLog << "vt: " << v.Zd() << " " << v.Az() << "re/min" << endl; 472 gLog << "Dest: " << dest.Zd() << " " << dest.Az() << endl; 473 } 475 474 476 475 // … … 488 487 if (vt.Zd()>.9*fCosy->fMac1->GetVelRes() || vt.Az()>.9*fCosy->fMac2->GetVelRes()) 489 488 { 490 lout<< "Error: Tracking speed faster than 90% of possible maximum velocity." << endl;489 gLog << "Error: Tracking speed faster than 90% of possible maximum velocity." << endl; 491 490 break; 492 491 } … … 524 523 // 525 524 usleep(1000000); // 1s 526 // *****FIXME**** cout << "." << flush;527 525 } 528 526 529 527 sla.Now(); 530 528 531 // StopThread532 Stop(); 533 529 CancelThread(); 530 531 // If CancelPoints are used we have to make this a Cleanup! 534 532 fCosy->StopMovement(); 535 533 536 lout<< sla.GetTime() << " - Tracking stopped @ Zd=";537 lout<< fCosy->fZdAzSoll.Zd()*TMath::RadToDeg() <<"deg Az=";538 lout<< fCosy->fZdAzSoll.Az()*TMath::RadToDeg() <<"deg" << endl;539 } 540 541 void *MTracking::Thread()534 gLog << sla.GetTime() << " - Tracking stopped @ Zd="; 535 gLog << fCosy->fZdAzSoll.Zd()*TMath::RadToDeg() <<"deg Az="; 536 gLog << fCosy->fZdAzSoll.Az()*TMath::RadToDeg() <<"deg" << endl; 537 } 538 539 Int_t MTracking::Thread() 542 540 { 543 541 if (fCosy->fZd1->IsZombieNode() && fCosy->fZd2->IsZombieNode()) 544 return (void*)1;542 return 1; 545 543 546 544 if (fCosy->fAz->IsZombieNode()) 547 return (void*)2;545 return 2; 548 546 549 547 if (!fCosy->fMac1 || !fCosy->fMac2) 550 return (void*)3;551 552 lout<< "- Tracking Thread started (" << MTime(-1) << ")" << endl;548 return 3; 549 550 gLog << "- Tracking Thread started (" << MTime(-1) << ")" << endl; 553 551 554 552 //const XY re2se = fCosy->kGearTot/fCosy->kResSE; //[re/se] … … 571 569 //ZdAz oldse = fCosy->GetSePos(); 572 570 573 while ( !HasStopFlag())571 while (1) 574 572 { 575 573 // Make changes (eg wind) smoother - attenuation of control function … … 589 587 phca2 = fCosy->fZd2->PosHasChanged(); 590 588 phcaz = fCosy->fAz->PosHasChanged(); 589 591 590 usleep(1); 592 } while (!phca1 && !phca2 && !phcaz && !HasStopFlag()); 591 TThread::CancelPoint(); 592 593 } while (!phca1 && !phca2 && !phcaz); 593 594 594 595 // Get time from last shaftencoder position change (position: ist) … … 619 620 fCosy->fZdAzSoll.Zd(dummy.Zd()); 620 621 soll.Zd(fCosy->fBending(dummy).Zd()); // [rad] 622 623 fCosy->fTrackingError.Zd(soll.Zd()-istse.Zd()); 624 625 TThread::CancelPoint(); 621 626 } 622 627 if (phcaz) … … 626 631 fCosy->fZdAzSoll.Az(dummy.Az()); 627 632 soll.Az(fCosy->fBending(dummy).Az()); // [rad] 633 634 fCosy->fTrackingError.Az(soll.Az()-istse.Az()); 635 636 TThread::CancelPoint(); 628 637 } 629 638 639 630 640 //fCosy->fZdAzSoll = soll; 631 632 // Calculate the aligned tracking pos otion from 'soll'-position641 /* 642 // Calculate the aligned tracking position from 'soll'-position 633 643 if (phca1 || phca2) 634 644 fCosy->fTrackingError.Zd(soll.Zd()-istse.Zd()); 635 645 if (phcaz) 636 646 fCosy->fTrackingError.Az(soll.Az()-istse.Az()); 637 } 638 639 lout << "- Tracking Thread done. (" << MTime(-1) << ")" << endl; 647 */ 648 } 649 650 gLog << "- Tracking Thread done. (" << MTime(-1) << ")" << endl; 640 651 return 0; 641 652 } -
trunk/MagicSoft/Cosy/main/MTracking.h
r4105 r8814 4 4 #include "coord.h" 5 5 6 #ifndef COSY_M Pointing7 #include "M Pointing.h"6 #ifndef COSY_MSlewing 7 #include "MSlewing.h" 8 8 #endif 9 9 10 #ifndef COSY_MThread10 #ifndef MARS_MThread 11 11 #include "MThread.h" 12 12 #endif … … 14 14 class SlaStars; 15 15 16 class MTracking : public M Pointing, public MThread16 class MTracking : public MSlewing, public MyThreadX 17 17 { 18 18 private: … … 39 39 ZdAz GetPointingPosRE(Bool_t pdo=kFALSE) const; 40 40 41 void *Thread();41 Int_t Thread(); 42 42 43 43 public: 44 MTracking(MCosy *cosy , const Log &log) : MPointing(cosy, log), MThread(kFALSE), fTrackAcc(0.1), fTrackDec(0.1), fOut(0) { }44 MTracking(MCosy *cosy) : MSlewing(cosy), MyThreadX("MTracking"), fTrackAcc(0.1), fTrackDec(0.1), fOut(0) { } 45 45 46 46 void TrackPosition(const RaDec &dst); // ra, dec [rad] -
trunk/MagicSoft/Cosy/main/MainLinkDef.h
r4865 r8814 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MCosy ;7 #pragma link C++ class MCosy+; 8 8 #pragma link C++ class MStarguider+; 9 9 #pragma link C++ class MStargHistograms+; 10 10 11 #pragma link C++ class MBending; 12 13 #pragma link C++ class MPointing; 14 #pragma link C++ class MTracking; 11 #pragma link C++ class MSlewing+; 12 #pragma link C++ class MTracking+; 15 13 16 14 #endif
Note:
See TracChangeset
for help on using the changeset viewer.