Changeset 9516 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 10/21/09 10:49:36 (15 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r9439 r9516 349 349 350 350 return point.SetPosition(dst, track); 351 } 352 353 void MCosy::TrackPlanet(const Int_t &p) // ra, dec [rad] 354 { 355 MTracking track(this); 356 track.SetOut(fOutRep); 357 358 track.SetPointAcc(0.03, 0.01); 359 track.SetPointVelocity(0.3); 360 track.SetTrackAcc(0.01, 0.01); 361 362 track.TrackPlanet((ePlanets_t)p); 351 363 } 352 364 … … 657 669 { 658 670 RaDec dest = ((RaDec*)mp)[0]; 659 if (fStarguider)660 fStarguider->SetPointingPosition(((RaDec*)mp)[1]);661 671 if (!CheckNetwork()) 662 672 return 0xebb0; … … 670 680 return 0x8888; 671 681 682 case WM_PLANET: 683 //cout << "WM_PLANET: START" << endl; 684 { 685 const Int_t p = ((Int_t*)mp)[0]; 686 if (!CheckNetwork()) 687 return 0xebb1; 688 689 TrackPlanet(p); 690 } 691 //cout << "WM_PLANET: done. (return 0x8889)" << endl; 692 return 0x8889; 693 /* 672 694 case WM_NEWTRACK: 673 695 //cout << "WM_NewTrack: START" << endl; … … 675 697 //cout << "WM_NewTrack: done. (return 0x9999)" << endl; 676 698 return 0x9999; 677 699 */ 678 700 case WM_LOADBENDING: 679 701 //cout << "WM_LoadBending: START" << endl; … … 826 848 { 827 849 tout.Start(999); 828 fCom->SendReport(fStatus, fRaDec, f ZdAzSoll, bendist, fTrackingError, armed,850 fCom->SendReport(fStatus, fRaDec, fHourAngle, fZdAzSoll, bendist, fTrackingError, armed, 829 851 fStarguider ? fStarguider->GetStarguiderMode() : 0); 830 852 } -
trunk/MagicSoft/Cosy/main/MCosy.h
r9439 r9516 30 30 //#define WM_CALIB 0x1004 31 31 #define WM_TPOINT 0x1005 32 #define WM_NEWTRACK 0x100632 //#define WM_NEWTRACK 0x1006 33 33 #define WM_LOADBENDING 0x1007 34 34 #define WM_RESETBENDING 0x1008 … … 46 46 #define WM_STARGTPOINT 0x1014 47 47 #define WM_STARGMODE 0x1015 48 #define WM_PLANET 0x1016 48 49 49 50 class Dkc; … … 77 78 TMutex fMutexGui; 78 79 79 ZdAz fTrackingError; // [rad] Tracking Offset between SE and calc-pos 80 ZdAz fZdAzSoll; // [rad] Soll position when moving 81 RaDec fRaDec; // Position to track 82 ZdAz fAccuracy; // Actual accuracy of Tracking 83 ZdAz fMin; 84 ZdAz fMax; 80 ZdAz fTrackingError; // [rad] Tracking Offset between SE and calc-pos 81 ZdAz fZdAzSoll; // [rad] Soll position when moving 82 RaDec fRaDec; // Position to track 83 Double_t fHourAngle; // Hour Angle of Position to track 84 ZdAz fAccuracy; // Actual accuracy of Tracking 85 ZdAz fMin; 86 ZdAz fMax; 85 87 86 88 MPointing fBending; … … 101 103 102 104 int SetPosition(const ZdAz &dst, Bool_t track=kFALSE); 105 void TrackPlanet(const Int_t &p); 103 106 void TrackPosition(const RaDec &dst); // ra, dec [rad] 104 107 void TrackPositionGRB(const RaDec &dst); // ra, dec [rad] -
trunk/MagicSoft/Cosy/main/MTracking.cc
r9443 r9516 4 4 5 5 #include "dkc.h" 6 //#include "shaftencoder.h" 6 7 #include "SlaStars.h" 7 8 8 9 #include "MCosy.h" 9 #include " SlaStars.h"10 #include "MStarguider.h" 10 11 11 12 #include "MDriveCom.h" … … 17 18 //#define EXPERT 18 19 #undef EXPERT 20 21 MTracking::MTracking(MCosy *cosy) 22 : MSlewing(cosy), MThread("MTracking"), fSlalib(fCosy->fObservatory), 23 fTrackAcc(0, 0), fOut(0) 24 { 25 } 19 26 20 27 // -------------------------------------------------------------------------- … … 146 153 // velocities are limited to the maximum velocity. 147 154 // 148 Bool_t MTracking::LimitSpeed(const ZdAz &vt , const SlaStars &sla) const155 Bool_t MTracking::LimitSpeed(const ZdAz &vt) const 149 156 { 150 157 // vt [deg/min] … … 159 166 160 167 // Calculate approximate velocity of both axis 161 ZdAz vcalc = sla.GetApproxVel(fCosy->fRaDec); // [rad/rad]168 ZdAz vcalc = fSlalib.GetApproxVel(fCosy->fRaDec); // [rad/rad] 162 169 163 170 //vcalc *= 1./(24*60); // [U_tel/min] … … 209 216 } 210 217 211 void MTracking::TrackPosition(const RaDec &dst) // ra, dec [rad] 212 { 213 SlaStars sla(fCosy->fObservatory); 214 215 // 216 // Position to actual position 217 // 218 sla.Now(); 219 ZdAz dest = sla.CalcZdAz(dst); 220 221 gLog << all << sla.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl; 218 void MTracking::UpdateSlalib(SlaPlanets &sla) 219 { 220 if (fTrackType<0) 221 sla.Set(fTrackPos); 222 else 223 sla.SetPlanet((ePlanets_t)fTrackType); 224 225 if (fCosy->fStarguider) 226 fCosy->fStarguider->SetPointingPosition(sla.GetRaDec()); 227 } 228 229 void MTracking::UpdateSlalib(Double_t dt=0) 230 { 231 fSlalib.Now(dt); 232 UpdateSlalib(fSlalib); 233 234 fCosy->fRaDec = fSlalib.GetRaDec(); 235 fCosy->fHourAngle = fSlalib.GetHourAngle(); 236 } 237 238 void MTracking::UpdateSlalib(SlaPlanets &sla, Double_t mjd) 239 { 240 sla.SetMjd(mjd); 241 UpdateSlalib(sla); 242 } 243 244 bool MTracking::Move() 245 { 246 const RaDec &dst = fSlalib.GetRaDec(); 247 248 ZdAz dest = fSlalib.GetZdAz();//fSlalib.CalcZdAz(dst); 249 250 gLog << all << fSlalib.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl; 222 251 223 252 // If the star is culminating behind the zenith (South) we want to … … 225 254 // culminating before the zenith (north) we want the star to be 226 255 // aligned between -180 and 180deg (which is the default of CalcZdAz) 227 if ( sla.GetPhi()>dst.Dec() && dest.Az()<0)256 if (fSlalib.GetPhi()>dst.Dec() && dest.Az()<0) 228 257 { 229 258 // align az from -180/180 to 0/360 … … 238 267 { 239 268 gLog << err << "ERROR - Cannot start tracking, positioning failed." << endl; 269 return false; 270 } 271 272 return true; 273 } 274 275 void MTracking::TrackPosition(const RaDec &dst) 276 { 277 fTrackPos = dst; 278 fTrackType = -1; 279 280 // Start tracking 281 Track(); 282 } 283 284 void MTracking::TrackPlanet(ePlanets_t planet) 285 { 286 fTrackPos = RaDec(); 287 fTrackType = planet; 288 289 // Start tracking 290 Track(); 291 } 292 293 void MTracking::Track() // ra, dec [rad] 294 { 295 // Position to corrent nominal position 296 UpdateSlalib(); 297 298 if (!Move()) 240 299 return; 241 } 300 301 //fCosy->fRaDec = fSlalib.GetRaDec(); 242 302 243 303 // Initialize Tracker (slalib or starguider) 244 fCosy->fRaDec = dst;245 246 304 RunThread(); 247 305 … … 256 314 257 315 // Get current nominal local position 258 sla.Now(); 259 ZdAz pos = sla.CalcZdAz(fCosy->fRaDec); 316 UpdateSlalib(); 317 //fCosy->fRaDec = fSlalib.GetRaDec(); 318 319 ZdAz pos = fSlalib.GetZdAz();//fSlalib.CalcZdAz(fSlalib.GetRaDec()); 260 320 261 321 // Some output 262 XY xy(TMath::RadToDeg()* dst.Ra()*24/360, TMath::RadToDeg()*dst.Dec());263 gLog << all << sla.GetTime() << " - Start Tracking: Ra=" << xy.X() << "h Dec=";322 XY xy(TMath::RadToDeg()*fCosy->fRaDec.Ra()/15, TMath::RadToDeg()*fCosy->fRaDec.Dec()); 323 gLog << all << fSlalib.GetTime() << " - Start Tracking: Ra=" << xy.X() << "h Dec="; 264 324 gLog << xy.Y() << "\xb0 @ Zd=" << pos.Zd()*kRad2Deg <<"deg Az=" << pos.Az()*kRad2Deg <<"deg" << endl; 265 325 … … 295 355 // Request Target position for Now+dt 296 356 // 297 sla.Now(dt); 357 UpdateSlalib(); 358 //fCosy->fRaDec = fSlalib.GetRaDec(); 298 359 299 360 // 300 361 // Request nominal position for this time in the future (To+dt) 301 362 // 302 const ZdAz pointing = sla.CalcZdAz(fCosy->fRaDec); // [rad]363 const ZdAz pointing = fSlalib.GetZdAz(); //fSlalib.CalcZdAz(fSlalib.GetRaDec()); // [rad] 303 364 ZdAz dest = fCosy->AlignTrackingPos(pointing); // fix ambiguity 304 365 … … 329 390 //v.Az(v.Az()*(1+TMath::Min(0.3, kpAz))); 330 391 331 if (LimitSpeed(v , sla))392 if (LimitSpeed(v)) 332 393 { 333 394 gLog << dbg << "vt: " << v.Zd() << " " << v.Az() << "re/min" << endl; … … 372 433 } 373 434 374 sla.Now();435 fSlalib.Now(); 375 436 376 437 CancelThread(); … … 379 440 fCosy->StopMovement(); 380 441 381 gLog << all << sla.GetTime() << " - Tracking stopped @ Zd=";442 gLog << all << fSlalib.GetTime() << " - Tracking stopped @ Zd="; 382 443 gLog << fCosy->fZdAzSoll.Zd()*TMath::RadToDeg() <<"deg Az="; 383 444 gLog << fCosy->fZdAzSoll.Az()*TMath::RadToDeg() <<"deg" << endl; … … 391 452 gLog << inf2 << "- Tracking Thread started (" << MTime(-1) << ")" << endl; 392 453 393 SlaStars sla(fCosy->fObservatory); 394 sla.Now(); 395 396 ZdAz soll = sla.CalcZdAz(fCosy->fRaDec); // [rad] 454 SlaPlanets sla(fSlalib.GetObservatoryKey()); 455 456 UpdateSlalib(sla); 457 458 //ZdAz soll = sla.GetZdAz(); //sla.CalcZdAz(sla.GetRaDec()); // [rad] 397 459 398 460 // … … 434 496 if (phca1) 435 497 { 436 ZdAz dummy = sla.CalcZdAz(fCosy->fRaDec, mjdzd); 498 UpdateSlalib(sla, mjdzd); 499 500 ZdAz dummy = sla.GetZdAz();//sla.CalcZdAz(radec, mjdzd); 437 501 dummy = fCosy->AlignTrackingPos(dummy); 438 502 fCosy->fZdAzSoll.Zd(dummy.Zd()); 439 soll.Zd(fCosy->fBending(dummy).Zd()); // [rad] 440 441 fCosy->fTrackingError.Zd(soll.Zd()-istse.Zd()); 503 fCosy->fTrackingError.Zd(fCosy->fBending(dummy).Zd()-istse.Zd()); 442 504 443 505 TThread::CancelPoint(); … … 445 507 if (phcaz) 446 508 { 447 ZdAz dummy = sla.CalcZdAz(fCosy->fRaDec, mjdaz); 509 UpdateSlalib(sla, mjdaz); 510 511 ZdAz dummy = sla.GetZdAz();//sla.CalcZdAz(radec, mjdaz); 448 512 dummy = fCosy->AlignTrackingPos(dummy); 449 513 fCosy->fZdAzSoll.Az(dummy.Az()); 450 soll.Az(fCosy->fBending(dummy).Az()); // [rad] 451 452 fCosy->fTrackingError.Az(soll.Az()-istse.Az()); 514 fCosy->fTrackingError.Az(fCosy->fBending(dummy).Az()-istse.Az()); 453 515 454 516 TThread::CancelPoint(); -
trunk/MagicSoft/Cosy/main/MTracking.h
r9132 r9516 4 4 #ifndef COSY_MSlewing 5 5 #include "MSlewing.h" 6 #endif 7 8 #ifndef COSY_SlaPlanets 9 #include "SlaPlanets.h" 6 10 #endif 7 11 … … 17 21 { 18 22 private: 23 SlaPlanets fSlalib; 24 19 25 ZdAz fTrackAcc; 26 27 Int_t fTrackType; 28 RaDec fTrackPos; 20 29 21 30 MLog *fOut; 22 31 32 void UpdateSlalib(SlaPlanets &sla); 33 void UpdateSlalib(Double_t dt); 34 void UpdateSlalib(SlaPlanets &sla, Double_t mjd); 35 23 36 bool SetVelocity(const ZdAz &v); 24 bool LimitSpeed(const ZdAz &vt , const SlaStars &sla) const;37 bool LimitSpeed(const ZdAz &vt) const; 25 38 bool InitTracking(); 39 bool Move(); 40 void Track(); 26 41 27 42 Int_t Thread(); 28 43 29 44 public: 30 MTracking(MCosy *cosy) : MSlewing(cosy), MThread("MTracking"), fTrackAcc(0, 0), fOut(0) { }45 MTracking(MCosy *cosy); 31 46 32 47 void TrackPosition(const RaDec &dst); // ra, dec [rad] 48 void TrackPlanet(ePlanets_t planet); // ra, dec [rad] 33 49 void SetTrackAcc(Float_t zd, Float_t az) { fTrackAcc.Zd(zd); fTrackAcc.Az(az); } 34 50
Note:
See TracChangeset
for help on using the changeset viewer.