Ignore:
Timestamp:
07/15/03 15:05:21 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
4 added
4 edited

Legend:

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

    r2019 r2278  
    1818
    1919#include "MGCosy.h"
     20#include "MStarguider.h"
    2021#include "SlaStars.h"
    2122
     
    330331{
    331332    // FIXME, what when waiting times out (Zombie)
     333    if (!fMac1 || !fMac2)
     334        return;
    332335
    333336    while ((fMac1->IsPositioning() || fMac2->IsPositioning()) &&
     
    428431    const ZdAz d = dst*kRad2Deg;
    429432
    430     lout << "Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl;
     433    Timer t;
     434    t.Now();
     435    lout << t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl;
    431436
    432437    if (!CheckRange(d))
     
    504509        if (!cdzd && !cdaz)
    505510        {
    506             lout << "Positioning done in " << i << (i==1?" step.":" steps.") << endl;
     511            t.Now();
     512            lout << t << " - Positioning done in " << i << (i==1?" step.":" steps.") << endl;
    507513            SetStatus(MCosy::kStopped);
    508514            return TRUE;
     
    577583        // repositioning (relative)
    578584        //
    579         lout << "Do Relative Positioning Done" << endl;
     585
     586        lout << "Do Relative Positioning..." << endl;
    580587        DoRelPos(rd, cdzd, cdaz);
    581 
    582588        lout << "Relative Positioning Done" << endl;
    583589    }
     
    588594        SetStatus(MCosy::kStopped);
    589595
    590     lout << "Warning: Requested position not reached (i=" << i << ")" << endl;
     596    t.Now();
     597    lout << t << " - Warning: Requested position not reached (i=" << i << ")" << endl;
    591598    return FALSE;
    592599}
     
    692699    // is 25% of the |v|
    693700    //
    694     const Float_t limit    = 0.25;
     701    //const Float_t limit    = 0.25;
    695702
    696703    //
     
    721728    }
    722729    */
    723 
     730   /*
    724731    if (sgn(vt->Az()) != sgn(vcalc.Az())
    725732        && fabs(vt->Az()) < limit*fabs(vcalc.Az())
     
    729736            vt->Az(0);
    730737        }
    731     else
     738    else*/
    732739        if (fabs(vt->Az()) > maxtrack*vraz)
    733740        {
     
    735742            vt->Az(maxtrack*vraz*sgn(vcalc.Az()));
    736743        }
    737 
     744/*
    738745    if (sgn(vt->Zd()) != sgn(vcalc.Zd())
    739746        && fabs(vt->Zd()) < limit*fabs(vcalc.Zd())
     
    744751        }
    745752    else
    746         if (fabs(vt->Zd()) > maxtrack*vrzd)
     753 */       if (fabs(vt->Zd()) > maxtrack*vrzd)
    747754        {
    748755            lout << "Warning: Altitude speed limit (" << maxtrack*100 << "%) exceeded... limited." << endl;
     
    880887    XY xy(Rad2Deg(dst.Ra())*24/360, Rad2Deg(dst.Dec()));
    881888
    882     lout << "Start tracking:";
     889    sla.Now();
     890    lout << sla << " - Start tracking:";
    883891    lout << " Ra: " << xy.X() << "h  " << "Dec: " << xy.Y() << "\xb0" << endl;
    884 #ifdef EXPERT
     892/*#ifdef EXPERT
    885893    ofstream fout("coordinates.txt");
    886894    fout << xy;
    887895    fout.close();
    888896#endif
    889     //
     897*/    //
    890898    // Initialize Tracker (slalib or starguider)
    891899    //
     
    10141022    }
    10151023
     1024    sla.Now();
     1025
    10161026    fBackground = kBgdNone;
    10171027    StopMovement();
    1018     lout << "Tracking stopped." << endl;
     1028
     1029    lout << sla << " - Tracking stopped." << endl;
    10191030}
    10201031
     
    10371048    //
    10381049    cout << "Stopping movement (dec=30%)..." << endl;
     1050    if (fMac1 && fMac2)
     1051    {
    10391052#ifdef EXPERT
    1040     fMac1->SetDeceleration(0.5*fMac1->GetVelRes());
    1041     fMac2->SetDeceleration(0.5*fMac2->GetVelRes());
     1053        fMac1->SetDeceleration(0.5*fMac1->GetVelRes());
     1054        fMac2->SetDeceleration(0.5*fMac2->GetVelRes());
    10421055#else
    1043     fMac1->SetDeceleration(0.3*fMac1->GetVelRes());
    1044     fMac2->SetDeceleration(0.3*fMac2->GetVelRes());
     1056        fMac1->SetDeceleration(0.3*fMac1->GetVelRes());
     1057        fMac2->SetDeceleration(0.3*fMac2->GetVelRes());
    10451058#endif
    1046     fMac1->SetRpmMode(FALSE);
    1047     fMac2->SetRpmMode(FALSE);
     1059        fMac1->SetRpmMode(FALSE);
     1060        fMac2->SetRpmMode(FALSE);
     1061    }
    10481062
    10491063/*
     
    12011215        return (void*)0xaffe;
    12021216        */
    1203 #ifdef EXPERT
    12041217    case WM_TPOINT:
    12051218        {
     
    12221235            cout << "     SE-Pos: " << za.Alt() << "° " << za.Az() << "°" << endl;
    12231236            *tpout << fmod(za.Az()+360, 360) << " " << za.Alt() << " ";
     1237
     1238            if (fStarguider)
     1239            {
     1240                XY tp = fStarguider->GetCoordinates();
     1241                *tpout << 90-tp.X() << " " << tp.Y() << " ";
     1242            }
     1243
    12241244            *tpout << rd.Ra()/15 << " " << rd.Dec() << " " << setprecision(11) << sla.GetMjd() << endl;
    12251245
     
    12271247        }
    12281248        return (void*)0xca1b;
    1229 #endif
    12301249
    12311250    case WM_TRACKPOS:
     
    12831302        cout << "WM_Track: START" << endl;
    12841303        {
     1304            RaDec dest = ((RaDec*)mp)[0];
     1305            if (fStarguider)
     1306                fStarguider->SetPointingPosition(((RaDec*)mp)[1]);
    12851307            if (!CheckNetwork())
    12861308                return (void*)0xebb0;
    1287 
    1288             RaDec dest = *((RaDec*)mp);
    12891309            TrackPosition(dest*kDeg2Rad);
    12901310        }
     
    13521372            RaDec rd(xy.X()*15., xy.Y()); // [deg]
    13531373
    1354             const ZdAz a0 = sla.CalcZdAz(rd*kDeg2Rad);
    1355 
    1356             ZdAz a1;
    1357             AlignTrackingPos(a0, a1);
    1358             a1 *= 180/TMath::Pi();
    1359 
    1360             const ZdAz a2 = a1*16384/360;
    1361             const ZdAz se = a0*16384/360;
     1374            ZdAz a1 = sla.CalcZdAz(rd*kDeg2Rad); // [rad]
     1375            const ZdAz a0 = a1*kRad2Deg;               // [deg]
    13621376
    13631377            cout << "Ra/Dec source: " << xy.X()  << "h " << xy.Y()  << "°" << endl;
    13641378            cout << "Zd/Az target:  " << a0.Zd() << "° " << a0.Az() << "°" << endl;
     1379
     1380            if (fZd1 && fZd2 && fAz)
     1381                AlignTrackingPos(a0, a1);
     1382
     1383            a1 = fBending(a1)*kRad2Deg;
     1384
     1385            const ZdAz a2 = a1*16384/360;
     1386
    13651387            cout << "Zd/Az bended:  " << a1.Zd() << "° " << a1.Az() << "°" << endl;
    1366             cout << "SE target:     " << se.Zd() << "  " << se.Az() << endl;
    13671388            cout << "SE bended:     " << a2.Zd() << "  " << a2.Az() << endl;
    13681389        }
     
    17811802}
    17821803
     1804ZdAz MCosy::GetPointingPos() const
     1805{
     1806    // GetPointingPos [deg]
     1807    const ZdAz seist = GetSePos()*2*TMath::Pi()/16384; // [se]
     1808    return fBending.CorrectBack(seist)*180/TMath::Pi();
     1809}
     1810
    17831811Bool_t MCosy::HandleTimer(TTimer *t)
    17841812{
     
    17931821        fAz->DisplayVal();
    17941822
    1795     ZdAz seist = GetSePos()*2*TMath::Pi()/16384; // [se]
    1796     ZdAz bendist = fBending.CorrectBack(seist);
     1823    ZdAz bendist = GetPointingPos();
    17971824
    17981825    Byte_t avail = 0;
     
    18101837    lout.UpdateGui();
    18111838
    1812     fWin->Update(bendist*(360.0/2/TMath::Pi()), fTrackingError,
    1813                  fVelocity, fOffset, fRaDec, fZdAzSoll, fStatus, avail);
     1839    fWin->Update(bendist, fTrackingError, fVelocity, /*fOffset,*/
     1840                 fRaDec, fZdAzSoll, fStatus, avail);
    18141841
    18151842    const Bool_t trigger = fTriggerDisplay;
     
    20762103
    20772104MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out)
    2078 : Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone)
     2105: Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(kStopped)
    20792106{
    20802107    TEnv env(".cosyrc");
     
    21092136    fZd2->SetDisplay(fWin->GetLabel3());
    21102137    fAz->SetDisplay(fWin->GetLabel1());
    2111 #ifdef EXPERT
     2138
    21122139    int i=0;
    21132140    char name[100];
     
    21302157    *tpout << time.Year() << " " << time.Month() << " " << time.Day() << " ";
    21312158    *tpout << /*"20 1013.25 300 0.5 0.55 0.0065" <<*/ endl;
    2132 #endif
    21332159    // temp(°C) pressure(mB) height(m) humidity(1) wavelength(microm) troplapserate(K/m)
    21342160}
     
    21562182MCosy::~MCosy()
    21572183{
    2158 #ifdef EXPERT
    21592184    *tpout << "END" << endl;
     2185    //streampos size = tpout.tellp();
    21602186    delete tpout;
    2161 #endif
    21622187
    21632188    cout << "Deleting GUI timer." << endl;
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r2019 r2278  
    3636class MCosy;
    3737class TH1;
     38class MStarguider;
    3839
    3940class MTTalk : public MThread
     
    7172    const MObservatory::LocationName_t fObservatory;
    7273
     74    MStarguider *fStarguider;
     75
    7376    ShaftEncoder *fZd1;
    7477    ShaftEncoder *fZd2;
     
    187190    Bool_t HandleTimer(TTimer *t);
    188191
     192    ZdAz GetPointingPos(void) const;
     193    void SetStarguider(MStarguider *s) { fStarguider = s; }
     194 
    189195    // static ZdAz CorrectTarget(const ZdAz &src, const ZdAz &dst);
    190196    //    static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0));
  • trunk/MagicSoft/Cosy/main/MainLinkDef.h

    r1393 r2278  
    66
    77#pragma link C++ class MCosy;
     8#pragma link C++ class MStarguider+;
    89
    910#pragma link C++ class MBending;
  • trunk/MagicSoft/Cosy/main/Makefile

    r1758 r2278  
    2121
    2222INCLUDES = -I. -I../base -I.. -I../gui -I../catalog -I../devdrv \
    23            -I../candrv -I../incl -I../videodev
     23           -I../candrv -I../incl -I../videodev -I../caos
    2424
    2525# @code
     
    3232.SUFFIXES: .c .cc .cxx .h .hxx .o
    3333
    34 SRCFILES = MCosy.cc \
    35            MBending.cc
     34SRCFILES = MBending.cc \
     35           MStarguider.cc \
     36           MCaos.cc \
     37           MCosy.cc
    3638
    3739SRCS        = $(SRCFILES)
Note: See TracChangeset for help on using the changeset viewer.