Changeset 7788 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 07/12/06 03:00:16 (18 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r7614 r7788 401 401 // 402 402 point.SetPointAccDec(0.2, 0.1); 403 403 404 point.SetPointVelocity(0.1); 404 405 … … 634 635 // open tpoint file 635 636 // 636 const TString name = GetFileName("tpoint /old-tpoint_%s.txt");637 const TString name = GetFileName("tpoint", "old-tpoint", "txt"); 637 638 cout << "TPoint-Cosy File ********* " << name << " ********** " << endl; 638 639 … … 675 676 676 677 ZdAz dest = *((ZdAz*)mp) * kDeg2Rad; 677 if (!SetPosition(dest ))678 if (!SetPosition(dest, kTRUE)) 678 679 return (void*)0x1234; 679 680 … … 686 687 //cout << "WM_TrackPosition: done. (return 0xabcd)" << endl; 687 688 return (void*)0xabcd; 688 689 /* 690 case WM_ARM: 691 //cout << "WM_Position: start." << endl; 692 { 693 if (!CheckNetwork()) 694 return (void*)0xebb0; 695 696 const bool arm = *((bool*)mp); 697 if (arm) 698 { 699 fMac1->Arm(); 700 fMac2->Arm(); 701 cout << "ARMED" << endl; 702 } 703 else 704 { 705 fMac1->Disarm(); 706 fMac2->Disarm(); 707 cout << "DISARMED" << endl; 708 } 709 } 710 //cout << "WM_Position: done. (return 0x7777)" << endl; 711 return (void*)0x9999; 712 */ 689 713 case WM_POSITION: 690 714 //cout << "WM_Position: start." << endl; … … 711 735 return (void*)0x7777; 712 736 737 case WM_PREPS: 738 //cout << "WM_Track: START" << endl; 739 { 740 if (!CheckNetwork()) 741 return (void*)0xebb0; 742 743 const char *preps = (const char*)mp; 744 cout << "Preposition command to " << preps << " received." << endl; 745 746 ifstream fin("prepos.txt"); 747 if (!fin) 748 { 749 cout << "ERROR: cannot open prepos.txt." << endl; 750 return (void*)0xebb1; 751 } 752 753 while (1) 754 { 755 Double_t zd, az; 756 fin >> zd >> az; 757 758 TString str; 759 str.ReadLine(fin); 760 if (!fin) 761 break; 762 763 str.ToLower(); 764 765 if (str.Strip(TString::kBoth)==preps) 766 { 767 ZdAz dest(zd, az); 768 SetPosition(dest*kDeg2Rad); 769 return (void*)0x7979; 770 } 771 cout << "ERROR - Requested preposition not found in file..." << endl; 772 } 773 } 774 //cout << "WM_Track: done. (return 0x8888)" << endl; 775 return (void*)0x7878; 776 713 777 case WM_TESTSE: 714 778 //cout << "WM_TestSe: start." << endl; … … 730 794 731 795 case WM_TRACK: 732 //cout << "WM_Track: START" << endl; 796 case WM_GRB: 797 //cout << "WM_Track/GRB: START" << endl; 733 798 { 734 799 RaDec dest = ((RaDec*)mp)[0]; … … 737 802 if (!CheckNetwork()) 738 803 return (void*)0xebb0; 739 TrackPosition(dest*kDeg2Rad); 804 805 if (msg==WM_TRACK) 806 TrackPosition(dest*kDeg2Rad); 807 else 808 TrackPositionGRB(dest*kDeg2Rad); 740 809 } 741 //cout << "WM_Track: done. (return 0x8888)" << endl; 742 return (void*)0x8888; 743 744 case WM_GRB: 745 //cout << "WM_Track: START" << endl; 746 { 747 RaDec dest = ((RaDec*)mp)[0]; 748 if (fStarguider) 749 fStarguider->SetPointingPosition(((RaDec*)mp)[1]); 750 if (!CheckNetwork()) 751 return (void*)0xebb0; 752 TrackPositionGRB(dest*kDeg2Rad); 753 } 754 //cout << "WM_Track: done. (return 0x8888)" << endl; 810 //cout << "WM_Track/GRB: done. (return 0x8888)" << endl; 755 811 return (void*)0x8888; 756 812 … … 1178 1234 avail |= (fZd2 && !fZd2->IsZombieNode()) ? 0x10 : 0; 1179 1235 avail |= (fAz && !fAz->IsZombieNode()) ? 0x20 : 0; 1236 // avail |= (!(fStatus&MDriveCom::kError) && 1 ? 0x40 : 0; 1180 1237 1181 1238 if (HasError()) … … 1471 1528 */ 1472 1529 1473 TString MCosy::GetFileName(const char * fmt)1530 TString MCosy::GetFileName(const char *path, const char *name, const char *ext) 1474 1531 { 1475 1532 // FIXME: Timeout missing 1533 1476 1534 while (1) 1477 1535 { 1478 1536 MTime time(-1); 1479 const TString name = Form(fmt, (const char*)time.GetFileName()); 1480 if (gSystem->AccessPathName(name, kFileExists)) 1481 return name; 1482 break; 1537 1538 // This is the full qualified date which is part of the name 1539 const TString clock = time.GetStringFmt("%y%m%d_%H%M%S"); 1540 1541 // This gives the night in which the date belongs to 1542 time.SetMjd(TMath::Nint(time.GetMjd())); 1543 1544 const TString night = time.GetStringFmt("%Y_%m_%d"); 1545 1546 const TString dir = Form("%s/%s", path, night.Data()); 1547 const TString fname = Form("%s_%s.%s", name, clock.Data(), ext); 1548 1549 const TString full = Form("%s/%s", dir.Data(), fname.Data()); 1550 1551 gSystem->mkdir(dir, kTRUE); 1552 1553 if (gSystem->AccessPathName(full, kFileExists)) 1554 return full; 1555 1556 break;// !!!!!!!!!!!!!!!!!!!!!!! 1483 1557 1484 1558 usleep(1000); … … 1498 1572 const Int_t id6 = env.GetValue("Az_Id-SE", 6); //6 1499 1573 1500 TString name = GetFileName("rep /cosy_%s.rep");1574 TString name = GetFileName("rep", "cosy", "rep"); 1501 1575 cout << "Open Repfile: " << name << endl; 1502 1576 fOutRep = new MLog(name, kTRUE); -
trunk/MagicSoft/Cosy/main/MCosy.h
r6841 r7788 38 38 #define WM_ENDSWITCH 0x1010 39 39 #define WM_GRB 0x1011 40 #define WM_PREPS 0x1012 41 #define WM_ARM 0x1013 40 42 41 43 class ShaftEncoder; … … 187 189 void SetStarguider(MStarguider *s) { fStarguider = s; } 188 190 189 static TString GetFileName(const char * name);191 static TString GetFileName(const char *path, const char *name, const char *ext); 190 192 191 193 MGCosy *GetWin() { return fWin; } -
trunk/MagicSoft/Cosy/main/MStarguider.cc
r7785 r7788 1 #undef EXPERT 1 2 #undef EXPERT 2 3 … … 335 336 336 337 fCZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE); 337 fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+581+ 12);338 fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+581+20-4); 338 339 AddFrame(fCZdAz); 339 340 fList->Add(fCZdAz); 340 341 341 342 fPZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE); 342 fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+627+2* 12);343 fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+627+2*20-4); 343 344 AddFrame(fPZdAz); 344 345 fList->Add(fPZdAz); 345 346 346 347 fDZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE); 347 fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+673+3* 12);348 fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+673+3*20-4); 348 349 AddFrame(fDZdAz); 349 350 fList->Add(fDZdAz); 350 351 351 352 fSZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE); 352 fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+719+4* 12);353 fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+719+4*20-4); 353 354 AddFrame(fSZdAz); 354 355 fList->Add(fSZdAz); 355 356 356 357 fTPoint = new TGTextButton(this, "TPoint"); 357 fTPoint->Move(4, fMenu->GetDefaultHeight()+722+3*1 2+25);358 fTPoint->Move(4, fMenu->GetDefaultHeight()+722+3*15+15); 358 359 fTPoint->AllowStayDown(kTRUE); 359 360 AddFrame(fTPoint); … … 361 362 362 363 fStargTPoint = new TGTextButton(this, "StargTPoint"); 363 fStargTPoint->Move(240+12+2 0, fMenu->GetDefaultHeight()+785);364 fStargTPoint->Move(240+12+28, fMenu->GetDefaultHeight()+785); 364 365 fStargTPoint->AllowStayDown(kTRUE); 365 366 AddFrame(fStargTPoint); … … 368 369 fFps = new TGLabel(this, "---fps"); 369 370 fFps->SetTextJustify(kTextRight); 370 fFps->Move(650-4 40, fMenu->GetDefaultHeight()+619+13+60+20);371 fFps->Move(650-495, fMenu->GetDefaultHeight()+619+13+60+20+2); 371 372 AddFrame(fFps); 372 373 fList->Add(fFps); 373 374 374 fPosZoom = new TGLabel(this, " ----.--d/----.--d (----, ----)");375 fPosZoom->SetTextJustify(kText Right);375 fPosZoom = new TGLabel(this, "(----, ----) ----.--d/----.--d"); 376 fPosZoom->SetTextJustify(kTextLeft); 376 377 fPosZoom->Move(4, fMenu->GetDefaultHeight()+765); 377 378 AddFrame(fPosZoom); … … 386 387 TGLabel *l = new TGLabel(this, "arcsec/pix"); 387 388 l->SetTextJustify(kTextLeft); 388 l->Move(60 5-400, fMenu->GetDefaultHeight()+619+13+60);389 l->Move(606-412, fMenu->GetDefaultHeight()+619+13+60); 389 390 AddFrame(l); 390 391 fList->Add(l); … … 392 393 l = new TGLabel(this, "deg"); 393 394 l->SetTextJustify(kTextLeft); 394 l->Move(60 5-410, fMenu->GetDefaultHeight()+619-10+60);395 l->Move(606-412, fMenu->GetDefaultHeight()+619-10+60); 395 396 AddFrame(l); 396 397 fList->Add(l); … … 398 399 l = new TGLabel(this, "Telescope pointing at"); 399 400 l->SetTextJustify(kTextLeft); 400 l->Move(240+12+20 , fMenu->GetDefaultHeight()+584-5);401 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+584-5); 401 402 AddFrame(l); 402 403 fList->Add(l); … … 404 405 l = new TGLabel(this, "Starguider position"); 405 406 l->SetTextJustify(kTextLeft); 406 l->Move(240+12+20 , fMenu->GetDefaultHeight()+630+12-5);407 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+630+20-5); 407 408 AddFrame(l); 408 409 fList->Add(l); … … 410 411 l = new TGLabel(this, "Misspointing"); 411 412 l->SetTextJustify(kTextLeft); 412 l->Move(240+12+20 , fMenu->GetDefaultHeight()+676+2*12-5);413 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+676+2*20-5); 413 414 AddFrame(l); 414 415 fList->Add(l); … … 417 418 l = new TGLabel(this, "Misspointing/FindStar (Experts Only!)"); 418 419 l->SetTextJustify(kTextLeft); 419 l->Move(240+12+20, fMenu->GetDefaultHeight()+722+3* 12-5);420 l->Move(240+12+20, fMenu->GetDefaultHeight()+722+3*20-5); 420 421 AddFrame(l); 421 422 fList->Add(l); … … 436 437 fList->Add(fPixSize); 437 438 438 fAngle = new TGTextEntry(this, " 0", IDM_kAngle); 439 const Double_t angle = -0.4; 440 fSao->SetRotationAngle(angle); 441 442 txt = ""; 443 txt += angle; 444 445 fAngle = new TGTextEntry(this, txt, IDM_kAngle); 439 446 fAngle->SetAlignment(kTextCenterX); 440 447 fAngle->Move(547-410, fMenu->GetDefaultHeight()+617-10+60); … … 1385 1392 { 1386 1393 // open tpoint file 1387 const TString name = MCosy::GetFileName("tpoint /starg_%s.txt");1394 const TString name = MCosy::GetFileName("tpoint", "starg", "txt"); 1388 1395 cout << "TPoint-Starg File ********* " << name << " ********** " << endl; 1389 1396 … … 1451 1458 // Try to find Led in this area 1452 1459 Leds leds; 1453 f.FindStar Circle(leds, (Int_t)SearchCenter.X(), (Int_t)SearchCenter.Y());1460 f.FindStar(leds, (Int_t)SearchCenter.X(), (Int_t)SearchCenter.Y(), true); 1454 1461 1455 1462 // Check whether star found … … 1470 1477 if (!fOutRq) 1471 1478 { 1472 const TString name = MCosy::GetFileName("tpoint /starg_roquelamp_%s.txt");1479 const TString name = MCosy::GetFileName("tpoint", "roquelamp", "txt"); 1473 1480 cout << "Starg_RoqueLamp File ********* " << name << " ********** " << endl; 1474 1481 fOutRq = new ofstream(name); … … 1476 1483 } 1477 1484 1478 1479 1485 return relroquepos; 1480 1486 } 1481 1482 1487 1483 1488 ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring ¢er, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0) … … 1489 1494 // Try to find Led in this area 1490 1495 Leds leds; 1491 f.FindStar Circle(leds, (Int_t)center.GetX(), (Int_t)center.GetY());1496 f.FindStar(leds, (Int_t)center.GetX(), (Int_t)center.GetY(), true); 1492 1497 1493 1498 if (leds.GetEntries()<0) … … 1505 1510 return ZdAz(.0,.0); 1506 1511 } 1507 1508 1512 cout << "Found star @ " << flush; 1509 1513 star->Print(); … … 1561 1565 // open tpoint file 1562 1566 // 1563 const TString name = MCosy::GetFileName("tpoint /tpoint_%s.txt");1567 const TString name = MCosy::GetFileName("tpoint", "tpoint", "txt"); 1564 1568 cout << "TPoint-Starg File ********* " << name << " ********** " << endl; 1565 1569 … … 1715 1719 // Find Star at Center---for Tpoint Procedure 1716 1720 if (fDisplay->IsEntryChecked(IDM_kFindStar)) 1717 /*ZdAz zdaz =*/FindStar(f, f2, center, t, 3.5, 70);1721 FindStar(f, f2, center, t, 3.5, 70); 1718 1722 1719 1723 byte zimg[kZOOM*kZOOM]; … … 1779 1783 { 1780 1784 1781 XY roquelamp(0,0);1782 1783 1785 Double_t imageclean = 1.5; 1784 1786 Double_t boxradius = 60; … … 1786 1788 XY searchcenter(768/2-1,576/2+25); 1787 1789 1788 roquelamp = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter);1790 XY roquelamp = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter); 1789 1791 1790 1792 if (fOutRq) … … 1804 1806 1805 1807 // Find Spot on Camera Center in Starguider camera 1806 1807 1808 if (fOperations->IsEntryChecked(IDM_kRoqueLampAna)) 1808 1809 { … … 1832 1833 f2.DrawCircle(sgcenter, 115.0, 0x0fa); 1833 1834 } 1834 1835 1835 // we calculate the offset given by the three ETH Leds visible to 1836 1836 // the guide camera … … 1884 1884 1885 1885 // Position around which the circles are drawn. 1886 const Ring skycenter(768/2 +off.X(), 576/2+off.Y());1886 const Ring skycenter(768/2-off.X(), 576/2+off.Y()); 1887 1887 1888 1888 // There are two corrections to the misspointing … … 1896 1896 Leds spots; 1897 1897 f.SetBox(230); 1898 // f.SetCut(1.5); 1899 double bright; 1898 f.SetCut(2.5); 1899 1900 double bright; 1900 1901 f.ExecuteAndMark(spots, 530, 292, bright); 1901 MString txt; 1902 1903 MString txt; 1902 1904 txt.Print("Sky Brightness: %.1f", bright); 1903 1905 fSkyBright->SetText(txt); … … 1961 1963 { 1962 1964 f2.DrawCircle(center, 0x0a); 1963 f2.DrawCircle(center, 5.0,1965 f2.DrawCircle(center, 7.0, 1964 1966 fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0); 1965 1967 f2.DrawCircle(center, 115.0, 0x0a); … … 2003 2005 if (aa.Az()<0) 2004 2006 aa.Az(aa.Az()+360); 2005 txt.Print(" %.1fd/%.1fd (%d, %d)", -aa.Alt(), aa.Az()-180, fDx, fDy);2007 txt.Print("(%d, %d) %.1fd/%.1fd", fDx, fDy, -aa.Alt(), aa.Az()-180); 2006 2008 } 2007 2009 else
Note:
See TracChangeset
for help on using the changeset viewer.