Ignore:
Timestamp:
04/12/03 19:06:27 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.cc

    r1819 r1953  
    246246    //
    247247    // calculate actual time for planet positions
     248    // acc [deg]
    248249    //
    249250    static int X = ~0;
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r1793 r1953  
    3232
    3333#undef DEBUG
     34#define EXPERT
    3435
    3536ClassImp(MGCosy);
     
    4445    kPB_TRACK,
    4546    kPB_STOP,
    46     kPB_HOME,
     47    kPB_TRACKPOS,
    4748    kPB_CALCALTAZ,
    4849    kPB_TPOINT,
     
    126127    fList->Add(l);
    127128
    128     fLabel1 = new TGLabel*[3];
    129     fLabel1[0] = new TGLabel(f, "00000"); // Max: 16384
    130     fLabel1[1] = new TGLabel(f, "000");   // Max: 256
    131     fLabel1[2] = new TGLabel(f, "000");   // Max: 256
    132     fLabel1[0]->SetTextJustify(kTextRight);
    133     fLabel1[1]->SetTextJustify(kTextRight);
    134     fLabel1[2]->SetTextJustify(kTextRight);
    135     fLabel1[0]->Move(x,    y+40);
    136     fLabel1[1]->Move(x+43, y+40);
    137     fLabel1[2]->Move(x+70, y+40);
    138     fList->Add(fLabel1[0]);
    139     fList->Add(fLabel1[1]);
    140     fList->Add(fLabel1[2]);
    141     //f->AddFrame(fLabel1[0]);
    142     //f->AddFrame(fLabel1[1]);
    143     //f->AddFrame(fLabel1[2]);
    144 
    145     fLabel2 = new TGLabel*[3];
    146     fLabel2[0] = new TGLabel(f, "00000");
    147     fLabel2[1] = new TGLabel(f, "000");
    148     fLabel2[2] = new TGLabel(f, "000");
    149     fLabel2[0]->SetTextJustify(kTextRight);
    150     fLabel2[1]->SetTextJustify(kTextRight);
    151     fLabel2[2]->SetTextJustify(kTextRight);
    152     fLabel2[0]->Move(x,    y+57);
    153     fLabel2[1]->Move(x+43, y+57);
    154     fLabel2[2]->Move(x+70, y+57);
    155     fList->Add(fLabel2[0]);
    156     fList->Add(fLabel2[1]);
    157     fList->Add(fLabel2[2]);
    158     //f->AddFrame(fLabel2[0]);
    159     //f->AddFrame(fLabel2[1]);
    160     //f->AddFrame(fLabel2[2]);
    161 
    162     fLabel3 = new TGLabel*[3];
    163     fLabel3[0] = new TGLabel(f, "00000");
    164     fLabel3[1] = new TGLabel(f, "000");
    165     fLabel3[2] = new TGLabel(f, "000");
    166     fLabel3[0]->SetTextJustify(kTextRight);
    167     fLabel3[1]->SetTextJustify(kTextRight);
    168     fLabel3[2]->SetTextJustify(kTextRight);
    169     fLabel3[0]->Move(x,    y+74);
    170     fLabel3[1]->Move(x+43, y+74);
    171     fLabel3[2]->Move(x+70, y+74);
    172     fList->Add(fLabel3[0]);
    173     fList->Add(fLabel3[1]);
    174     fList->Add(fLabel3[2]);
    175     //f->AddFrame(fLabel3[0]);
    176     //f->AddFrame(fLabel3[1]);
    177     //f->AddFrame(fLabel3[2]);
     129    fLabel1 = new TGLabel(f, "00000"); // Max: 16384
     130    fLabel2 = new TGLabel(f, "00000");
     131    fLabel3 = new TGLabel(f, "00000");
     132    fLabel1->SetTextJustify(kTextRight);
     133    fLabel2->SetTextJustify(kTextRight);
     134    fLabel3->SetTextJustify(kTextRight);
     135    fLabel1->Move(x, y+40);
     136    fLabel2->Move(x, y+57);
     137    fLabel3->Move(x, y+74);
     138    fList->Add(fLabel1);
     139    fList->Add(fLabel2);
     140    fList->Add(fLabel3);
    178141
    179142    l = new TGLabel(f, "Offset-Zd:");
     
    250213    fAvailMac1 = new TGLabel(f, "- MAC1 -");
    251214    fAvailMac2 = new TGLabel(f, "- MAC2 -");
    252     fAvailMac3 = new TGLabel(f, "- MAC3 -");
     215    //fAvailMac3 = new TGLabel(f, "- MAC3 -");
    253216    fAvailSe1  = new TGLabel(f, "-SE/Zd1-");
    254217    fAvailSe2  = new TGLabel(f, "-SE/Zd2-");
     
    261224    fAvailMac1->SetBackgroundColor(color);
    262225    fAvailMac2->SetBackgroundColor(color);
    263     fAvailMac3->SetBackgroundColor(color);
     226    //fAvailMac3->SetBackgroundColor(color);
    264227    fAvailSe1->SetBackgroundColor(color);
    265228    fAvailSe2->SetBackgroundColor(color);
     
    281244    fAvailMac1->Move(10, 25+120);
    282245    fAvailMac2->Move(10, 25+140);
    283     fAvailMac3->Move(10, 25+160);
     246    //fAvailMac3->Move(10, 25+160);
    284247    fAvailSe1->Move(10, 25+180);
    285248    fAvailSe2->Move(10, 25+200);
     
    293256    fAvailMac1->Resize(60, 20);
    294257    fAvailMac2->Resize(60, 20);
    295     fAvailMac3->Resize(60, 20);
     258    //fAvailMac3->Resize(60, 20);
    296259    fAvailSe1->Resize(60, 20);
    297260    fAvailSe2->Resize(60, 20);
     
    305268    fList->Add(fAvailMac1);
    306269    fList->Add(fAvailMac2);
    307     fList->Add(fAvailMac3);
     270    //fList->Add(fAvailMac3);
    308271    fList->Add(fAvailSe1);
    309272    fList->Add(fAvailSe2);
     
    332295
    333296    int i=0;
    334     while (!fin.eof())
     297    while (1)
    335298    {
    336299        TString str;
    337300        Double_t zd, az;
    338301        fin >> str >> zd >> az;
     302        if (!fin)
     303            break;
    339304        box->AddEntry(str, i++);
    340305
     
    347312    TGCompositeFrame *tf1 = fTab->AddTab("Position");
    348313    TGCompositeFrame *tf2 = fTab->AddTab("Track");
     314#ifdef EXPERT
    349315    TGCompositeFrame *tf4 = fTab->AddTab("Calib");
    350316    TGCompositeFrame *tf5 = fTab->AddTab("Test SE");
    351317    TGCompositeFrame *tf6 = fTab->AddTab("Gear");
    352     /*TGCompositeFrame *tf3 =*/ fTab->AddTab("Demo");
     318#endif
     319    /*TGCompositeFrame *tf3 =*/// fTab->AddTab("Demo");
    353320
    354321    fCZdAz = new MGCoordinates(tf1, kETypeZdAz);
     
    362329    fList->Add(fCRaDec);
    363330
     331#ifdef EXPERT
    364332    fCCalib = new MGCoordinates(tf4, kETypeRaDec);
    365333    fCCalib->Move(27, 105);
    366334    fList->Add(fCCalib);
     335#endif
    367336
    368337    const int x=15;
     
    372341    TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in");
    373342    TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates");
    374     TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates, which means that the");
    375     TGLabel *l4 = new TGLabel(tf1, "coordinates are corrected for the bending of");
    376     TGLabel *l5 = new TGLabel(tf1, "the telescope.");
     343    TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates. Enter the coordinates");
     344    TGLabel *l4 = new TGLabel(tf1, "manually or choose a predefined position");
     345    TGLabel *l5 = new TGLabel(tf1, "from the combobox below.");
    377346    l1->Move(x, y);
    378347    l2->Move(x, y+h);
     
    396365    fList->Add(l3);
    397366
     367#ifdef EXPERT
    398368    l1 = new TGLabel(tf4, "Start the calibration using the Start button.");
    399369    l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using");
    400     l3 = new TGLabel(tf4, "the TPoint button. To set the Shaftencoder offset");
    401     l4 = new TGLabel(tf4, "use the Calib SE button.");
     370    l3 = new TGLabel(tf4, "the TPoint button.");
     371    //l3 = new TGLabel(tf4, "the TPoint button. To set the Shaftencoder offset");
     372    //l4 = new TGLabel(tf4, "use the Calib SE button.");
    402373    l1->Move(x, y);
    403374    l2->Move(x, y+h);
     
    425396    l1->Move(x, y);
    426397    fList->Add(l1);
     398#endif
    427399
    428400    //
     
    465437    fList->Add(but);
    466438
    467     but = new TGTextButton(tf1, "Home", kPB_HOME);
    468     but->Resize(80, 25);
    469     but->Move(160, 197);
    470     but->SetToolTipText("Initiate Home Drive.");
     439    but = new TGTextButton(tf1, "Move'n'Track", kPB_TRACKPOS);
     440    but->Resize(100, 25);
     441    but->Move(25, 242);
     442    but->SetToolTipText("Move telescope to a Zd/Az position and start tracking.");
    471443    but->Associate(this);
    472444    fList->Add(but);
    473445
     446    but= new TGTextButton(tf2, "Calc Zd/Az",  kPB_CALCALTAZ);
     447    but->Resize(80, 25);
     448    but->Move(165, 197);
     449    but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
     450    but->Associate(this);
     451    fList->Add(but);
     452
     453#ifdef EXPERT
    474454    but = new TGTextButton(tf5, "Display", kPB_DISPLAY1);
    475455    but->Resize(80, 25);
     
    486466    fList->Add(but);
    487467
    488     but= new TGTextButton(tf2, "Calc Zd/Az",  kPB_CALCALTAZ);
    489     but->Resize(80, 25);
    490     but->Move(165, 197);
    491     but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
    492     but->Associate(this);
    493     fList->Add(but);
    494 
    495     but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
    496     but->Resize(80, 25);
    497     but->Move(25, 190);
    498     but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
    499     but->Associate(this);
    500     fList->Add(but);
    501 
     468    /*
    502469    but = new TGTextButton(tf4, "Calib SE", kPB_CALIBSE);
    503470    but->Resize(80, 25);
     
    506473    but->Associate(this);
    507474    fList->Add(but);
    508 
     475    */
    509476    but = new TGTextButton(tf4, "Load", kPB_LoadBending);
    510477    but->Resize(80, 25);
    511     but->Move(25, 220);
     478    but->Move(25, 190);
    512479    but->SetToolTipText("Load bending corrections from file 'bending.txt'");
    513480    but->Associate(this);
     
    516483    but = new TGTextButton(tf4, "Reset", kPB_ResetBending);
    517484    but->Resize(80, 25);
    518     but->Move(25, 250);
     485    but->Move(25, 220);
    519486    but->SetToolTipText("Reset bending correction (coefficients=0)");
    520487    but->Associate(this);
    521488    fList->Add(but);
     489
     490    but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
     491    but->Resize(80, 25);
     492    but->Move(25, 250);
     493    but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
     494    but->Associate(this);
     495    fList->Add(but);
     496#endif
    522497
    523498    ULong_t color;
     
    958933                    ZdAz soll, UInt_t stat, UInt_t stat2)
    959934{
     935    // acc [rad]
     936    acc *= kRad2Deg;   // [deg]
     937
    960938    double mjd = UpdateTime();
    961939    fSkyPosition->Update(pos, mjd);
     
    984962    SetLabelColor(fAvailMac1, stat2&0x01);
    985963    SetLabelColor(fAvailMac2, stat2&0x02);
    986     SetLabelColor(fAvailMac3, stat2&0x04);
     964    //SetLabelColor(fAvailMac3, stat2&0x04);
    987965    SetLabelColor(fAvailSe1,  stat2&0x08);
    988966    SetLabelColor(fAvailSe2,  stat2&0x10);
     
    10331011}
    10341012
     1013void MGCosy::StartTrackPos()
     1014{
     1015    cout << "Start tracking Zd/Az pos." << endl;
     1016
     1017    const XY &xy = fCZdAz->GetCoordinates();
     1018
     1019    ZdAz za(xy.X(), xy.Y());
     1020
     1021    cout << za.Zd() << "\xb0 " << za.Az() << "\xb0" << endl;
     1022
     1023    fQueue->PostMsg(WM_TRACKPOS, &za, sizeof(za));
     1024
     1025    cout << "PostMsg (WM_TrackPos) returned." << endl;
     1026}
     1027
    10351028void MGCosy::StartPos()
    10361029{
     
    10501043// ************************** For demo purpose **********************
    10511044//
     1045/*
    10521046#include <TRandom.h>
    10531047class MDemo : public MThread
     
    10681062            Timer tm;
    10691063            tm.Now();
    1070             /*
    1071             Float_t h = 2.+tm.H()+(10.7+tm.M())/60.;
    1072             RaDec dest(h*15, 129.7);
    1073 
    1074             cout << dest.Ra()/15 << "h " << dest.Dec() << "°" << endl;
    1075 
    1076             fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
     1064
     1065            //fQueue->PostMsg(WM_STOP, 0, 0);
     1066
     1067            ZdAz dest1((float)fRand.Integer(120)-60., 0);//fRand.Integer(25)+90);
     1068
     1069            cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl;
     1070
     1071            fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1));
    10771072
    10781073            int i = 0;
    1079             while (!HasStopFlag() && i++<60)  // 2.5min
    1080             usleep(1000000);
    1081             if (HasStopFlag())
    1082                 break;
    1083             */
    1084 
    1085             //fQueue->PostMsg(WM_STOP, 0, 0);
    1086 
    1087             ZdAz dest1((float)fRand.Integer(120)-60., 0);//fRand.Integer(25)+90);
    1088 
    1089             cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl;
    1090 
    1091             fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1));
    1092 
    1093             int i = 0;
    1094             while (!HasStopFlag() && i++<5/*5*/)  // 30s
     1074            while (!HasStopFlag() && i++<5)  // 30s
    10951075                usleep(1000000);
    10961076            if (HasStopFlag())
     
    10991079            //ZdAz dest2(5, 30);
    11001080            //fQueue->PostMsg(WM_POSITION, &dest2, sizeof(dest2));
    1101             /*
    1102             i = 0;
    1103             while (!HasStopFlag() && i++<30)  // 30s
    1104                 usleep(1000000);
    1105             */
    11061081            //if (HasStopFlag())
    11071082            //    break;
     
    11291104    demo.Stop();
    11301105}
    1131 
     1106*/
     1107/*
    11321108void MGCosy::StartCalib()
    11331109{
     
    11411117    cout << "PostMsg (WM_Calib) returned." << endl;
    11421118}
    1143 
     1119*/
    11441120void MGCosy::StartTPoint()
    11451121{
     
    12131189                    fQueue->Proc(WM_GEAR, (void*)1);
    12141190                    return kTRUE;
     1191                    /*
    12151192                case 5:
    12161193                    StartDemo();
    12171194                    return kTRUE;
     1195                    */
    12181196                }
    12191197                return kTRUE;
     
    12211199            case kPB_STOP:
    12221200                cout << "Sending stop movement msg." << endl;
    1223                 StopDemo();
     1201                //StopDemo();
    12241202                fQueue->PostMsg(WM_STOP, 0, 0);
    12251203                if (fTab->GetCurrent()==3)
     
    12701248                StartTPoint();
    12711249                return kTRUE;
     1250                /*
    12721251            case kPB_CALIBSE:
    12731252                StartCalib();
    12741253                return kTRUE;
     1254                */
    12751255            case kPB_LoadBending:
    12761256                fQueue->Proc(WM_LOADBENDING, NULL);
     
    12791259                fQueue->Proc(WM_RESETBENDING, NULL);
    12801260                return kTRUE;
     1261                /*
    12811262            case kPB_HOME:
    12821263                fQueue->PostMsg(WM_HOME, 0, 0);
     1264                return kTRUE;
     1265                */
     1266            case kPB_TRACKPOS:
     1267                StartTrackPos();
    12831268                return kTRUE;
    12841269            case kPB_DISPLAY1:
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r1760 r1953  
    4949    MGList        *fList;
    5050
    51     TGLabel      **fLabel1;
    52     TGLabel      **fLabel2;
    53     TGLabel      **fLabel3;
     51    TGLabel       *fLabel1;
     52    TGLabel       *fLabel2;
     53    TGLabel       *fLabel3;
    5454
    5555    TGLabel       *fOffsetZd;
     
    104104    void StartPos();
    105105    void StartTrack();
     106    void StartTrackPos();
    106107    void StartDemo();
    107     void StartCalib();
     108    //void StartCalib();
    108109    void StartTPoint();
    109110
     
    121122    void CloseWindow();
    122123
    123     TGLabel **GetLabel1() const { return fLabel1; }
    124     TGLabel **GetLabel2() const { return fLabel2; }
    125     TGLabel **GetLabel3() const { return fLabel3; }
     124    TGLabel *GetLabel1() const { return fLabel1; }
     125    TGLabel *GetLabel2() const { return fLabel2; }
     126    TGLabel *GetLabel3() const { return fLabel3; }
    126127
    127128    TGListBox *GetLog() const { return fLog; }
  • trunk/MagicSoft/Cosy/gui/MGStarguider.cc

    r1819 r1953  
    7474    IDM_kLimMag9,
    7575    IDM_kPixSize,
     76    IDM_kAngle,
    7677    IDM_kInterpol125,
    7778    IDM_kInterpol25,
     
    217218    fWriteType->AddEntry("&Once",      IDM_kOnce);
    218219    fWriteType->AddEntry("&Continous", IDM_kContinous);
     220    fWriteType->CheckEntry(IDM_kOnce);
    219221    fWriteType->Associate(this);
    220222    fList->Add(fWriteType);
     
    334336    l = new TGLabel(this, "arcsec/pix");
    335337    l->SetTextJustify(kTextLeft);
    336     l->Move(605, fMenu->GetDefaultHeight()+619);
     338    l->Move(605, fMenu->GetDefaultHeight()+619+13);
     339    AddFrame(l);
     340    fList->Add(l);
     341
     342    l = new TGLabel(this, "deg");
     343    l->SetTextJustify(kTextLeft);
     344    l->Move(605, fMenu->GetDefaultHeight()+619-10);
    337345    AddFrame(l);
    338346    fList->Add(l);
     
    347355
    348356    fSao->SetPixSize(pixsize/3600);
     357    fSao->SetRotationAngle(0);
    349358
    350359    TString txt;
     
    353362    fPixSize = new TGTextEntry(this, txt, IDM_kPixSize);
    354363    fPixSize->SetAlignment(kTextCenterX);
    355     fPixSize->Move(547, fMenu->GetDefaultHeight()+617);
     364    fPixSize->Move(547, fMenu->GetDefaultHeight()+617+13);
    356365    AddFrame(fPixSize);
    357366    fList->Add(fPixSize);
     367
     368    fAngle = new TGTextEntry(this, "         0", IDM_kAngle);
     369    fAngle->SetAlignment(kTextCenterX);
     370    fAngle->Move(547, fMenu->GetDefaultHeight()+617-10);
     371    AddFrame(fAngle);
     372    fList->Add(fAngle);
    358373
    359374    // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
     
    582597    case kC_TEXTENTRY:
    583598        if (GET_SUBMSG(msg)==kTE_ENTER)
    584         {
    585             const Float_t pixsize = atof(fPixSize->GetText());
    586             cout << "Pixel Size changed to " << pixsize << "\"/pix" << endl;
    587             fSao->SetPixSize(pixsize/3600);
    588         }
     599            switch (mp1)
     600            {
     601            case IDM_kPixSize:
     602                {
     603                    const Float_t pixsize = atof(fPixSize->GetText());
     604                    cout << "Pixel Size changed to " << pixsize << "\"/pix" << endl;
     605                    fSao->SetPixSize(pixsize/3600);
     606                    return kTRUE;
     607                }
     608            case IDM_kAngle:
     609                {
     610                    const Float_t angle = atof(fAngle->GetText());
     611                    cout << "Rotation Angle changed to " << angle << "deg" << endl;
     612                    fSao->SetRotationAngle(angle);
     613                    return kTRUE;
     614                }
     615            }
    589616        return kTRUE;
    590617
     
    896923    AltAz pos1 = fSao->CalcAltAzFromPix(768/2+g.GetMean(1), 576/2+g.GetMean(2))*kRad2Deg;
    897924
     925    ofstream fout1("pointingpos.txt");
     926    fout1 << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
     927
    898928    pos1 -= pos0;
    899929
    900     ofstream fout("tracking_error.txt");
    901     fout << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
    902     fout.close();
     930    ofstream fout2("tracking_error.txt");
     931    fout2 << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
    903932
    904933    return ZdAz(-pos1.Alt(), pos1.Az());
     
    11721201    fDy = dy;
    11731202
    1174     cout << "New coordinates for zoom: " << fDx << " " << fDy << endl;
     1203    fSao->Now();
     1204    AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg;
     1205
     1206    cout << "New coordinates for zoom - x, y   : " << fDx << " " << fDy << endl;
     1207    cout << "New coordinates for zoom - Alt, az: " << aa.Alt() << " " << aa.Az() << endl;
    11751208
    11761209    return kTRUE;
  • trunk/MagicSoft/Cosy/gui/MGStarguider.h

    r1819 r1953  
    8989
    9090    TGTextEntry   *fPixSize;
     91    TGTextEntry   *fAngle;
    9192
    9293    StarCatalog   *fSao;
Note: See TracChangeset for help on using the changeset viewer.