Changeset 9435 for trunk/MagicSoft/Cosy


Ignore:
Timestamp:
04/29/09 13:05:42 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r9432 r9435  
    11                                                                  -*-*- END -*-*-
     2
     3 2009/04/29 Thomas Bretz (La Palma)
     4
     5   * cosy.cc:
     6     - added possibility to switch the ccd cameras on and off remote
     7     - read setup from the resource file instead of the commandline
     8
     9   * caos/Rings.[h,cc]:
     10     - added return value to CalcRings
     11
     12   * catalog/StarCatalog.h:
     13     - Store rotation angle
     14
     15   * devdrv/DevdrvLinkDef.h, Makefile:
     16     - removed macs*
     17     - removed shaftencoder*
     18
     19   * devdrv/dkc.cc:
     20     - simplified the interface to the sps (removed obsolete SDOs,
     21       removed obsolete subindices)
     22     - removed obsolete SetDeceleration
     23
     24   * main/MCaos.[h,cc]:
     25     - keep number of detected leds and number of detected rings
     26     - make many variables a data member which can now be setup
     27       from a resource file
     28     - derived from MParContainer
     29
     30   * main/MCosy.[h,cc]:
     31     - replaced SetDecelartion for pressing stop by SetAcceleration
     32     - implemented WM_STARGTPOINT
     33     - implemented WM_STARGMODE
     34     - allow shutdown even if no connection to SPS
     35
     36   * main/MStargHistograms.[h,cc]:
     37     - removed old obsoelte code
     38
     39   * main/MStarguider.[h,cc]:
     40     - removed old obsolete code (StargFindStar and RoqueLampAna)
     41     - moved some build in default setup to the resource file
     42     - removed AMC trigger
     43     - allow some setup from resource file
     44     - implemented StartStarguider for remote switching of starguider
     45       mode
     46     - implemented DoTPoint for remote TPoint procedure
     47     - some more code cleanup
     48
     49   * main/MTracking.cc:
     50     - removed obsolete include of shaftencoder.h
     51
     52   * tcpip/MCeCoCom.cc:
     53     - removed check for OVER
     54     - use TString::Length instead of strlen(TString&)
     55
     56   * tcpip/MDriveCom.[h,cc]:
     57     - implemented TPOINT command and STGMD command
     58     - send number of LEDs and rings instead of x/y in starguider report
     59
     60
    261
    362 2009/04/22 Thomas Bretz (La Palma)
  • trunk/MagicSoft/Cosy/caos/Rings.cc

    r7297 r9435  
    4444                n++;
    4545            }
    46 
    47     //    Expand(n);
    4846}
    4947
    50 void Rings::CalcRings(Leds &leds, Float_t min, Float_t max)
     48Int_t Rings::CalcRings(Leds &leds, Float_t min, Float_t max)
    5149{
    5250    CalcCenters(leds, min, max);
     
    5755    for (int j=0; j<n; j++)
    5856        leds(j).CalcPhi(fCenter);
     57
     58    return GetEntries();
    5959}
    6060
  • trunk/MagicSoft/Cosy/caos/Rings.h

    r7787 r9435  
    2525    void SetMinNumberLeds(Short_t n) { fMinNumberLeds=n; }
    2626
    27     void CalcRings(Leds &leds, Float_t min=-1, Float_t max=-1);
     27    Int_t CalcRings(Leds &leds, Float_t min=-1, Float_t max=-1);
    2828
    2929    void Print(Option_t *o=NULL) const;
  • trunk/MagicSoft/Cosy/catalog/StarCatalog.h

    r8847 r9435  
    3030    double   fSinAngle;
    3131    double   fCosAngle;
     32    double   fAngle;
    3233
    3334    float    fLimitMag; // [M] limiting magnitude for display
     
    5758    void  SetPixSize(const double pixsize);
    5859    void  SetLimitMag(const float mag);
    59     void  SetRotationAngle(const float angle) { fSinAngle = sin(angle/kRad2Deg); fCosAngle = cos(angle/kRad2Deg); }
     60    void  SetRotationAngle(const double angle) { fSinAngle = sin(angle/kRad2Deg); fCosAngle = cos(angle/kRad2Deg); fAngle=angle; }
    6061    void  Reload();
     62
     63    double GetRotationAngle() { return fAngle; }
    6164
    6265    double GetPixSize() const;
  • trunk/MagicSoft/Cosy/cosy.cc

    r9132 r9435  
    66#include <TApplication.h>
    77#include <TObjectTable.h>
     8#include <TSocket.h>
    89
    910#include "ethernet.h"
     
    6364}
    6465
     66enum Ports_t {
     67    kPortTPoint     = 4,
     68    kPortStarguider = 5,
     69};
     70
     71Bool_t SwitchCamera(const TString ip, Ports_t port, Bool_t on)
     72{
     73    if (ip.IsNull())
     74        return kTRUE;
     75
     76    TSocket s(ip, 80);
     77    if (!s.IsValid())
     78    {
     79        gLog << err << "ERROR - Could not connect to " << ip << " to switch " << (on?"on":"off") << " " << (port==kPortTPoint?"TPoint":"Starguider") << " ccd." << endl;
     80        return kFALSE;
     81    }
     82
     83    TString msg = Form("GET /ov.html?cmd=1&p=%d&s=%d HTTP/1.1\r\n", port, on?1:0);
     84
     85    if (s.SendRaw(msg.Data(), msg.Length()) == -1)
     86    {
     87        gLog << err << "ERROR - Could not talk to " << ip << " to switch " << (on?"on":"off") << " " << (port==kPortTPoint?"TPoint":"Starguider") << " ccd." << endl;
     88        return kFALSE;
     89    }
     90
     91    char buf[8192];
     92
     93    if (s.RecvRaw(buf, 8192) == -1)
     94      return kFALSE;
     95
     96    // FIXME: Eval buffer
     97
     98    gLog << all << "- " << (port==kPortTPoint?"TPoint":"Starguider") << " ccd switched " << (on?"on":"off") << "." << endl;
     99
     100   return kTRUE;
     101}
     102
     103
    65104/* ---------------------------------------------------------------------- */
    66105int main(int argc, char **argv)
     
    88127    }
    89128
    90     const Int_t   channel       = arg.GetIntAndRemove("--channel=", 0);
    91129    const Bool_t  kDebugMem     = arg.HasOnlyAndRemove("--debug-mem");
    92130    const Bool_t  kDebugThreads = arg.HasOnlyAndRemove("--debug-threads");
    93     const TString sps           = arg.GetStringAndRemove("--sps=", "sps");
    94     const TString ceco          = arg.GetStringAndRemove("--cc=", "161.72.130.60"); // ceco
    95131    const Int_t   ceco_tx       = arg.GetIntAndRemove("--cc-tx=", 7314);//7304);
    96132    const Int_t   ceco_rx       = arg.GetIntAndRemove("--cc-rx=", 7414);//7404);
    97     const TString pointing      = arg.GetStringAndRemove("--pointing-model=", "bending2.txt"); // ceco
    98133    const TString kConfig       = arg.GetStringAndRemove("--config=", ".cosyrc"); // ceco
    99134    Int_t  kDebugEnv = arg.HasOnlyAndRemove("--debug-env") ? 1 : 0;
     
    120155        return 0xfe;
    121156    }
     157
     158    const Int_t   channel     = env.GetValue("DefaultCameraChannel", 0);
     159    const TString sps         = env.GetValue("IpAddressSPS", "sps");
     160    const TString ceco        = env.GetValue("IpAddressCentralControl", "161.72.130.60");
     161    const TString powerswitch = env.GetValue("IpAddressPowerSwitch", "");
     162    const TString pointing    = env.GetValue("PointingModel", "bending.txt");
    122163
    123164    // And move the resource options from the command line to the MEnv
     
    218259    if (channel>=0)
    219260    {
    220         gLog << all << "- Starting Camera." << endl;
     261        SwitchCamera(powerswitch, kPortTPoint,     kTRUE);
     262        SwitchCamera(powerswitch, kPortStarguider, kTRUE);
     263
     264        gLog << all << "- Starting Starguider." << endl;
     265
    221266        client=new MStarguider(MObservatory::kMagic1, channel);
     267        client->SetupEnv(env);
    222268        //client.SetDriveCom(&com);
    223269        cosy->SetStarguider(client);
     
    238284        gLog << all << "- Stopping starg." << endl;
    239285        delete client;
     286
     287        SwitchCamera(powerswitch, kPortTPoint,     kFALSE);
     288        SwitchCamera(powerswitch, kPortStarguider, kFALSE);
    240289    }
    241290
  • trunk/MagicSoft/Cosy/devdrv/DevdrvLinkDef.h

    r9132 r9435  
    66
    77#pragma link C++ class Dkc+;
    8 #pragma link C++ class Macs+;
    9 #pragma link C++ class ShaftEncoder+;
    108
    119#endif
  • trunk/MagicSoft/Cosy/devdrv/Makefile

    r9132 r9435  
    1717#------------------------------------------------------------------------------
    1818
    19 SRCFILES = shaftencoder.cc macs.cc dkc.cc
     19SRCFILES = dkc.cc
    2020
    2121############################################################
  • trunk/MagicSoft/Cosy/devdrv/dkc.cc

    r9431 r9435  
    190190        return;
    191191
    192     case 0x100c:
    193         gLog << inf2 << "- " << GetNodeName() << ": Guard time:" << dec << val << endl;
    194         return;
    195 
    196     case 0x100d:
    197         gLog << inf2 << "- " << GetNodeName() << ": Life time factor:" << dec << val << endl;
    198         return;
    199 
    200192    case 0x2002:
    201193        gLog << inf2 << GetNodeName() << ": Current velocity: " << dec << val << endl;
     
    264256        break;
    265257
    266     case 0x100c:
    267         switch (subidx)
    268         {
    269         case 0:
    270             //lout << ddev(MLog::eGui);
    271             gLog << inf2 << "- " << GetNodeName() << ": Guard time set." << endl;
    272             //lout << edev(MLog::eGui);
    273             return;
    274         }
    275         break;
    276 
    277     case 0x100d:
    278         switch (subidx)
    279         {
    280         case 0:
    281             //lout << ddev(MLog::eGui);
    282             gLog << inf2 << "- " << GetNodeName() << ": Life time factor set." << endl;
    283             //lout << edev(MLog::eGui);
    284             return;
    285         }
    286         break;
    287 
    288     case 0x1800:
    289         switch (subidx)
    290         {
    291         case 1:
    292             //lout << ddev(MLog::eGui);
    293             gLog << inf2 << "- " << GetNodeName() << ": Status of PDO1 set." << endl;
    294             //lout << edev(MLog::eGui);
    295             return;
    296         }
    297         break;
    298 
    299258    case 0x2002:
    300         switch (subidx)
    301         {
    302         case 0:
    303             //lout << ddev(MLog::eGui);
    304             gLog << inf2 << "- " << GetNodeName() << ": Velocity set." << endl;
    305             //lout << edev(MLog::eGui);
    306             return;
    307         }
    308         break;
     259        //lout << ddev(MLog::eGui);
     260        gLog << inf2 << "- " << GetNodeName() << ": Velocity set." << endl;
     261        //lout << edev(MLog::eGui);
     262        return;
    309263
    310264    case 0x2003:
    311         switch (subidx)
    312         {
    313         case 0:
    314             //lout << ddev(MLog::eGui);
    315             gLog << inf2 << "- " << GetNodeName() << ": Acceleration set." << endl;
    316             //lout << edev(MLog::eGui);
    317             return;
    318         case 1:
    319             //lout << ddev(MLog::eGui);
    320             gLog << inf2 << "- " << GetNodeName() << ": Deceleration set." << endl;
    321             //lout << edev(MLog::eGui);
    322             return;
    323         }
    324         break;
     265        //lout << ddev(MLog::eGui);
     266        gLog << inf2 << "- " << GetNodeName() << ": Acceleration set." << endl;
     267        //lout << edev(MLog::eGui);
     268        return;
    325269
    326270    case 0x3006:
     
    359303        return;
    360304
    361     case 0x6003:
    362         switch (subidx)
    363         {
    364         case 0:
    365             //lout << ddev(MLog::eGui);
    366             gLog << inf2 << "- " << GetNodeName() << ": Absolute positioning started." << endl;
    367             //lout << edev(MLog::eGui);
    368             return;
    369 
    370         case 1:
    371             //lout << ddev(MLog::eGui);
    372             gLog << inf2 << "- " << GetNodeName() << ": Relative positioning started." << endl;
    373             //lout << edev(MLog::eGui);
    374             return;
    375         }
    376         break;
    377 
    378305    case 0x6004:
    379306        switch (subidx)
     
    421348}
    422349
    423 void Dkc::SetPDO1On(BYTE_t flag)
    424 {
    425     gLog << inf2 << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl;
    426     SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31);
    427     WaitForSdo(0x1800, 1);           
    428 }
    429 
    430350void Dkc::StartNode()
    431351{
     
    468388    WaitForSdo(0x1003, 2);
    469389
    470     SetPDO1On(TRUE);
    471390    /*
    472391    if (HasError())
     
    528447    gLog << dbg << "- Setting velocity to: " << vel << endl;
    529448    SendSDO(0x2002, vel);     // velocity
    530     WaitForSdo(0x2002, 0);
     449    WaitForSdo(0x2002);
    531450}
    532451
     
    535454    gLog << dbg << "- Setting velocity to: " << vel*100 << "%" << endl;
    536455    SendSDO(0x2002, (LWORD_t)(vel*fVelMax+0.5));     // velocity
    537     WaitForSdo(0x2002, 0);
     456    WaitForSdo(0x2002);
    538457}
    539458
     
    544463    WaitForSdo(0x2003, 0);
    545464}
    546 
     465/*
    547466void Dkc::SetDeceleration(LWORD_t dec)
    548467{
     
    551470    WaitForSdo(0x2003, 1);
    552471}
    553 
     472*/
    554473void Dkc::SetRpmMode(BYTE_t mode)
    555474{
  • trunk/MagicSoft/Cosy/main/MCaos.cc

    r8818 r9435  
    333333}
    334334
    335 Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t, Int_t box, Double_t cut)
     335Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t)
    336336{
    337337    Leds &leds = *fLeds;
    338338    leds.Clear();
     339
     340    fNumDetectedLEDs  = 0;
     341    fNumDetectedRings = 0;
    339342
    340343    /*
     
    351354
    352355    //          img  width height radius sigma
    353     FilterLed f(img, 768, 576, box, cut);
     356    FilterLed f(img, 768, 576, fSizeBox, fCut);
    354357
    355358    Int_t first=0;
     
    359362        const Led &l0 = fPositions(i);
    360363        f.Execute(leds, TMath::FloorNint(l0.GetX()), TMath::FloorNint(l0.GetY()));
     364
     365        fNumDetectedLEDs = leds.GetEntries();
    361366
    362367        // Loop over newly found Leds
     
    389394// rwagner
    390395//    rings.CalcRings(leds, 158, 164);
    391     rings.CalcRings(leds, fMinRadius, fMaxRadius);
     396    fNumDetectedRings = rings.CalcRings(leds, fMinRadius, fMaxRadius);
    392397
    393398    const Ring &center = rings.GetCenter();
     
    488493}
    489494
     495
     496Int_t MCaos::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     497{
     498    if (IsEnvDefined(env, prefix, "File", print))
     499        ReadResources(GetEnvValue(env, prefix, "File", "ledsxxx.txt"));
     500
     501    if (IsEnvDefined(env, prefix, "RadiusMin", print))
     502        fMinRadius = GetEnvValue(env, prefix, "RadiusMin", fMinRadius);
     503
     504    if (IsEnvDefined(env, prefix, "RadiusMax", print))
     505        fMaxRadius = GetEnvValue(env, prefix, "RadiusMax", fMaxRadius);
     506
     507    if (IsEnvDefined(env, prefix, "MinNumberLeds", print))
     508        fMaxRadius = GetEnvValue(env, prefix, "MinNumberLeds", fMinNumberLeds);
     509
     510    if (IsEnvDefined(env, prefix, "SizeBox", print))
     511        fSizeBox = GetEnvValue(env, prefix, "SizeBox", fSizeBox);
     512
     513    if (IsEnvDefined(env, prefix, "CleaningLevel", print))
     514        fCut = GetEnvValue(env, prefix, "CleaningLevel", fCut);
     515
     516    if (IsEnvDefined(env, prefix, "ArcsecPerPixel", print))
     517        fArcsecPerPixel = GetEnvValue(env, prefix, "ArcsecPerPixel", fArcsecPerPixel);
     518
     519    return kTRUE;
     520}
  • trunk/MagicSoft/Cosy/main/MCaos.h

    r8376 r9435  
    22#define CAOS_MCaos
    33
     4#ifndef MARS_MParContainer
     5#include "MParContainer.h"
     6#endif
    47#ifndef CAOS_Leds
    58#include "Leds.h"
     
    2124class ZdAz;
    2225
    23 class MCaos
     26class MCaos : public MParContainer
    2427{
    2528private:
     
    4548    TGraph        *fGraphr;
    4649
    47     Short_t       fMinNumberLeds;
    48     Double_t      fMinRadius;
    49     Double_t      fMaxRadius;
     50    Short_t       fMinNumberLeds;      // minimum number of detected leds required
     51    Double_t      fMinRadius;          // minimum radius for cut in ring radius
     52    Double_t      fMaxRadius;          // maximum radius for cut in ring radius
     53    UShort_t      fSizeBox;            // Size of the search box (side length in units of pixels)
     54    Double_t      fCut;                // Cleaning level (sigma above noise)
     55    Double_t      fArcsecPerPixel;     // Conversion from arcseconds to pixel
     56
     57    Int_t fNumDetectedLEDs;
     58    Int_t fNumDetectedRings;
    5059
    5160public:
    52     MCaos() : fFile(NULL), fHistpr(NULL), fMinNumberLeds(5), fMinRadius(265), fMaxRadius(268)
     61    MCaos(const char *name=0, const char *title=0)
     62        : fFile(NULL), fHistpr(NULL), fMinNumberLeds(5),
     63        fMinRadius(265), fMaxRadius(268), fSizeBox(19), fCut(3.0)
    5364    {
    5465        fLeds = new Leds;
    5566    }
    56    
     67
    5768    ~MCaos()
    5869    {
     
    7283    void CloseFile();
    7384   
    74     void SetMinNumberRings(Short_t n)
     85    void SetMinNumberLeds(Short_t n)
    7586    {
    7687        fMinNumberLeds = n;
    7788    }
    7889
    79     void SetRadii(Double_t min, Double_t max)
    80     { 
    81         fMinRadius=min;
    82         fMaxRadius=max;
    83     }
     90    void SetMinRadius(Double_t min) { fMinRadius=min; }
     91    void SetMaxRadius(Double_t max) { fMaxRadius=max; }
    8492
    8593    void InitHistograms();
     
    8896    void ResetHistograms();
    8997
     98    Int_t GetNumDetectedLEDs() const  { return fNumDetectedLEDs; }
     99    Int_t GetNumDetectedRings() const { return fNumDetectedRings; }
     100
     101    Double_t GetArcsecPerPixel() const { return fArcsecPerPixel; }
     102
    90103    Ring Run(byte *img, bool printl, bool printr, const ZdAz &pos,
    91              const MTime &t, Int_t box, Double_t cut);
     104             const MTime &t);
     105
     106    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    92107};
    93108
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r9132 r9435  
     1#include "MCosy.h"
    12#include "MCosy.h"
    23
     
    388389    {
    389390        // FIXME: Makes sense?
    390         fMac1->SetDeceleration(TMath::Nint(0.03*1000000000));
    391         fMac2->SetDeceleration(TMath::Nint(0.09*1000000000));
     391        fMac1->SetAcceleration(TMath::Nint(0.03*1000000000));
     392        fMac2->SetAcceleration(TMath::Nint(0.09*1000000000));
    392393
    393394        fMac1->SetRpmMode(FALSE);
     
    509510        }
    510511        return 0xca1b;
     512
     513    case WM_STARGTPOINT:
     514        if (fStarguider)
     515            fStarguider->StartTPoint();
     516        return 0xca1c;
     517
     518    case WM_STARGMODE:
     519        if (fStarguider)
     520            fStarguider->StartStarguider();
     521        return 0xca1c;
    511522
    512523    case WM_TRACKPOS:
     
    712723        if (!CheckNetwork())
    713724        {
    714             gLog << err << "ERROR: Cannot shutdown CANbus network." << endl;
    715             return 0xebb0;
     725            gLog << err << "ERROR: Cannot shutdown network." << endl;
     726            gLog <<        "       Please shutdown the drive system manually" << endl;
    716727        }
    717728        TerminateApp();
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r9132 r9435  
    4444#define WM_PREPS        0x1012
    4545#define WM_ARM          0x1013
     46#define WM_STARGTPOINT  0x1014
     47#define WM_STARGMODE    0x1015
    4648
    4749class Dkc;
  • trunk/MagicSoft/Cosy/main/MStargHistograms.cc

    r8847 r9435  
    7171        tree->Branch("CenterX.",    &fCenterX,        "fCenterX/D");
    7272        tree->Branch("CenterY.",    &fCenterY,       "fCenterY/D");
    73         // Center of Camera, offset from arb coords, in Zd, Az, deg
    74 //        tree->Branch("CenterZd.",    &fCenterZd,        "fCenterZd/D");
    75 //        tree->Branch("CenterAz.",    &fCenterAz,       "fCenterAz/D");
    76         // Position of Star in Camera in Zd, Az
    77         tree->Branch("StarZd.",    &fStarZd,        "fStarZd/D");
    78         tree->Branch("StarAz.",    &fStarAz,       "fStarAz/D");
    7973        // number of spots found
    8074        tree->Branch("Spots.",      &fSpots,       "fSpots/D");
     
    8276        tree->Branch("Stars.",      &fStars,       "fStars/D");
    8377        tree->Branch("Bright.",      &fBright,       "fBright/D");
    84 
    8578
    8679        cout << "Root file '" << name << "' open." << endl;
     
    108101}
    109102
    110 void MStargHistograms::InitHistograms()
    111 {
    112    
    113 }
    114 
    115 void MStargHistograms::DeleteHistograms()
    116 {
    117 
    118 }
    119 
    120 void MStargHistograms::ShowHistograms()
    121 {
    122 
    123 }
    124 
    125 void MStargHistograms::ResetHistograms()
    126 {
    127  
    128 }
    129 
    130 void MStargHistograms::Fill(Leds &spots, MStarList &stars, ZdAz &d, ZdAz sao, Ring &center,  ZdAz &star, Double_t bright, const ZdAz &pos, const MTime &t)
     103void MStargHistograms::Fill(Leds &spots, MStarList &stars, ZdAz &d, ZdAz sao, Ring &center,  Double_t bright, const ZdAz &pos, const MTime &t)
    131104{
    132105      // FIXME!
     
    134107      fEvtTime = t-t0;
    135108   
    136       //    cout << "@ evttime " << fEvtTime << endl;
    137 
    138109      if (fFile && spots.GetEntries()>0)
    139110      {
     
    147118          fCenterX    = center.GetX();
    148119          fCenterY    = center.GetY();
    149           //fCenterZd   = centerzdaz.Zd();
    150           //fCenterAz   = centerzdaz.Az();
    151           fStarZd     = star.Zd();
    152           fStarAz     = star.Az();
    153120          fStars      = stars.GetRealEntries();
    154121          fSpots      = spots.GetEntries();
    155122          fBright     = bright;
    156123
    157         //  cout << " Evttime=" << fEvtTime
    158 //           << " ZD=" << fZenithDist
    159 //           << " Az=" << fAzimuth
    160 //           << " NomZd=" << fNomZd
    161 //           << " NomAz=" << fNomAz
    162 //           << " dZd=" << fdZd
    163 //           << " dAz=" << fdAz
    164 //           << " OffsX=" << fOffsetX
    165 //           << " OffsY=" << fOffsetY
    166 //           <<endl;
    167        
    168124          TTree *t = (TTree*)fFile->Get("Data");
    169125          t->Fill();
    170126      }
    171          
    172127}
  • trunk/MagicSoft/Cosy/main/MStargHistograms.h

    r8847 r9435  
    3131    Double_t       fSpots;
    3232    Double_t       fBright;
    33 //    Double_t       fCenterZd;
    34 //    Double_t       fCenterAz;
    35     Double_t       fStarZd;
    36     Double_t       fStarAz;
    37 
    3833
    3934public:
     
    4338
    4439    void Fill(Leds &spots, MStarList &stars, ZdAz &d, ZdAz sao,
    45               Ring &center, /*ZdAz &centerzdaz,*/ ZdAz &star, Double_t bright,
    46               const ZdAz &pos, const MTime &t);
     40              Ring &center, Double_t bright,
     41              const ZdAz &pos, const MTime &t);
    4742
    4843    void OpenFile();
    4944    void CloseFile();
    50 
    51     void InitHistograms();
    52     void DeleteHistograms();
    53     void ShowHistograms();
    54     void ResetHistograms();
    55 
    5645};
    5746
  • trunk/MagicSoft/Cosy/main/MStarguider.cc

    r9132 r9435  
    99#include <TGraph.h>
    1010#include <TTimer.h>
     11#include <TEnv.h>
    1112#include <TSystem.h>
    1213#include <TFile.h> // temp writeout of histos
    13 #include <TSocket.h>
     14//#include <TSocket.h>
    1415
    1516#include <TGMenu.h>
     
    111112    IDM_kStargAnalysis,
    112113    IDM_kStargCaosFilter,
    113     IDM_kStargFindStar,
    114     IDM_kRoqueLampAna,
    115114    IDM_kStarguiderMode,
    116115    IDM_kTpointMode
     
    273272    fDisplay->AddEntry("Starguider",            IDM_kStarguider);
    274273    fDisplay->AddEntry("Starguider LED Filter", IDM_kStargCaosFilter);
    275     fDisplay->AddEntry("Starguider Find Star",  IDM_kStargFindStar);
    276274    fDisplay->AddSeparator();   
    277275    if (channel>=0)
    278276        fDisplay->AddPopup("&Input",   fChannel);
    279     fDisplay->DisableEntry(IDM_kStargFindStar);
    280277    fDisplay->CheckEntry(IDM_kStretch);
    281278    fDisplay->Associate(this);
     
    298295    fSetup->Associate(this);
    299296
    300     fOperations->AddEntry("Roque Lamp Analysis", IDM_kRoqueLampAna);
    301297    fOperations->AddEntry("Starguider Analysis", IDM_kStargAnalysis);
    302298    fOperations->DisableEntry(IDM_kStargAnalysis);
     
    400396    AddFrame(fDZdAzText);
    401397
    402 #ifdef EXPERT
    403     l = new TGLabel(this, "Mispointing/FindStar (Experts Only!)");
    404     l->SetTextJustify(kTextLeft);
    405     l->Move(240+12+20, fMenu->GetDefaultHeight()+722+3*20-5);
    406     AddFrame(l);
    407 #endif
    408 
    409398    // Set input box for rotation angle
    410     const Double_t angle = -0.2;
    411     fSao->SetRotationAngle(angle);
    412 
    413     TString txt;
    414     txt += angle;
    415 
    416     fAngle = new TGTextEntry(this, txt, IDM_kAngle);
     399    fAngle = new TGTextEntry(this, "           ", IDM_kAngle);
    417400    fAngle->SetAlignment(kTextCenterX);
    418401    fAngle->Move(547-410, fMenu->GetDefaultHeight()+667);
    419402    AddFrame(fAngle);
    420403
     404    SetRotationAngle(-0.2);
     405
    421406    // Set input box for pixel size
    422     const Double_t pixsize = 48.9; // used to be 23.4
    423 
    424     fSao->SetPixSize(pixsize);
    425 
    426     txt = "";
    427     txt += pixsize;
    428 
    429     fPixSize = new TGTextEntry(this, txt, IDM_kPixSize);
     407    fPixSize = new TGTextEntry(this, "           ", IDM_kPixSize);
    430408    fPixSize->SetAlignment(kTextCenterX);
    431409    fPixSize->Move(547-410, fMenu->GetDefaultHeight()+690);
    432410    AddFrame(fPixSize);
    433411
     412    SetPixSize(48.9);
     413
    434414    // Set input box for cleaning cut
    435     const Double_t cut = 3.0;
    436 
    437     txt = "";
    438     txt += cut;
    439 
    440     fCut = new TGTextEntry(this, txt, IDM_kCut);
     415    fCut = new TGTextEntry(this, "           ", IDM_kCut);
    441416    fCut->SetAlignment(kTextCenterX);
    442417    fCut->Move(547-410, fMenu->GetDefaultHeight()+713);
    443418    AddFrame(fCut);
     419
     420    SetCut(3.0);
    444421
    445422    // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
     
    505482      fDx((768-kZOOM)/2),
    506483      fDy((512-kZOOM)/2),
    507       fStatus(MDriveCom::kStandby)
     484      fStatus(MDriveCom::kStandby),
     485      fRadius(200),
     486      fTPointFromCC(0)
    508487{
    509488    gLog << warn << " #### FIXME: Make MCaos Thread safe!" << endl;
     
    513492    SetCleanup();
    514493
    515     fAmcSocket = new TSocket("amc", 7307);
    516 
    517494    fSao = new StarCatalog(obs);
    518495    fRaDec = new RaDec(180, 40);
    519496
    520     //    fStargLeds = new MStargLeds;
    521     //    fStargLeds->ReadResources();
    522 
    523497    fCaos = new MCaos;
    524     fCaos->ReadResources();
    525     fCaos->SetRadii(237.9, 239.9);
    526 
    527498    fStargCaos = new MCaos;
    528     fStargCaos->ReadResources("stargleds.txt");
    529     fStargCaos->SetMinNumberRings(3);
    530     fStargCaos->SetRadii(158,164);
    531499
    532500    fStargHistograms = new MStargHistograms();
     
    539507    fTime.Now();
    540508
    541     fTimeFromTp.Set(1970,1,1);
     509    fTimeFromTp.Clear();
    542510    fAltAzOffsetFromTp = AltAz(-1000,-1000);
    543511                                             
     
    550518}
    551519
     520void MStarguider::SetRotationAngle(Double_t angle)
     521{
     522    fSao->SetRotationAngle(angle);
     523
     524    TString txt;
     525    txt += angle;
     526
     527    fAngle->SetText(txt);
     528}
     529
     530void MStarguider::SetPixSize(Double_t size)
     531{
     532    fSao->SetPixSize(size);
     533
     534    TString txt;
     535    txt += size;
     536
     537    fPixSize->SetText(txt);
     538}
     539
     540void MStarguider::SetCut(Double_t cut)
     541{
     542    TString txt;
     543    txt += cut;
     544
     545    fCut->SetText(txt);
     546}
     547
     548void MStarguider::SetupEnv(TEnv &env)
     549{
     550    fCaos->ReadEnv(env, "TPointLeds", kTRUE);
     551    fStargCaos->ReadEnv(env, "StarguiderLeds", kTRUE);
     552
     553    SetRotationAngle(env.GetValue("Starguider.RotationAngle", fSao->GetRotationAngle()));
     554    SetCut(env.GetValue("Starguider.CleaningLevel", atof(fCut->GetText())));
     555
     556    SetPixSize(env.GetValue("StarguiderLeds.ArcsecPerPixel", fSao->GetPixSize()));
     557
     558    fRadius = env.GetValue("Leds.Radius", fRadius);
     559}
     560
    552561MStarguider::~MStarguider()
    553562{
     
    564573    delete fCaos;
    565574    delete fStargCaos;
    566     //    delete fStargLeds;
    567575    delete fStargHistograms;
    568576    delete fSao;
     
    578586        delete fOutRq;
    579587
    580     delete fAmcSocket;
    581 
    582588    gLog << inf2 << "Camera Display destroyed." << endl;
    583 }
    584 
    585 bool MStarguider::SendAmcTrigger(const char *msg)
    586 {
    587     if (!fAmcSocket->IsValid())
    588         return false;
    589 
    590     TString txt("TRIGGER ");
    591     txt += msg;
    592 
    593     const Int_t len = fAmcSocket->SendRaw(txt.Data(), txt.Length());
    594     if (len<0)
    595     {
    596         gLog << err << "ERROR - Sending Trigger to Amc" << endl;
    597         return false;
    598     }
    599     if (len!=txt.Length())
    600     {
    601         gLog << err << "Send wrong number (" << len << ") of Bytes to Amc." << endl;
    602         return false;
    603     }
    604 
    605     return true;
    606589}
    607590
     
    763746        SwitchOff(fDisplay, IDM_kStarguider);
    764747        SwitchOff(fDisplay, IDM_kStargCaosFilter);
    765         fDisplay->DisableEntry(IDM_kStargFindStar);
    766748    }
    767749    else
     
    858840                return kTRUE;
    859841
    860            case IDM_kRoqueLampAna:
    861                 Toggle(fOperations, IDM_kRoqueLampAna);
    862                 if (fOperations->IsEntryChecked(IDM_kRoqueLampAna))
    863                     fDisplay->CheckEntry(IDM_kStargCaosFilter);
    864                 else
    865                     fDisplay->UnCheckEntry(IDM_kStargCaosFilter);
    866                  
    867                 return kTRUE;
    868 
    869            case IDM_kStargFindStar:
    870                 Toggle(fDisplay, IDM_kStargFindStar);         
    871                 if (fDisplay->IsEntryChecked(IDM_kStargFindStar))
    872                     fSZdAz->MapWindow();
    873                 else
    874                     fSZdAz->UnmapWindow();
    875                 return kTRUE;
    876 
    877842            case IDM_kStarguider:
    878843                Toggle(fDisplay, IDM_kStarguider);
     
    892857                    //uncheck not needed items
    893858                    //general
    894                     fDisplay->UnCheckEntry(IDM_kStargFindStar);
    895859                    SwitchOff(fDisplay, IDM_kFilter);
    896860                    SwitchOff(fChannel, IDM_kChannel3);
    897                     SwitchOff(fOperations, IDM_kRoqueLampAna);
    898861                    SwitchOff(fOperations, IDM_kStargAnalysis);
    899862
     
    930893                    fDisplay->EnableEntry(IDM_kFindStar);
    931894                    fChannel->EnableEntry(IDM_kChannel3);
    932                     fOperations->EnableEntry(IDM_kRoqueLampAna);
    933895                }
    934896                return kTRUE;
     
    941903                    //unchecking not needed items
    942904                    //general
    943                     fDisplay->UnCheckEntry(IDM_kStargFindStar);
    944905                    SwitchOff(fDisplay, IDM_kFilter);
    945906                    SwitchOff(fChannel, IDM_kChannel3);
    946                     SwitchOff(fOperations, IDM_kRoqueLampAna);
    947907
    948908                    //from starguider
     
    981941                    fChannel->EnableEntry(IDM_kChannel1);
    982942                    fChannel->EnableEntry(IDM_kChannel3);
    983                     fOperations->EnableEntry(IDM_kRoqueLampAna);
    984943
    985944                    //tpoint
     
    1013972                if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter))
    1014973                {
    1015                     fDisplay->EnableEntry(IDM_kStargFindStar);
    1016974                    SwitchOff(fDisplay, IDM_kCaosFilter);
    1017975                    SwitchOff(fDisplay, IDM_kFindStar);
     
    1023981                    fDisplay->EnableEntry(IDM_kFindStar);
    1024982                    fDisplay->EnableEntry(IDM_kCaosFilter);
    1025                     fDisplay->DisableEntry(IDM_kStargFindStar);
    1026983                }
    1027984                return kTRUE;
     
    13381295    AltAz pos0 = fSao->CalcAltAzFromPix(768/2,    576/2)*kRad2Deg;
    13391296    AltAz pos1 = fSao->CalcAltAzFromPix(768/2+mx, 576/2+my)*kRad2Deg;
    1340 /*
    1341     ofstream fout1("pointingpos.txt");
    1342     fout1 << setprecision(10) << fSao->GetMjd()-52000 << " ";
    1343     if (fCosy)
    1344         fout1 << fCosy->GetPointingPos() << " ";
    1345     fout1 << -pos1.Alt() << " " << pos1.Az() << endl;
    1346  */
     1297
    13471298    pos1 -= pos0;
    1348 /*
    1349     ofstream fout2("tracking_error.txt", ios::app);
    1350     fout2 << setprecision(10) << fSao->GetMjd()-52000 << " ";
    1351     if (fCosy)
    1352         fout2 << fCosy->GetPointingPos() << " ";
    1353     fout2 << -pos1.Alt() << " " << pos1.Az() << endl;
    1354   */
     1299
    13551300    return ZdAz(-pos1.Alt(), pos1.Az());
    13561301}
     
    13601305{
    13611306    num = leds.GetEntries();
    1362     //cout << "Num: " << num << endl;
    13631307    if (num < 3) //was 1
    13641308    {
    13651309        gLog << warn << "Sorry, less than 3 detected spot in FOV!" << endl;
    1366         if (fStargTPoint->IsDown())
    1367             fStargTPoint->SetDown(kFALSE);
     1310        fStargTPoint->SetDown(kFALSE);
    13681311        return 0;
    13691312    }
    13701313
    1371     //cout << "Cat: " << stars.GetRealEntries() << endl;
    13721314    if (stars.GetRealEntries() < 3)
    13731315    {
    13741316        gLog << warn << "Sorry, less than 3 stars in FOV!" << endl;
    1375         if (fStargTPoint->IsDown())
    1376             fStargTPoint->SetDown(kFALSE);
     1317        fStargTPoint->SetDown(kFALSE);
    13771318        return 0;
    13781319    }
     
    14331374    d = TrackingError(x, y, mag, numcor);
    14341375    if (numcor<1)
     1376    {
     1377        fStargTPoint->SetDown(kFALSE);
    14351378        return 0;
    1436 
    1437     //cout << "Cor: " << numcor << endl;
     1379    }
    14381380
    14391381    fDZdAz->SetCoordinates(d);
    1440 
    1441     //
    1442     // Calculated offsets
    1443     //
    1444 
    1445 #ifdef EXPERT
    1446     // round= floor(x+.5)
    1447     cout << "Offset-ZdAz: " << d.Zd()*60 << "' / " << d.Az()*60 << "'" << endl;
    1448     cout << "Offset-ZdAz: " << d.Zd()/360*16384 << " / " << d.Az()/360*16384 << " (SE) " << endl;
    1449 #endif
    14501382
    14511383    //
     
    14761408    // Get tracking coordinates
    14771409    const XY    xy = fCRaDec->GetCoordinates();
    1478     const RaDec rd(xy.X()*TMath::DegToRad()*15, xy.Y()*TMath::DegToRad());
     1410    const RaDec rd(xy.X()*MAstro::HorToRad(), xy.Y()*TMath::DegToRad());
    14791411
    14801412    // From the star position in the camera we calculate the Alt/Az
     
    14851417    //correction with offset from last tpoint measurement
    14861418    za0 -= fAltAzOffsetFromTp;
    1487     MTime t2 = fTimeFromTp;
    14881419
    14891420    //if the difference between the tpoint and the starguider tpoint
    14901421    //is too big, the starguider tpoint is not stored
    1491     cout << "     mjd difference: " << t.GetMjd()-t2.GetMjd() << endl;
    1492 //        cout << "t: " << setprecision(11) << t.GetMjd() << endl;
    1493 //        cout << "t2: " << setprecision(11) << t2.GetMjd() << endl;
    1494     if ((t.GetMjd()-t2.GetMjd())>0.001) //1min20sec
    1495     {
    1496         cout << "     time difference between tpoint and starguider-tpoint > 1 min *" <<
    1497             t.GetMjd()-t2.GetMjd() << "s) " << endl;
     1422    if ((t.GetMjd()-fTimeFromTp.GetMjd())>0.001) //1min20sec
     1423    {
     1424        cout << "     time difference between tpoint and starguider-tpoint > 1m20s" << endl;
    14981425        cout << "     => starguider tpoint hasn't been stored. " << endl;
    1499         cout << "     Please repeat whole procedure. " << endl;
     1426        cout << "        Please repeat whole procedure. " << endl;
    15001427        return numcor;
    15011428    }
     
    15031430
    15041431    // Write real pointing position
    1505     cout << "     Alt/Az: " << za0.Alt() << "° " << za0.Az() << "°" << endl;
     1432    //cout << "     Alt/Az: " << za0.Alt() << "° " << za0.Az() << "°" << endl;
    15061433    *fOutStargTp << setprecision(7) << za0.Az() << " " << za0.Alt() << " ";
    15071434
    15081435    // Write system pointing position
    1509     cout << "     SE-Pos: " << 90-cpos.Zd() << "° " << cpos.Az() << "°" << endl;
     1436    //cout << "     SE-Pos: " << 90-cpos.Zd() << "° " << cpos.Az() << "°" << endl;
    15101437    *fOutStargTp << fmod(cpos.Az()+360, 360) << " " << 90-cpos.Zd();
    15111438
     
    15171444    *fOutStargTp << endl;
    15181445
    1519     fTimeFromTp.Set(1970,1,1);
     1446    fTimeFromTp.Clear();
    15201447
    15211448    return numcor;
    15221449}
    15231450
    1524 XY MStarguider::FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, Double_t cut, Int_t box, XY SearchCenter)
    1525 {
    1526     // Set search Paremeters (FIXME: Get them from user input!)
    1527     f.SetCut(cut);  // 3.5
    1528     f.SetBox(box);  // 70
    1529 
    1530     // Try to find Led in this area
    1531     Leds leds;
    1532     f.FindStar(leds, (Int_t)SearchCenter.X(), (Int_t)SearchCenter.Y(), true);
    1533 
    1534     // Check whether star found
    1535     Led *star = (Led*)leds.At(0);
    1536     if (!star || leds.GetEntries()<1)
    1537         return XY(.0,.0);
    1538 
    1539 //    cout << "Found Roque Lamp @ " << flush;
    1540     star->Print();
    1541     f.MarkPoint(star->GetX(), star->GetY(), 500);
    1542 
    1543 //    cout << "RoquePos: " << star->GetX() << "," << star->GetY() << endl;
    1544 
    1545     XY roquepos(star->GetX(), star->GetY());
    1546     XY relroquepos(roquepos.X()-CameraCenter.GetX(), roquepos.Y()-CameraCenter.GetY());
    1547 
    1548     // If no file open: open new Roque Lamp file
    1549     if (!fOutRq)
    1550     {
    1551         const TString name = MCosy::GetFileName("tpoint", "roquelamp", "txt");
    1552         cout << "Starg_RoqueLamp File ********* " << name << " ********** " << endl;
    1553         fOutRq = new ofstream(name);
    1554         *fOutRq << "# Magic Roque Lamp file  " << t << endl;
    1555     }
    1556 
    1557     return relroquepos;
    1558 }
    1559 
    1560 ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t, Double_t cut, Int_t box, Double_t scalefactor = 1.0)
    1561 {
    1562     // Set search Paremeters (FIXME: Get them from user input!)
    1563     f.SetCut(cut);  // 3.5
    1564     f.SetBox(box);  // 70
    1565 
    1566     // Try to find Led in this area
     1451void MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t)
     1452{
     1453    // Try to find the star
    15671454    Leds leds;
    15681455    f.FindStar(leds, (Int_t)center.GetX(), (Int_t)center.GetY(), true);
    1569 
    1570     if (leds.GetEntries()<0)
    1571         return ZdAz(0, 0);
    15721456
    15731457    // Check whether star found
     
    15801464            gLog << warn << "No star found. Couldn't take a tpoint." << endl;
    15811465        }
    1582         return ZdAz(.0,.0);
    1583     }
     1466        return;
     1467    }
     1468
    15841469    cout << "Found star @ " << flush;
    15851470    star->Print();
    15861471    f2.MarkPoint(star->GetX(), star->GetY(), 2<<2);
    15871472
    1588     // Initialize Star Catalog on th camera plane
     1473    // Initialize Star Catalog on the camera plane
    15891474    MGeomCamMagic geom;
    15901475    MAstroCamera ac;
     
    15951480
    15961481    // Get tracking coordinates
    1597     const XY    xy = fCRaDec->GetCoordinates();
    1598     const RaDec rd(xy.X()*TMath::DegToRad()*15, xy.Y()*TMath::DegToRad());
     1482    const XY xy = fCRaDec->GetCoordinates();  // [h, deg]
     1483    const RaDec rd(xy.X()*MAstro::HorToRad(), xy.Y()*TMath::DegToRad());
    15991484
    16001485    ac.SetRaDec(rd.Ra(), rd.Dec());
    16011486
     1487    // Convert from Pixel to millimeter (1pix=2.6mm) [deg/pix / deg/mm = mm/pix]
     1488    // Correct for abberation.
     1489    const Double_t conv = fCaos->GetArcsecPerPixel()/3600/geom.GetConvMm2Deg()/ 1.0713;
     1490
    16021491    // Adapt coordinate system (GUIs and humans are counting Y in different directions)
    1603     Double_t x = star->GetX()-center.GetX();
    1604     Double_t y = center.GetY()-star->GetY();
    1605 
    1606 #ifdef EXPERT
    1607     cout << "STAR-Offset: " << MTime(-1) << " dx=" << x << "pix  dy=" << y << "pix" << endl;
    1608 #endif
    1609 
    1610     // MAKE SURE THAT THIS VALUE CAN BE SETUP
    1611     // (Scalefactor describes the difference between the tpoint (=1)
    1612     //  and the starguider (!=1) camera
    1613     // Convert from Pixel to millimeter (1pix=2.6mm)
    1614     x *= (2.58427 * scalefactor);
    1615     y *= (2.58427 * scalefactor);
    1616 
    1617     // Correct for abberation.
    1618     x /= 1.0713;
    1619     y /= 1.0713;
     1492    const Double_t dx = (star->GetX()-center.GetX())*conv;
     1493    const Double_t dy = (center.GetY()-star->GetY())*conv;
    16201494
    16211495    // Convert offset from camera plane into local ccordinates
    16221496    Double_t dzd, daz;
    1623     ac.GetDiffZdAz(x, y, dzd, daz);
    1624 
    1625 #ifdef EXPERT
    1626     cout << "STAR-Offset: " << MTime(-1) << " dZd=" << dzd << "d  dAz=" << daz << "d" << endl;
    1627 #endif
     1497    ac.GetDiffZdAz(dx, dy, dzd, daz);
    16281498
    16291499    ZdAz zdaz(dzd,daz);
     
    16311501    // Check TPoint data set request
    16321502    if (!fTPoint->IsDown())
    1633         return zdaz;
     1503        return;
     1504
    16341505    fTPoint->SetDown(kFALSE);
    16351506
     
    16411512        //
    16421513        const TString name = MCosy::GetFileName("tpoint", "tpoint", "txt");
    1643         cout << "TPoint-Starg File ********* " << name << " ********** " << endl;
     1514        cout << "TPoint File ********* " << name << " ********** " << endl;
    16441515
    16451516        fOutTp = new ofstream(name);
     
    16521523
    16531524    // Output Ra/Dec the drive system thinks that it is currently tracking
    1654     cout << "TPoint Star: " << xy.X() << "h " << xy.Y() << "°" << endl;
     1525    //cout << "TPoint Star: " << xy.X() << "h " << xy.Y() << "°" << endl;
    16551526
    16561527    // From the star position in the camera we calculate the Alt/Az
     
    16641535    fTimeFromTp=t;
    16651536
    1666 
    16671537    // From the Shaftencoders we get the current 'pointing' position
    16681538    // as it is seen by the drive system (system pointing position)
    1669     // FIXME????
    1670     const ZdAz za1 = fCosy->GetSePos()*TMath::TwoPi();
     1539    const ZdAz za1 = fCosy->GetSePos()*360; // [deg]
    16711540
    16721541    // Write real pointing position
    1673     cout << "     Alt/Az: " << za0.Alt() << "° " << za0.Az() << "°" << endl;
     1542    //cout << "     Alt/Az: " << za0.Alt() << "° " << za0.Az() << "°" << endl;
    16741543    *fOutTp << setprecision(7) << za0.Az() << " " << za0.Alt() << " ";
    16751544
    16761545    // Write system pointing position
    1677     cout << "     SE-Pos: " << 90-za1.Zd() << "° " << za1.Az() << "°" << endl;
     1546    //cout << "     SE-Pos: " << 90-za1.Zd() << "° " << za1.Az() << "°" << endl;
    16781547    *fOutTp << fmod(za1.Az()+360, 360) << " " << 90-za1.Zd();
    16791548
     
    16841553    *fOutTp << " " << star->GetMag();
    16851554    *fOutTp << endl;
    1686 
     1555/*
    16871556    MLog &outrep = *fCosy->GetOutRep();
    16881557    if (outrep.Lock("MStarguider::FindStar"))
     
    16951564        outrep << star->GetX() << " " << star->GetY() << " ";
    16961565        outrep << center.GetX() << " " << center.GetY() << " ";
    1697         outrep << x*1.0713/2.58427 << " " << y*1.0713/2.58427 << " " << star->GetMag();
     1566        outrep << dx/conv << " " << dy/conv << " " << star->GetMag();
    16981567        outrep << setprecision(11) << t.GetMjd() << endl;
    16991568        outrep.UnLock("MStarguider::FindStar");
    1700     }
     1569    }*/
    17011570   
    1702     return zdaz;
     1571//    return zdaz;
    17031572}
    17041573
     
    17301599
    17311600    return true;
     1601}
     1602
     1603void MStarguider::DrawZoomImage(const byte *img)
     1604{
     1605    byte zimg[kZOOM*kZOOM];
     1606    for (int y=0; y<kZOOM; y++)
     1607        for (int x=0; x<kZOOM; x++)
     1608            zimg[x+y*kZOOM] = img[(fDx+(x-kZOOM/2)/2)+(fDy+(y-kZOOM/2)/2)*768];
     1609
     1610    fZoomImage->DrawImg(zimg);
     1611}
     1612
     1613void MStarguider::DrawCosyImage(const byte *img)
     1614{
     1615    if (!fCosy)
     1616        return;
     1617
     1618    byte simg[(768/2-1)*(576/2-1)];
     1619    for (int y=0; y<576/2-1; y++)
     1620        for (int x=0; x<768/2-1; x++)
     1621            simg[x+y*(768/2-1)] = ((unsigned int)img[2*x+2*y*768]+img[2*x+2*y*768+1]+img[2*x+2*(y+1)*768]+img[2*x+2*(y+1)*768+1])/4;
     1622
     1623    fCosy->GetWin()->GetImage()->DrawImg(simg);
     1624}
     1625
     1626void MStarguider::StartStarguider()
     1627{
     1628    // Switch to starguider mode
     1629    cout << " * Switching to Starguider mode" << endl;
     1630    fMode->UnCheckEntry(IDM_kStarguiderMode);
     1631    ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kStarguiderMode, 0);
     1632}
     1633
     1634Bool_t MStarguider::DoTPoint()
     1635{
     1636    if (fTPointFromCC<0)
     1637        return kTRUE;
     1638
     1639    switch (++fTPointFromCC)
     1640    {
     1641    case 1:
     1642        fTimeFromTp.Clear();
     1643        fNumStarsDetected = 0;
     1644
     1645        cout << " * Switching to TPoint mode" << endl;
     1646        // Switch to tpoint mode
     1647        fMode->UnCheckEntry(IDM_kTpointMode);
     1648        ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kTpointMode, 0);
     1649        return kFALSE;
     1650
     1651    case 2:
     1652        cout << " * Waiting one frame" << endl;
     1653        // Wait one frame
     1654        return kFALSE;
     1655
     1656    case 3:
     1657        cout << " * Taking TPoint" << endl;
     1658        fTPoint->SetDown(); // kTRUE
     1659        return kTRUE;
     1660
     1661    case 4:
     1662        if (!fTimeFromTp) // TPoint failed
     1663            break;
     1664
     1665        // Switch to starguider mode
     1666        cout << " * Switching to Starguider mode" << endl;
     1667        fMode->UnCheckEntry(IDM_kStarguiderMode);
     1668        ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kStarguiderMode, 0);
     1669        return kFALSE;
     1670
     1671    case 5:
     1672        cout << " * Waiting one frame" << endl;
     1673        // Wait one frame
     1674        return kFALSE;
     1675
     1676    case 6:
     1677        cout << " * Taking Starguider TPoint" << endl;
     1678        fStargTPoint->SetDown(); // kTRUE
     1679        return kTRUE;
     1680
     1681    case 7:
     1682        cout << " * Send Report" << endl;
     1683        break;
     1684    }
     1685
     1686    // Send report
     1687    fTPointFromCC = -1;
     1688
     1689    if (!fCosy)
     1690        return kTRUE;
     1691
     1692    MDriveCom *com = fCosy->GetDriveCom();
     1693    if (!com)
     1694        return kTRUE;
     1695
     1696    // nominalaz, nominalel, realaz, realel, nomra, nomdec,
     1697    // diffaz, diffel, mjd, numleds, artmag
     1698
     1699    //fTimeFromTp.Clear();
     1700    //fStatus==MDriveCom::kMonitoring
     1701    //fNumStarsDetected   = numstars;
     1702    //fNumStarsCorrelated = rc;
     1703    com->SendTPoint(fNumStarsCorrelated>0);
     1704
     1705    return kTRUE;
    17321706}
    17331707
     
    17781752        f.Execute();
    17791753
     1754    DoTPoint();
     1755
     1756    Int_t numleds = 0;
     1757    Int_t numrings = 0;
     1758
    17801759    // Find Center of Camera for Caos and Tpoints
    17811760    Ring center(768/2, 576/2);
     
    17871766        if (fCosy)
    17881767            pos = fCosy->GetPointingPos();
    1789         center = fCaos->Run(img, printl, printr, pos, t, 19, 3.0);
    1790         cout << "Caos Filter Camera center position: " << center.GetX() << " " << center.GetY() << " (R=" << center.GetR() << ")" << endl;
    1791 
     1768
     1769        center = fCaos->Run(img, printl, printr, pos, t);
     1770
     1771        numleds  = fCaos->GetNumDetectedLEDs();
     1772        numrings = fCaos->GetNumDetectedRings();
    17921773    }
    17931774
     
    17961777        center.GetX()>0 && center.GetY()>0)
    17971778    {
    1798         // SCALE FACTOR ASSUMED TO BE 70
    1799         FindStar(f, f2, center, t, 3/*3.5*/, 70);
    1800         SendAmcTrigger("TPoint");
    1801     }
    1802 
    1803     byte zimg[kZOOM*kZOOM];
    1804     for (int y=0; y<kZOOM; y++)
    1805         for (int x=0; x<kZOOM; x++)
    1806             zimg[x+y*kZOOM] = img[(fDx+(x-kZOOM/2)/2)+(fDy+(y-kZOOM/2)/2)*768];
    1807 
    1808     fZoomImage->DrawImg(zimg);
    1809 
    1810     if (fCosy)
    1811     {
    1812         byte simg[(768/2-1)*(576/2-1)];
    1813         for (int y=0; y<576/2-1; y++)
    1814             for (int x=0; x<768/2-1; x++)
    1815                 simg[x+y*(768/2-1)] = ((unsigned int)img[2*x+2*y*768]+img[2*x+2*y*768+1]+img[2*x+2*(y+1)*768]+img[2*x+2*(y+1)*768+1])/4;       
    1816 
    1817         fCosy->GetWin()->GetImage()->DrawImg(simg);
    1818     }
     1779        // Set search Paremeters (FIXME: Get them from user input!)
     1780        f.SetCut(3.0);
     1781        f.SetBox(70);
     1782
     1783        FindStar(f, f2, center, t);
     1784    }
     1785
     1786    DrawZoomImage(img);
     1787    DrawCosyImage(img);
     1788
     1789    // Position corresponding to the camera center (53.2, 293.6)
     1790    Ring sgcenter(53.2, 293.6); // Center of camera in SG picture [px]
    18191791
    18201792    // Find Center of Camera in Starfield Camera picture
    1821 
    1822     Ring sgcenter(53.2, 293.6); // Center of camera in SG picture [px]
    1823     //ZdAz sgcenterzdaz(0, 0);    // Center of camera in SG picture [deg]
    1824     //                            // (0,0)_deg is at (53.2, 293.6)_px
    1825     ZdAz star(0, 0);            // Star on curtain in [deg]
    1826 
    18271793    if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter))
    18281794    {
     
    18311797            pos = fCosy->GetPointingPos();
    18321798
    1833         sgcenter = fStargCaos->Run(img, kFALSE, kFALSE, pos, t, 19, 3.0); // [px]
    1834 
    1835         //const Float_t pixsize = atof(fPixSize->GetText()); // [arcsec/px]
    1836 
    1837         // BE CAREFULL: This transformation is WRONG. It is just
    1838         // a transformation of units, but this implies, that the
    1839         // coordiante axis in both units look the same. This is
    1840         // wrong exspecially near the zenith were az-lines are highly
    1841         // curved around the zenith!
    1842         //sgcenterzdaz.Zd((sgcenter.GetY()-293.6) * pixsize /3600 );
    1843         //sgcenterzdaz.Az((sgcenter.GetX()-53.2)  * pixsize /3600 );
    1844 #ifdef EXPERT
    1845         cout << "- LEDs imply offset of Zd="
    1846              << sgcenter.GetX()-53.2 << "pix Az="
    1847              << sgcenter.GetY()-293.6<< "pix" << endl; 
    1848 #endif
    1849         if (fDisplay->IsEntryChecked(IDM_kStargFindStar) &&
    1850             sgcenter.GetX()>0 && sgcenter.GetY()>0)
    1851         {
    1852             star = FindStar(f, f2, sgcenter, t, 4.5, 30, 267/161.9); // [deg]
    1853 #ifdef EXPERT
    1854             cout << "- Star is found to be off Zd=" << star.Zd()*60 << "' Az="
    1855                 << star.Az()*60 << "'" << endl;
    1856 #endif
    1857             fSZdAz->SetCoordinates(star); // Mispointing found from Camera
    1858 
    1859             SendAmcTrigger("Starguider");
    1860         }
    1861     }
    1862 
    1863 // Find Roque Lamp
    1864 
    1865     if (fOperations->IsEntryChecked(IDM_kRoqueLampAna))
    1866     {
    1867 
    1868         Double_t imageclean = 1.5;
    1869         Int_t    boxradius = 60;
    1870         //Double_t scalefactor = 1;
    1871         XY searchcenter(768/2-1,576/2+25);
    1872 
    1873         XY roquelamp = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter);
    1874 
    1875         if (fOutRq)
    1876         {
    1877             ZdAz pos = fCosy->GetPointingPos();
    1878 
    1879             *fOutRq << "RoqueLampDirect:    " << MTime(-1) << "  "
    1880                 << pos.Zd() << " " << pos.Az() << "   "
    1881                 << roquelamp.X() << " " << roquelamp.Y() << endl;
    1882         }
    1883 
    1884         cout << "Starguider Camera Center: " << sgcenter.GetX() << "," << sgcenter.GetY() << endl;
    1885         cout << ">=>=>=> Roque Lamp found at:         >=>=>=> (" << roquelamp.X() << ","
    1886              << roquelamp.Y() << ") <=<=<=<" << endl;
    1887 
    1888     }
    1889 
    1890     // Find Spot on Camera Center in Starguider camera
    1891     if (fOperations->IsEntryChecked(IDM_kRoqueLampAna))
    1892     {
    1893         XY cameraspot(0,0);
    1894 
    1895         Double_t imageclean = 5;
    1896         Int_t    boxradius = 60;
    1897         //Double_t scalefactor = 1;
    1898         //      XY searchcenter(sgcenter.GetX(),sgcenter.GetY());
    1899         XY searchcenter(60.,290.);
    1900 
    1901         cameraspot = FindRoqueLamp(f, f2, sgcenter, t, imageclean, boxradius, searchcenter);
    1902 
    1903         if (fOutRq)
    1904         {
    1905             ZdAz pos = fCosy->GetPointingPos();
    1906 
    1907             *fOutRq << "RoqueLampReflected: "  << MTime(-1) << "  "
    1908                 << pos.Zd() << " " << pos.Az() << "   "
    1909                 << cameraspot.X() << " " << cameraspot.Y() << endl;
    1910         }
    1911 
    1912         cout << ">>>>> Spot on Magic camera found at: >>>>> (" << cameraspot.X() << ","
    1913              << cameraspot.Y() << ") <<<<<" << endl;
    1914 
    1915         f2.DrawCircle(sgcenter, 5.0, 0x0fa);
    1916         f2.DrawCircle(sgcenter, 115.0, 0x0fa);
    1917     }
    1918     // we calculate the offset given by the three ETH Leds visible to
    1919     // the guide camera
    1920     // This is an (inferior, obsolete) alternative to the StarCaosFilter
    1921     // Led offset;
    1922     // if (fDisplay->IsEntryChecked(IDM_kStargLEDFilter))       
    1923     //  fStargLeds->Run(img,offset);
    1924 
    1925     // Position corresponding to the camera center (53.2, 293.6)
    1926     //Ring skycenter(392, 318);
    1927     // MStarList spots;
     1799        sgcenter = fStargCaos->Run(img, kFALSE, kFALSE, pos, t); // [px]
     1800
     1801        numleds  = fStargCaos->GetNumDetectedLEDs();
     1802        numrings = fStargCaos->GetNumDetectedRings();
     1803    }
    19281804
    19291805    // we obtain a list of stars in the FOV from the SAO catalog
     
    19321808        MTime time(*tm);
    19331809
    1934         XY xy = fCRaDec->GetCoordinates();  //[h,  deg]
    1935         fRaDec->Set(xy.X()*360/24, xy.Y()); //[deg,deg]
     1810        XY xy = fCRaDec->GetCoordinates();  //[h,  deg]
     1811        fRaDec->Set(xy.X()*15, xy.Y());    //[deg,deg]
    19361812
    19371813        UpdatePosZoom();
     
    19411817        fCZdAz->SetCoordinates(fSao->GetZdAz());
    19421818
    1943         MStarList stars;
    19441819        fSao->SetBox(230); // Region of interest around center
    19451820
    1946         // very careful: If center of camera cannot be determined
    1947         // sgcenter jumps to (0,0) 
    1948 
    1949         //Please never change this offsets!!!
    1950         // 53.2 and 293.6 are the "preliminary" camera center
    1951         // -9 and 28.5 are the offsets of the pointing position in the sky
    1952 
     1821        // If center of camera cannot be determined sgcenter is (0,0)
    19531822        const Bool_t centerisvalid = sgcenter.GetX()>0 && sgcenter.GetY()>0;
    19541823//        if (centerisvalid)
     
    19561825//                            sgcenter.GetY() - 293.6);
    19571826
     1827        // We determine the ideal starfield using camera sagging info
     1828        // from the LEDs
     1829        //Please never change this offsets!!!
     1830        // 53.2 and 293.6 are the "preliminary" camera center
     1831        // -9 and 28.5 are the offsets of the pointing position in the sky
     1832        const XY off(sgcenter.GetX()- 53.2-9,
     1833                     sgcenter.GetY()-293.6+28.5);
     1834
    19581835        // we obtain stars in the effective star FOV and draw them.
    19591836        // coordinates are video frame coords.
    1960         // We determine the ideal starfield using camera sagging info
    1961         // from the LEDs
    1962         const XY off(sgcenter.GetX()- 53.2-9,
    1963                      sgcenter.GetY()-293.6+28.5);
    1964 
     1837        MStarList stars;
    19651838        fSao->CalcStars(stars, 530, 292, TMath::FloorNint(off.X()), TMath::FloorNint(off.Y()));
    19661839        fSao->DrawStars(stars, cimg);
     
    20151888
    20161889            if (fOperations->IsEntryChecked(IDM_kStargAnalysis))
    2017                 fStargHistograms->Fill(spots, stars, fD,
    2018                                        fSao->GetZdAz(), sgcenter, /*sgcenterzdaz,*/
    2019                                        star, bright, fPos, t);
     1890                fStargHistograms->Fill(spots, stars, fD, fSao->GetZdAz(),
     1891                                       sgcenter, bright, fPos, t);
    20201892
    20211893            fNumStarsDetected   = numstars;
     
    20281900                    com->SendStargReport(fStatus, fD, fSao->GetZdAz(),
    20291901                                         sgcenter, numstars, rc, bright,
    2030                                          time.GetMjd(), 0, 0);    // Report
     1902                                         time.GetMjd(), numleds, numrings);    // Report
    20311903            }
    20321904
     
    20681940    if (fDisplay->IsEntryChecked(IDM_kCaosFilter) ||
    20691941        fDisplay->IsEntryChecked(IDM_kCatalog)    ||
    2070         fDisplay->IsEntryChecked(IDM_kFindStar)   ||
    2071         fOperations->IsEntryChecked(IDM_kRoqueLampAna))
     1942        fDisplay->IsEntryChecked(IDM_kFindStar))
    20721943        fImage->DrawColImg(img, cimg);
    20731944    else
  • trunk/MagicSoft/Cosy/main/MStarguider.h

    r8821 r9435  
    2121class TGButton;
    2222class TString;
    23 class TSocket;
     23//class TSocket;
    2424
    2525class TTimer;
     
    111111    MCaos         *fCaos;
    112112    MCaos         *fStargCaos;
    113     TSocket       *fAmcSocket;
    114113    MStargHistograms *fStargHistograms;
    115114   
     
    133132    Double_t fLastBright;
    134133
    135     void SetPixSize(const double pixsize);
     134    Double_t fRadius; // LED radius [cm]
     135
     136    Int_t fTPointFromCC;
     137
    136138    void Toggle(TGPopupMenu *p, UInt_t id);
    137139    void SwitchOff(TGPopupMenu *p, UInt_t id);
     
    141143    void ToggleCaosFilter();
    142144    void SetChannel();
    143     //void GetCoordinates();
    144145    Int_t CalcTrackingError(Leds &, MStarList &, ZdAz &, MTime &, double &bright, Int_t &num);
    145     //void CalcTrackingError(Leds &, MStarList &);
    146146    ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag, Int_t &num) const;
    147147    bool Interpolate(const unsigned long n, byte *img) const;
     148    void FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t);
    148149
    149     XY FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t,
    150                      Double_t cut, Int_t box, XY SearchCenter);
    151 
    152     ZdAz FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t,
    153                   Double_t cut, Int_t box, Double_t scalefactor);
    154 
    155     //void InitHists();
    156     //void InitGraphs();
    157150    void InitGui(Int_t channel);
    158151
    159     bool SendAmcTrigger(const char *msg);
    160 
    161     //void OpenFile();
    162 
    163     //void ResetHists();
    164     //void DisplayAnalysis();
    165152    void UpdatePosZoom();
     153    void DrawZoomImage(const byte *img);
     154    void DrawCosyImage(const byte *img);
    166155
    167156    Bool_t HandleTimer(TTimer *t);
    168     //Bool_t HandleKey(Event_t* event);
     157
     158    void SetRotationAngle(Double_t angle);
     159    void SetPixSize(Double_t size);
     160    void SetCut(Double_t cut);
     161
     162    Bool_t DoTPoint();
    169163
    170164public:
     
    172166    virtual ~MStarguider();
    173167
    174     //void Update();
     168    void SetupEnv(TEnv &env);
    175169
    176170    void Layout();
     
    180174
    181175    Bool_t HandleDoubleClick(Event_t *event);
    182     //Bool_t HandleButton(Event_t *);
    183176
    184177    void SetPointingPosition(RaDec rd);
     
    195188    void Print(Option_t *o) const { }
    196189
     190    void StartTPoint() { if (fTPointFromCC<0) fTPointFromCC=0; }
     191    void StartStarguider();
     192
    197193    ClassDef(MStarguider, 0)
    198194};
  • trunk/MagicSoft/Cosy/main/MTracking.cc

    r9132 r9435  
    44
    55#include "dkc.h"
    6 #include "shaftencoder.h"
     6//#include "shaftencoder.h"
    77
    88#include "MCosy.h"
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc

    r9432 r9435  
    4242bool MCeCoCom::InterpreteReport(TString &str)
    4343{
     44    if (!str.EndsWith("OVER"))
     45    {
     46        cout << "Communication Problem: Termination (OVER) not found." << endl;
     47        fComStat = kComProblem;
     48        return false;
     49    }
     50
    4451    int y, m, d, h, min, s, ms, len;
    4552
     
    7481        return false;
    7582    }
     83/*
    7684    str.Remove(0, len);
    7785
     
    8290        return false;
    8391    }
     92 */
    8493
    8594    fHumidity = hum;
     
    142151
    143152    // Send report to CC
    144     const bool rc = Send(msg, strlen(msg));
     153    const bool rc = Send(msg.Data(), msg.Length());
    145154    fComStat = rc ? kNoCmdReceived : kComProblem;
    146155
  • trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc

    r8998 r9435  
    148148{
    149149    cout << "CC-COMMAND " << MTime(-1) << " TPOIN " << str << endl;
     150
     151    if (fQueue)
     152        fQueue->PostMsg(WM_TPOINT);//, (void*)str.Data(), str.Length()+1);
     153
     154    return true;
     155}
     156
     157bool MDriveCom::CommandSTGMD(TString &str)
     158{
     159    cout << "CC-COMMAND " << MTime(-1) << "STGMD" << endl;
     160
     161    if (fQueue)
     162        fQueue->PostMsg(WM_STARGMODE);//, (void*)str.Data(), str.Length()+1);
     163
    150164    return true;
    151165}
     
    220234    if (cmd==(TString)"ARM")
    221235        return CommandARM(str);
     236
     237    if (cmd==(TString)"STGMD")
     238        return CommandSTGMD(str);
    222239
    223240    if (cmd.IsNull() && str.IsNull())
     
    278295    str += armed ? "1 " : "0 ";
    279296
    280     return SendRep("DRIVE-REPORT", str, kFALSE);
     297    return SendRep("DRIVE-REPORT", str.Data(), kFALSE);
    281298}
    282299
     
    286303}
    287304
    288 bool MDriveCom::SendStargReport(UInt_t stat, ZdAz miss, ZdAz nompos, Ring center, Int_t num, Int_t n, Double_t bright, Double_t mjd, Double_t x, Double_t y)
     305bool MDriveCom::SendStargReport(UInt_t stat, ZdAz miss, ZdAz nompos, Ring center, Int_t num, Int_t n, Double_t bright, Double_t mjd, Int_t numleds, Int_t numrings)
    289306{
    290307    // miss   [deg]
     
    305322    str += MString::Format("%05.3f ", miss.Zd());       //[arcmin]
    306323    str += MString::Format("%05.3f ", miss.Az());       //[arcmin]
    307     Print(str, nompos.Zd());                      //[deg]
    308     Print(str, nompos.Az());                      //[deg]
    309     str += MString::Format("%05.1f ",   center.GetX()); //number
    310     str += MString::Format("%05.1f ",   center.GetY()); //number
    311     str += MString::Format("%04d ",   n);               //number of correleated stars
    312     str += MString::Format("%03.1f ",  bright);
     324    Print(str, nompos.Zd());                            //[deg]
     325    Print(str, nompos.Az());                            //[deg]
     326    str += MString::Format("%05.1f ",   center.GetX()); //
     327    str += MString::Format("%05.1f ",   center.GetY()); //
     328    str += MString::Format("%04d ",   n);               // number of correleated stars
     329    str += MString::Format("%03.1f ",  bright);         // arbitrary sky brightness
    313330    str += MString::Format("%12.6f ", t.GetMjd());      // mjd
    314     str += MString::Format("%.1f ", x);
    315     str += MString::Format("%.1f ", y);
    316     str += MString::Format("%04d ", num);               //number of detected stars
     331    str += MString::Format("%d ", numleds);             // number of detected leds
     332    str += MString::Format("%d ", numrings);            // number of detected rings
     333    str += MString::Format("%04d ", num);               // number of detected stars
    317334
    318335    return SendRep("STARG-REPORT", str, kTRUE);
     
    321338bool MDriveCom::SendTPoint(UInt_t stat)
    322339{
     340    //const MTime t(-1);
     341
     342    SetStatus(stat);
    323343    /*
    324     // miss   [deg]
    325     // nompos [deg]
    326     const MTime t(-1);
    327 
    328     miss *= 60;        // [arcmin]
    329 
    330     // Set status flag
    331     if (stat&kError)
    332         SetStatus(0);
    333     if (stat&kStandby)
    334         SetStatus(2);
    335     if (stat&kMonitoring)
    336         SetStatus(4);
    337    
    338     MString txt;
    339 
    340     TString str;
    341     str += txt.Print("%05.3f ", miss.Zd());       //[arcmin]
    342     str += txt.Print("%05.3f ", miss.Az());       //[arcmin]
    343     Print(str, nompos.Zd());                      //[deg]
    344     Print(str, nompos.Az());                      //[deg]
    345     str += txt.Print("%05.1f ",   center.GetX()); //number
    346     str += txt.Print("%05.1f ",   center.GetY()); //number
    347     str += txt.Print("%04d ",   n);               //number of correleated stars
    348     str += txt.Print("%03.1f ",  bright);
    349     str += txt.Print("%12.6f ", t.GetMjd());      // mjd
    350     str += txt.Print("%.1f ", x);
    351     str += txt.Print("%.1f ", y);
    352     str += txt.Print("%04d ", num);               //number of detected stars
    353     */
    354 
     344     TString str;
     345     str += name;  // star name
     346     str += " ";
     347     str += nominalaz;
     348     str += nominalel;
     349     str += realaz;
     350     str += realel;
     351     str += nomra;
     352     str += nomdec;
     353     str += diffaz;
     354     str += diffel;
     355     str += mjd;
     356     str += numleds;
     357     str += artmag;
     358     */
    355359    return SendRep("TPOINT-REPORT", "", kTRUE);
    356360}
  • trunk/MagicSoft/Cosy/tcpip/MDriveCom.h

    r8869 r9435  
    2929    bool CommandARM(TString &str);
    3030    bool CommandTPOINT(TString &str);
     31    bool CommandSTGMD(TString &str);
    3132
    3233public:
     
    4950
    5051    bool SendReport(UInt_t stat, RaDec rd, ZdAz so, ZdAz is, ZdAz er, Bool_t armed);
    51     bool SendStargReport(UInt_t stat, ZdAz miss, ZdAz nompos, Ring center, Int_t num, Int_t n, Double_t bright, Double_t mjd, Double_t x, Double_t y);
     52    bool SendStargReport(UInt_t stat, ZdAz miss, ZdAz nompos, Ring center, Int_t num, Int_t n, Double_t bright, Double_t mjd, Int_t numleds, Int_t numrings);
    5253    bool SendTPoint(UInt_t stat);
    5354    bool SendStatus(const char *stat);
Note: See TracChangeset for help on using the changeset viewer.