Ignore:
Timestamp:
08/22/05 10:46:31 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
2 edited

Legend:

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

    r7230 r7297  
    498498    fStargCaos = new MCaos;
    499499    fStargCaos->ReadResources("stargleds.txt");
    500     fStargCaos->SetMinNumberRings(2);
     500    fStargCaos->SetMinNumberRings(3);
    501501    fStargCaos->SetRadii(158,164);
    502502
     
    12061206    f.FindStarCircle(leds, (Int_t)center.GetX(), (Int_t)center.GetY());
    12071207
     1208    if (leds.GetEntries()<0)
     1209        return ZdAz(0, 0);
     1210
    12081211    // Check whether star found
    12091212    Led *star = (Led*)leds.At(0);
    1210     if (!star || leds.GetEntries()<1)
     1213    if (!star)
    12111214        return ZdAz(.0,.0);
    12121215
  • trunk/MagicSoft/Cosy/main/MTracking.cc

    r7230 r7297  
    247247     const XY re = fCosy->kGearTot/fCosy->kResSE; //[re/se]
    248248
     249     // Check wether moving direction has changed
    249250     const bool bool1 = fCosy->fZd1->DirHasChanged();
    250251     const bool bool2 = fCosy->fZd2->DirHasChanged();
    251252
    252      if (bool1 && bool2) {
    253        fCosy->fZd1->ResetDirHasChanged();
    254        fCosy->fZd2->ResetDirHasChanged();
     253     // If both directions have changed reset the flags
     254     if (bool1 && bool2)
     255     {
     256         fCosy->fZd1->ResetDirHasChanged();
     257         fCosy->fZd2->ResetDirHasChanged();
    255258     }
    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  
     259
     260     // Get shaftencoder positions
     261     // Ignore the shaftencoder which has not yet changed its value
     262     const Int_t pzd1 = fCosy->fZd1->GetPosDirCorrected();
     263     const Int_t pzd2 = fCosy->fZd2->GetPosDirCorrected();
     264     const Int_t paz  = fCosy->fAz->GetPos();
     265
    261266     // Get current shaftencoder position of the telescope
    262267     Double_t seposzd1 = ((pzd1+8192)%16384)*re.X();
    263268     Double_t seposzd2 = ((pzd2+8192)%16384)*re.X();
    264269     Double_t seposaz  =   paz              *re.Y();
    265  
     270
    266271     // distance between (To+dt) and To [re]
    267272     // position time difference < 5usec
     
    269274     // Shaft- and the rotary encoders
    270275     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  
     276
     277     // Get rotary encoder positions
     278     // Get stored offset if one SE has not changed its direction yet
     279     const Int_t offset1 = fCosy->fZd1->GetOffsetDirCorrected();
     280     const Int_t offset2 = fCosy->fZd2->GetOffsetDirCorrected();
     281
    275282     // Calculate the part of one SE which the motors moved
    276283     // since the last SE has changed its value
     
    278285     const Double_t offzd2 = repos.Zd() - offset2;
    279286     const Double_t offaz  = repos.Az() - fCosy->fAz->GetOffset();
    280  
     287
    281288     // Correct for the direction in which the motor is moving
    282289     // (in which the shaftencoders should change its values)
     
    287294     if (offzd2<0)
    288295         seposzd2 += re.X();
    289  
     296
     297     // If the correction exceeds one shaftencoder step stop interpolation
     298     // of shaftencoder positions using rotary encoder values.
     299     //ofstream fout("offsets.log", ios::app);
     300     //fout << MTime(-1) << " " << offaz << " " << offzd1 << " " << offzd2 << endl;
     301     /*
     302      if (TMath::Abs(offaz)>re.Y())
     303         offaz = TMath::Sign(re.Y(), offaz);
     304      if (TMath::Abs(offzd1)>re.X())
     305         offzd1 = TMath::Sign(re.X(), offzd1);
     306      if (TMath::Abs(offzd2)>re.X())
     307         offzd2 = TMath::Sign(re.X(), offzd2);
     308         */
     309
    290310     // and interpolate the shaftencoder steps using the motor
    291311     // encoder positon (Be carefull the minus-sign is important)
     
    293313     seposzd2 -= offzd2;
    294314     seposaz  += offaz;
    295  
    296 
    297315
    298316     return ZdAz((seposzd1-seposzd2)/2, seposaz);
    299317}
    300 /*
    301     if (fCosy->fZd1->DirHasChanged() != fCosy->fZd2->DirHasChanged())
    302     {
    303         pzd1 -= fCosy->fZd1->GetDirection();
    304         pzd2 -= fCosy->fZd2->GetDirection();
    305     }
    306     else
    307     {
    308         fCosy->fZd1->ResetDirHasChanged();
    309         fCosy->fZd2->ResetDirHasChanged();
    310     }
    311   */
    312318
    313319void MTracking::TrackPosition(const RaDec &dst) // ra, dec [rad]
Note: See TracChangeset for help on using the changeset viewer.