Changeset 10024 for trunk


Ignore:
Timestamp:
10/21/10 11:23:44 (14 years ago)
Author:
tbretz
Message:
Finally fixed MTracking to get the tracking of celestial objects working.
Location:
trunk/Cosy
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosy/Changelog

    r10023 r10024  
    1212   * Makefile:
    1313     - added magic1 and magic2 rule to produce liks to the resource files
     14
     15   * main/MTracking.[h,cc]:
     16     - made MMoonPointing a data member to make sure the file is
     17       read only once
     18     - added a destructor to delete/close the file
     19     - set offsets only once when tracking isinitialized
     20     - added a lot of debug output in case of failure
     21     - some units fixes
     22     - moved setting the ra/dec for the starguider to the tracking
     23       main loop
     24     - retrieve the time after initializing the Slalib in the Thread
     25     - print a more helpful error message when UpdateSlalib in the
     26       Thread fails
     27
    1428
    1529
  • trunk/Cosy/main/MTracking.cc

    r9561 r10024  
    2525    fTrackAcc(0, 0), fWobbleOffset(-1), fWobbleAngle(0), fOut(0)
    2626{
     27    fMoon = new MMoonPointing("MoonShadowOffsets.root");
     28}
     29
     30MTracking::~MTracking()
     31{
     32    delete fMoon;
    2733}
    2834
     
    227233    if (fTrackType==(kEMoon|0x100))
    228234    {
    229         // FIXME: Read file only once!
    230         MMoonPointing moon("MoonShadowOffsets.root");
    231         if (moon.IsZombie())
     235        if (fMoon->IsZombie())
    232236        {
    233237            gLog << err << "ERROR - Could not initialize MMoonPointing." << endl;
     
    235239        }
    236240
    237         moon.SetOffsetShadow(TMath::DegToRad()*fWobbleAngle);
    238         moon.SetOffsetWobble(TMath::DegToRad()*fWobbleOffset);
     241        //moon.SetOffsetShadow(fWobbleAngle);
     242        //moon.SetOffsetWobble(fWobbleOffset);
     243
     244        const ZdAz za = sla.GetZdAzRad();
    239245
    240246        ZdAz srcpos, pointpos;
    241 
    242         const ZdAz za = sla.GetZdAzRad();
    243         if (!moon.CalcPosition(za, srcpos, pointpos))
     247        if (!fMoon->CalcPosition(za, srcpos, pointpos))
    244248        {
    245249            gLog << err << "ERROR - Calculation of moon shadow pointing position failed." << endl;
     250            gLog << "        WoAngle    =" << fWobbleAngle << endl;
     251            gLog << "        WoOffset   =" << fWobbleOffset << endl;
     252            gLog << "        TrackType  =" << fTrackType << endl;
     253            gLog << "        TT&0xff    =" << (fTrackType&0xff) << endl;
     254            gLog << "        mjd        =" << sla.GetMjd() << endl;
     255            gLog << "        za.Zd      =" << za.Zd() << endl;
     256            gLog << "        za.Az      =" << za.Az() << endl;
     257            gLog << "        srcpos.Zd  =" << srcpos.Zd() << endl;
     258            gLog << "        srcpos.Az  =" << srcpos.Az() << endl;
     259            gLog << "        pointpos.Zd=" << pointpos.Zd() << endl;
     260            gLog << "        pointpos.Az=" << pointpos.Az() << endl;
    246261            return kFALSE;
    247262        }
    248263
    249         sla.Set(pointpos);
     264        sla.Set(pointpos/TMath::DegToRad());
     265
     266//        return kTRUE;
     267
     268        //RaDec rd = sla.GetRaDec();
     269        //ZdAz  zd = sla.GetZdAz();
    250270
    251271        // Ra/Dec, Zd/Az from pointpos
     
    263283        }
    264284        */
    265     //    if (fCosy->fStarguider)
    266     //        fCosy->fStarguider->SetPointingPosition(sla.GetRaDec());
     285    return kTRUE;
    267286}
    268287
     
    275294    fCosy->fRaDec     = fSlalib.GetRaDecRad();
    276295    fCosy->fHourAngle = fSlalib.GetHourAngle();
     296
     297    return kTRUE;
    277298}
    278299
     
    290311
    291312    if (fTrackType>=0)
    292        gLog << all << fSlalib.GetTime() << ": Tracking Planet with Id " << fTrackType << endl;
     313       gLog << all << fSlalib.GetTime() << ": Tracking Planet with Id " << fTrackType << " (" << fWobbleOffset << ", " << fWobbleAngle << ")" << endl;
    293314    gLog << all << fSlalib.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl;
    294315
     
    321342    fTrackType = -1;
    322343
     344    // Just for convenience
     345    fMoon->SetOffsetShadow(0);
     346    fMoon->SetOffsetWobble(0);
     347
    323348    // Start tracking
    324349    Track();
     
    330355    fTrackType = planet;
    331356
     357    // Just for convenience
     358    fMoon->SetOffsetShadow(0);
     359    fMoon->SetOffsetWobble(0);
     360
    332361    // Start tracking
    333362    Track();
     
    341370    fWobbleOffset = TMath::DegToRad()*wobble;
    342371    fWobbleAngle  = TMath::DegToRad()*offset;
     372
     373    fMoon->SetOffsetShadow(fWobbleAngle);
     374    fMoon->SetOffsetWobble(fWobbleOffset);
    343375
    344376    // Start tracking
     
    473505            break;
    474506
     507        // Now the tracking procedure is finished and we have some time
     508        // left to set the nominal pointing position for the starguider
     509        // if available. This should be thread safe. Doing this in
     510        // UpdateSlalib would also update it from the Thread
     511        // which leads to problems.
     512        if (fCosy->fStarguider)
     513            fCosy->fStarguider->SetPointingPosition(fSlalib.GetRaDec());
     514
    475515        //
    476516        // Update speed as often as possible.
     
    513553    //SlaPlanets sla(fSlalib.GetObservatoryKey());
    514554    SlaPlanets sla(MObservatory::kMagic1);
    515 
    516     UpdateSlalib(sla);
     555    sla.Now();
     556
     557    if (!UpdateSlalib(sla))
     558        gLog << err << "UpdateSlalib in Thread failed." << endl;
    517559
    518560    //
  • trunk/Cosy/main/MTracking.h

    r9559 r10024  
    1717class RaDec;
    1818class SlaStars;
     19class MMoonPointing;
    1920
    2021class MTracking : public MSlewing, public MThread
     
    3233
    3334    MLog   *fOut;
     35
     36    MMoonPointing *fMoon;
    3437
    3538    Bool_t UpdateSlalib(SlaPlanets &sla);
     
    4952public:
    5053    MTracking(MCosy *cosy);
     54    ~MTracking();
    5155
    5256    void TrackPosition(const RaDec &dst); // ra, dec [rad]
Note: See TracChangeset for help on using the changeset viewer.