Changeset 7230 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 07/28/05 22:24:32 (20 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCosy.cc
r6841 r7230 397 397 // point.SetVelocity(0.2); // fast: 0.6, slow: 0.2 398 398 //#else 399 400 // original settings 401 // 399 402 point.SetPointAccDec(0.2, 0.1); 400 403 point.SetPointVelocity(0.1); 404 405 401 406 //#endif 402 407 408 // point.SetPointAccDec(0.4, 0.4); 409 // point.SetPointVelocity(0.4); 410 411 412 // original 403 413 return point.SetPosition(dst, track); 414 415 // test 416 // return point.SetPosition(dst, kTRUE); 417 418 419 404 420 } 405 421 … … 422 438 // track.SetPointVelocity(0.2); // fast: 0.6, slow: 0.2 423 439 //#else 440 441 442 424 443 track.SetPointAccDec(0.2, 0.1); 425 444 track.SetPointVelocity(0.1); 445 446 // track.SetPointAccDec(0.4, 0.4); 447 // track.SetPointVelocity(0.4); 448 449 450 426 451 //#endif 427 452 track.SetTrackAccDec(0.1, 0.1); … … 438 463 // track.SetPointVelocity(0.2); // fast: 0.6, slow: 0.2 439 464 //#else 440 track.SetPointAccDec(0. 2, 0.1);441 track.SetPointVelocity(0. 1);465 track.SetPointAccDec(0.4, 0.4); 466 track.SetPointVelocity(0.3); 442 467 //#endif 443 468 track.SetTrackAccDec(0.1, 0.1); -
trunk/MagicSoft/Cosy/main/MPointing.cc
r4106 r7230 202 202 else 203 203 { 204 const Double_t y = 15*fCosy->kGearTot.Y()*fCosy->kResSE.Y(); 205 if (rd.Az()>-y && rd.Az()<y) 206 { 207 //lout << "--- LO-SPEED Mac1 ---" << endl; 208 SetAccDec(fCosy->fMac1, 0.05, 0.05); 209 } 210 else 211 SetAccDec(fCosy->fMac1, fAcc, fDec); 204 const Double_t y = 15*fCosy->kGearTot.Y()/fCosy->kResSE.Y(); 205 206 // lout << "MPointing::SetPosition y: " << y << " rd.Az(): " << rd.Az() << endl; 207 // lout << "MPointing::SetPosition fCosy->kGearTot.Y(): " << fCosy->kGearTot.Y() << " fCosy->kResSE.Y(): " << fCosy->kResSE.Y() << endl; 208 209 if (rd.Az()>-y && rd.Az()<y) 210 { 211 //lout << "--- LO-SPEED Mac1 ---" << endl; 212 SetAccDec(fCosy->fMac1, 0.05, 0.05); 213 } 214 else 215 { 216 217 //lout << "MPointing::SetPosition SetAccDec Mac1: " << fAcc << fDec << endl; 218 219 SetAccDec(fCosy->fMac1, fAcc, fDec); 220 221 } 222 223 224 // new 16.05.05 F.G. 225 // SetAccDec(fCosy->fMac1, fAcc, fDec); 212 226 213 227 SetAccDec(fCosy->fMac2, fAcc, fDec); -
trunk/MagicSoft/Cosy/main/MStarguider.cc
r6842 r7230 70 70 IDM_kChannel1, 71 71 IDM_kChannel2, 72 IDM_kChannel3, 72 73 IDM_kContinous, 73 74 IDM_kRate25ps, … … 107 108 IDM_kStargCaosFilter, 108 109 IDM_kStargLEDFilter, 109 IDM_kStargFindStar 110 IDM_kStargFindStar, 111 IDM_kTPointAna, 112 IDM_kRoqueLampAna 110 113 111 114 }; … … 143 146 fChannel->AddEntry("Starfield Camera", IDM_kChannel1); 144 147 fChannel->AddEntry("TPoint Camera", IDM_kChannel2); 145 fChannel->CheckEntry(channel==0?IDM_kChannel1:IDM_kChannel2); 148 fChannel->AddEntry("Read from File", IDM_kChannel3); 149 if (channel<0) { 150 fChannel->CheckEntry(IDM_kChannel3); 151 } else { 152 fChannel->CheckEntry(channel==0?IDM_kChannel1:IDM_kChannel2); 153 } 146 154 fChannel->Associate(this); 147 155 fList->Add(fChannel); … … 170 178 fList->Add(fDisplay); 171 179 180 181 fOperations = new MGPopupMenu(p); 182 fOperations->AddEntry("TPoint Analysis", IDM_kTPointAna); 183 fOperations->AddEntry("Roque Lamp Analysis", IDM_kRoqueLampAna); 184 fOperations->Associate(this); 185 fList->Add(fOperations); 186 187 172 188 fFileType = new MGPopupMenu(p); 173 189 fFileType->AddEntry("PP&M", IDM_kPPM); … … 281 297 282 298 fMenu = new MGMenuBar(this, 0, 0, kHorizontalFrame); 283 fMenu->AddPopup("&Display", fDisplay, NULL); 284 fMenu->AddPopup("&WritePics", fWritePictures, NULL); 285 fMenu->AddPopup("&Setup", fSetup, NULL); 299 fMenu->AddPopup("&Display", fDisplay, NULL); 300 fMenu->AddPopup("&WritePics", fWritePictures, NULL); 301 fMenu->AddPopup("&Setup", fSetup, NULL); 302 303 fMenu->AddPopup("&Operations", fOperations, NULL); 304 286 305 fMenu->Resize(fMenu->GetDefaultSize()); 287 306 fMenu->BindKeys(this); … … 457 476 458 477 MStarguider::MStarguider(MObservatory::LocationName_t obs, Int_t channel) 459 : TGMainFrame(gClient->GetRoot(), 768, 840), fCosy(NULL), fOutTp(0), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2), fStatus(MDriveCom::kStandby) 478 : TGMainFrame(gClient->GetRoot(), 768, 840), 479 fCosy(NULL), 480 fOutTp(0), 481 fOutRq(0), 482 fDx((768-kZOOM)/2), 483 fDy((512-kZOOM)/2), 484 fStatus(MDriveCom::kStandby) 460 485 { 461 486 … … 517 542 if (fOutTp) 518 543 delete fOutTp; 544 545 if (fOutRq) 546 delete fOutRq; 519 547 520 548 cout << "Camera Display destroyed." << endl; … … 585 613 return kTRUE; 586 614 615 case IDM_kRoqueLampAna: 616 Toggle(fOperations, IDM_kRoqueLampAna); 617 // if (!fDisplay->IsEntryChecked(IDM_kCatalog)) 618 if (fOperations->IsEntryChecked(IDM_kRoqueLampAna)) { 619 fDisplay->CheckEntry(IDM_kStargCaosFilter); 620 } 621 else { 622 fDisplay->UnCheckEntry(IDM_kStargCaosFilter); 623 } 624 625 return kTRUE; 626 627 587 628 case IDM_kStargFindStar: 588 589 629 Toggle(fDisplay, IDM_kStargFindStar); 630 if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) { 590 631 fSZdAz->MapWindow(); 591 632 } else { … … 615 656 616 657 const Int_t ch0 = 617 fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1; 618 const Int_t ch1 = 0; 619 620 if (ch0!=ch1) 621 { 622 658 fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1; 659 const Int_t ch1 = 0; 660 661 if (ch0!=ch1) 662 { 623 663 delete fGetter; 624 664 usleep(150000); // FIX: Device or resource busy. 625 fGetter = new Camera(*this, ch1); 626 ((Camera*)fGetter)->Loop(0); 627 } 665 if (fChannel->IsEntryChecked(IDM_kChannel3)) { 666 fGetter=new PngReader(*this); 667 } else { 668 fGetter = new Camera(*this, ch1); 669 ((Camera*)fGetter)->Loop(0); 670 } 671 } 628 672 629 673 fChannel->CheckEntry(IDM_kChannel1); … … 854 898 delete fGetter; 855 899 usleep(150000); // FIX: Device or resource busy. 856 fGetter = new Camera(*this, ch1); 857 ((Camera*)fGetter)->Loop(0); 900 if (fChannel->IsEntryChecked(IDM_kChannel3)) 901 fGetter=new PngReader(*this); 902 else 903 { 904 fGetter = new Camera(*this, ch1); 905 ((Camera*)fGetter)->Loop(0); 906 } 858 907 } 859 908 return kTRUE; … … 1109 1158 } 1110 1159 1111 ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring ¢er, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0)1160 XY MStarguider::FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, Double_t cut, Double_t box, XY SearchCenter) 1112 1161 { 1113 1162 // Set search Paremeters (FIXME: Get them from user input!) … … 1117 1166 // Try to find Led in this area 1118 1167 Leds leds; 1119 f.FindStar(leds, (Int_t)center.GetX(), (Int_t)center.GetY()); 1168 f.FindStarCircle(leds, (Int_t)SearchCenter.X(), (Int_t)SearchCenter.Y()); 1169 1170 // Check whether star found 1171 Led *star = (Led*)leds.At(0); 1172 if (!star || leds.GetEntries()<1) 1173 return XY(.0,.0); 1174 1175 // cout << "Found Roque Lamp @ " << flush; 1176 star->Print(); 1177 f.MarkPoint(star->GetX(), star->GetY(), 500); 1178 1179 // cout << "RoquePos: " << star->GetX() << "," << star->GetY() << endl; 1180 1181 XY roquepos(star->GetX(), star->GetY()); 1182 XY relroquepos(roquepos.X()-CameraCenter.GetX(), roquepos.Y()-CameraCenter.GetY()); 1183 1184 // If no file open: open new Roque Lamp file 1185 if (!fOutRq) 1186 { 1187 const TString name = MCosy::GetFileName("tpoint/starg_roquelamp_%s.txt"); 1188 cout << "Starg_RoqueLamp File ********* " << name << " ********** " << endl; 1189 fOutRq = new ofstream(name); 1190 *fOutRq << "# Magic Roque Lamp file " << t << endl; 1191 } 1192 1193 1194 return relroquepos; 1195 } 1196 1197 1198 ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring ¢er, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0) 1199 { 1200 // Set search Paremeters (FIXME: Get them from user input!) 1201 f.SetCut(cut); // 3.5 1202 f.SetBox(box); // 70 1203 1204 // Try to find Led in this area 1205 Leds leds; 1206 f.FindStarCircle(leds, (Int_t)center.GetX(), (Int_t)center.GetY()); 1120 1207 1121 1208 // Check whether star found … … 1329 1416 pos = fCosy->GetPointingPos(); 1330 1417 center = fCaos->Run(img, printl, printr, pos, t, 50, 3.0); 1418 1419 cout << "Caos Filter Camera center position: " << center.GetX() << " " << center.GetY() << endl; 1420 1331 1421 } 1332 1422 … … 1390 1480 } 1391 1481 1482 // Find Roque Lamp 1483 1484 if (fOperations->IsEntryChecked(IDM_kRoqueLampAna)) { 1485 1486 XY roquelamp(0,0); 1487 1488 Double_t imageclean = 1.5; 1489 Double_t boxradius = 60; 1490 Double_t scalefactor = 1; 1491 XY searchcenter(768/2-1,576/2+25); 1492 1493 roquelamp = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter); 1494 1495 if (fOutRq) { 1496 ZdAz pos = fCosy->GetPointingPos(); 1497 1498 *fOutRq << "RoqueLampDirect: " << MTime(-1) << " " 1499 << pos.Zd() << " " << pos.Az() << " " 1500 << roquelamp.X() << " " << roquelamp.Y() << endl; 1501 } 1502 1503 cout << "Starguider Camera Center: " << sgcenter.GetX() << "," << sgcenter.GetY() << endl; 1504 cout << ">=>=>=> Roque Lamp found at: >=>=>=> (" << roquelamp.X() << "," 1505 << roquelamp.Y() << ") <=<=<=<" << endl; 1506 1507 } 1508 1509 // Find Spot on Camera Center in Starguider camera 1510 1511 if (fOperations->IsEntryChecked(IDM_kRoqueLampAna)) { 1512 1513 XY cameraspot(0,0); 1514 1515 Double_t imageclean = 5; 1516 Double_t boxradius = 60; 1517 Double_t scalefactor = 1; 1518 // XY searchcenter(sgcenter.GetX(),sgcenter.GetY()); 1519 XY searchcenter(60.,290.); 1520 1521 cameraspot = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter); 1522 1523 if (fOutRq) { 1524 ZdAz pos = fCosy->GetPointingPos(); 1525 1526 *fOutRq << "RoqueLampReflected: " << MTime(-1) << " " 1527 << pos.Zd() << " " << pos.Az() << " " 1528 << cameraspot.X() << " " << cameraspot.Y() << endl; 1529 } 1530 1531 cout << ">>>>> Spot on Magic camera found at: >>>>> (" << cameraspot.X() << "," 1532 << cameraspot.Y() << ") <<<<<" << endl; 1533 1534 f2.DrawCircle(sgcenter, 5.0, 0x0fa); 1535 f2.DrawCircle(sgcenter, 115.0, 0x0fa); 1536 1537 } 1538 1539 1540 1392 1541 // we calculate the offset given by the three ETH Leds visible to 1393 1542 // the guide camera … … 1451 1600 Leds spots; 1452 1601 f.SetBox(230); 1602 // f.SetCut(1.5); 1453 1603 double bright; 1454 1604 f.ExecuteAndMark(spots, 530, 292, bright); … … 1528 1678 if (fDisplay->IsEntryChecked(IDM_kCaosFilter) || 1529 1679 fDisplay->IsEntryChecked(IDM_kCatalog) || 1530 fDisplay->IsEntryChecked(IDM_kFindStar)) 1680 fDisplay->IsEntryChecked(IDM_kFindStar) || 1681 fOperations->IsEntryChecked(IDM_kRoqueLampAna)) 1531 1682 fImage->DrawColImg(img, cimg); 1532 1683 else -
trunk/MagicSoft/Cosy/main/MStarguider.h
r4865 r7230 67 67 MGPopupMenu *fChannel; 68 68 69 MGPopupMenu *fOperations; 70 69 71 MGPopupMenu *fCaosWrite; 70 72 MGPopupMenu *fCaosPrint; … … 104 106 105 107 ofstream *fOutTp; 108 ofstream *fOutRq; 106 109 107 110 Int_t fDx; … … 121 124 ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag) const; 122 125 bool Interpolate(const unsigned long n, byte *img) const; 126 127 XY FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, 128 Double_t cut, Double_t box, XY SearchCenter); 129 123 130 ZdAz FindStar(FilterLed &f, FilterLed &f2, Ring ¢er, MTime &t, 124 131 Double_t cut, Double_t box, Double_t scalefactor); -
trunk/MagicSoft/Cosy/main/MTracking.cc
r6930 r7230 244 244 ZdAz MTracking::GetPointingPosRE(Bool_t pdo) const 245 245 { 246 // Conversion factor from se to re 247 const XY re = fCosy->kGearTot/fCosy->kResSE; //[re/se] 248 249 Int_t pzd1 = fCosy->fZd1->GetPos(); 250 Int_t pzd2 = fCosy->fZd2->GetPos(); 251 Int_t paz = fCosy->fAz->GetPos(); 246 // Conversion factor from se to re 247 const XY re = fCosy->kGearTot/fCosy->kResSE; //[re/se] 248 249 const bool bool1 = fCosy->fZd1->DirHasChanged(); 250 const bool bool2 = fCosy->fZd2->DirHasChanged(); 251 252 if (bool1 && bool2) { 253 fCosy->fZd1->ResetDirHasChanged(); 254 fCosy->fZd2->ResetDirHasChanged(); 255 } 256 257 Int_t pzd1 = !bool1 ? fCosy->fZd1->GetPos() : fCosy->fZd1->GetDirChangedPos(); 258 Int_t pzd2 = !bool2 ? fCosy->fZd2->GetPos() : fCosy->fZd2->GetDirChangedPos(); 259 Int_t paz = fCosy->fAz->GetPos(); 260 261 // Get current shaftencoder position of the telescope 262 Double_t seposzd1 = ((pzd1+8192)%16384)*re.X(); 263 Double_t seposzd2 = ((pzd2+8192)%16384)*re.X(); 264 Double_t seposaz = paz *re.Y(); 265 266 // distance between (To+dt) and To [re] 267 // position time difference < 5usec 268 // fRePos does the synchronization between the 269 // Shaft- and the rotary encoders 270 const ZdAz repos = pdo ? fCosy->GetRePosPdo() : fCosy->GetRePos(); 271 272 const Int_t offset1 = !bool1 ? fCosy->fZd1->GetOffset() : fCosy->fZd1->GetDirChangedOffset(); 273 const Int_t offset2 = !bool2 ? fCosy->fZd2->GetOffset() : fCosy->fZd2->GetDirChangedOffset(); 274 275 // Calculate the part of one SE which the motors moved 276 // since the last SE has changed its value 277 const Double_t offzd1 = repos.Zd() - offset1; 278 const Double_t offzd2 = repos.Zd() - offset2; 279 const Double_t offaz = repos.Az() - fCosy->fAz->GetOffset(); 280 281 // Correct for the direction in which the motor is moving 282 // (in which the shaftencoders should change its values) 283 if (offaz<0) 284 seposaz += re.Y(); 285 if (offzd1<0) 286 seposzd1 += re.X(); 287 if (offzd2<0) 288 seposzd2 += re.X(); 289 290 // and interpolate the shaftencoder steps using the motor 291 // encoder positon (Be carefull the minus-sign is important) 292 seposzd1 += offzd1; 293 seposzd2 -= offzd2; 294 seposaz += offaz; 295 296 297 298 return ZdAz((seposzd1-seposzd2)/2, seposaz); 299 } 252 300 /* 253 301 if (fCosy->fZd1->DirHasChanged() != fCosy->fZd2->DirHasChanged()) … … 262 310 } 263 311 */ 264 // Get current shaftencoder position of the telescope265 Double_t seposzd1 = ((pzd1+8192)%16384)*re.X();266 Double_t seposzd2 = ((pzd2+8192)%16384)*re.X();267 Double_t seposaz = paz *re.Y();268 269 // distance between (To+dt) and To [re]270 // position time difference < 5usec271 // fRePos does the synchronization between the272 // Shaft- and the rotary encoders273 const ZdAz repos = pdo ? fCosy->GetRePosPdo() : fCosy->GetRePos();274 275 // Calculate the part of one SE which the motors moved276 // since the last SE has changed its value277 const Double_t offzd1 = repos.Zd() - fCosy->fZd1->GetOffset();278 const Double_t offzd2 = repos.Zd() - fCosy->fZd2->GetOffset();279 const Double_t offaz = repos.Az() - fCosy->fAz->GetOffset();280 281 // Correct for the direction in which the motor is moving282 // (in which the shaftencoders should change its values)283 if (offaz<0)284 seposaz += re.Y();285 if (offzd1<0)286 seposzd1 += re.X();287 if (offzd2<0)288 seposzd2 += re.X();289 290 // and interpolate the shaftencoder steps using the motor291 // encoder positon (Be carefull the minus-sign is important)292 seposzd1 += offzd1;293 seposzd2 -= offzd2;294 seposaz += offaz;295 296 return ZdAz((seposzd1-seposzd2)/2, seposaz);297 }298 312 299 313 void MTracking::TrackPosition(const RaDec &dst) // ra, dec [rad]
Note:
See TracChangeset
for help on using the changeset viewer.