Ignore:
Timestamp:
07/28/05 22:24:32 (20 years ago)
Author:
fgoebel
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r6841 r7230  
    397397//    point.SetVelocity(0.2); // fast: 0.6, slow: 0.2
    398398//#else
     399
     400// original settings
     401//
    399402    point.SetPointAccDec(0.2, 0.1);
    400403    point.SetPointVelocity(0.1);
     404
     405
    401406//#endif
    402407
     408//    point.SetPointAccDec(0.4, 0.4);
     409//    point.SetPointVelocity(0.4);
     410
     411
     412// original
    403413    return point.SetPosition(dst, track);
     414
     415// test
     416//    return point.SetPosition(dst, kTRUE);
     417
     418
     419
    404420}
    405421
     
    422438//    track.SetPointVelocity(0.2); // fast: 0.6, slow: 0.2
    423439//#else
     440
     441
     442
    424443    track.SetPointAccDec(0.2, 0.1);
    425444    track.SetPointVelocity(0.1);
     445
     446    //    track.SetPointAccDec(0.4, 0.4);
     447    // track.SetPointVelocity(0.4);
     448
     449
     450
    426451//#endif
    427452    track.SetTrackAccDec(0.1, 0.1);
     
    438463//    track.SetPointVelocity(0.2); // fast: 0.6, slow: 0.2
    439464//#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);
    442467//#endif
    443468    track.SetTrackAccDec(0.1, 0.1);
  • trunk/MagicSoft/Cosy/main/MPointing.cc

    r4106 r7230  
    202202        else
    203203        {
    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);
    212226
    213227            SetAccDec(fCosy->fMac2, fAcc, fDec);
  • trunk/MagicSoft/Cosy/main/MStarguider.cc

    r6842 r7230  
    7070    IDM_kChannel1,
    7171    IDM_kChannel2,
     72    IDM_kChannel3,
    7273    IDM_kContinous,
    7374    IDM_kRate25ps,
     
    107108    IDM_kStargCaosFilter,
    108109    IDM_kStargLEDFilter,
    109     IDM_kStargFindStar
     110    IDM_kStargFindStar,
     111    IDM_kTPointAna,
     112    IDM_kRoqueLampAna
    110113
    111114};
     
    143146    fChannel->AddEntry("Starfield Camera", IDM_kChannel1);
    144147    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    }
    146154    fChannel->Associate(this);
    147155    fList->Add(fChannel);
     
    170178    fList->Add(fDisplay);
    171179
     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
    172188    fFileType = new MGPopupMenu(p);
    173189    fFileType->AddEntry("PP&M", IDM_kPPM);
     
    281297
    282298    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
    286305    fMenu->Resize(fMenu->GetDefaultSize());
    287306    fMenu->BindKeys(this);
     
    457476
    458477MStarguider::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)
    460485{
    461486   
     
    517542    if (fOutTp)
    518543        delete fOutTp;
     544
     545    if (fOutRq)
     546        delete fOutRq;
    519547
    520548    cout << "Camera Display destroyed." << endl;
     
    585613                return kTRUE;
    586614
     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
    587628           case IDM_kStargFindStar:
    588                 Toggle(fDisplay, IDM_kStargFindStar);         
    589                 if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) {
     629                Toggle(fDisplay, IDM_kStargFindStar);         
     630                if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) {
    590631                    fSZdAz->MapWindow();
    591632                } else {
     
    615656
    616657                    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                      {
    623663                        delete fGetter;
    624664                        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                      }
    628672
    629673                    fChannel->CheckEntry(IDM_kChannel1);
     
    854898                    delete fGetter;
    855899                    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                      }
    858907                }
    859908                return kTRUE;
     
    11091158}
    11101159
    1111 ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0)
     1160XY MStarguider::FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, Double_t cut, Double_t box, XY SearchCenter)
    11121161{
    11131162    // Set search Paremeters (FIXME: Get them from user input!)
     
    11171166    // Try to find Led in this area
    11181167    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
     1198ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, 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());
    11201207
    11211208    // Check whether star found
     
    13291416            pos = fCosy->GetPointingPos();
    13301417        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
    13311421    }
    13321422
     
    13901480    }
    13911481
     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
    13921541    // we calculate the offset given by the three ETH Leds visible to
    13931542    // the guide camera
     
    14511600            Leds spots;
    14521601            f.SetBox(230);
     1602//          f.SetCut(1.5);
    14531603            double bright;
    14541604            f.ExecuteAndMark(spots, 530, 292, bright);
     
    15281678    if (fDisplay->IsEntryChecked(IDM_kCaosFilter) ||
    15291679        fDisplay->IsEntryChecked(IDM_kCatalog)    ||
    1530         fDisplay->IsEntryChecked(IDM_kFindStar))
     1680        fDisplay->IsEntryChecked(IDM_kFindStar)   ||
     1681        fOperations->IsEntryChecked(IDM_kRoqueLampAna))
    15311682        fImage->DrawColImg(img, cimg);
    15321683    else
  • trunk/MagicSoft/Cosy/main/MStarguider.h

    r4865 r7230  
    6767    MGPopupMenu   *fChannel;
    6868
     69    MGPopupMenu   *fOperations;
     70
    6971    MGPopupMenu   *fCaosWrite;
    7072    MGPopupMenu   *fCaosPrint;
     
    104106
    105107    ofstream *fOutTp;
     108    ofstream *fOutRq;
    106109
    107110    Int_t fDx;
     
    121124    ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag) const;
    122125    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
    123130    ZdAz FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t,
    124131                  Double_t cut, Double_t box, Double_t scalefactor);
  • trunk/MagicSoft/Cosy/main/MTracking.cc

    r6930 r7230  
    244244ZdAz MTracking::GetPointingPosRE(Bool_t pdo) const
    245245{
    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}
    252300/*
    253301    if (fCosy->fZd1->DirHasChanged() != fCosy->fZd2->DirHasChanged())
     
    262310    }
    263311  */
    264     // Get current shaftencoder position of the telescope
    265     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 < 5usec
    271     // fRePos does the synchronization between the
    272     // Shaft- and the rotary encoders
    273     const ZdAz repos = pdo ? fCosy->GetRePosPdo() : fCosy->GetRePos();
    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() - 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 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     return ZdAz((seposzd1-seposzd2)/2, seposaz);
    297 }
    298312
    299313void MTracking::TrackPosition(const RaDec &dst) // ra, dec [rad]
Note: See TracChangeset for help on using the changeset viewer.