Changeset 1111


Ignore:
Timestamp:
12/12/01 13:26:34 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
1 added
1 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r926 r1111  
    11                                                                  -*-*- END -*-*-
     2
     3 2001/12/12 - Thomas Bretz:
     4 
     5   * base/coord.h:
     6     - added constants for unit transformations
     7 
     8   * base/msgqueue.h:
     9     - replaced pthread.h by thread.h
     10
     11   * base/timer.h:
     12     - removed unistd.h
     13     - added forward declaration for timeval
     14
     15   * candrv/CandrvLinkDef.h:
     16     - added VmodIcan
     17     - added CanOpen
     18     - added Network
     19     - added NodeDrv
     20     - added PendingSDO
     21     - added PendingSDOList
     22 
     23   * candrv/nodedrv.h, candrv/sdolist.h, candrv/vmodican.h,
     24     videodev/Camera.h, videodev/Writer.h:
     25     - added ClassDef
     26     - added some declarations for __CINT__ case
     27
     28   * base/MThread.h:
     29     - added some declarations for __CINT__ case
     30
     31   * base/threads.h:
     32     - added
     33
     34   * catalog/CatalogLinkDef.h:
     35     - added Slalib+
     36     - added SlaStars+
     37     - added SlaPlanets+
     38     - added SaoFile+
     39     - added StarCatalog+
     40
     41   * catalog/SlaStars.h:
     42     - added ClassDef
     43     - included coord.h for coordation tranformations
     44
     45   * catalog/SlaStars.cc, catalog/Slalib.cc, gui/MGSkyPosition.cc:
     46     - added ClassImp
     47     - changed slalib macros to coord.h constants
     48 
     49   * catalog/StarCatalog.h:
     50     - added ClassDef
     51     - changed slalib macros to coord.h constants
     52
     53   * devdrv/DevdrvLinkDef.h:
     54     - added Macs+;
     55     - added ShaftEncoder+;
     56
     57   * gui/GuiIncl.h:
     58     - added coord.h
     59 
     60   * gui/GuiLinkDef.h:
     61     - added MGAccuracy+;
     62     - added MGCoordinate+;
     63     - added MGCoordinates+;
     64     - added MGEmbeddedCanvas+;
     65     - added MGImage+;
     66     - added MGSkyPosition+;
     67     - added MGVelocity+;
     68     - added MGCosy+;
     69     - added MGStarguider+;
     70
     71   * gui/MGCoordinate.[h,cc]:
     72     - changed Flist to pointer type
     73
     74   * gui/MGCosy.cc:
     75     - added ClassImp
     76     - fixed a bug which causes 'Exit' not to work
     77     - changed slalib macros to coord.h constants
     78
     79   * gui/MGCosy.h:
     80     - added ClassDef
     81 
     82   * gui/MGEmbeddedCanvas.h:
     83     - added ClassImp
     84     - removed consts
     85 
     86   * gui/MGStarguider.[h,cc]:
     87     - added ClassImp/Def
     88     - change fList to pointer type
     89     - change fRaDec to pinter type
     90     - changed fSao to pointer type
     91
     92   * main/MCosy.[h,cc]:
     93     - added ClassImp
     94     - changed order
     95     - added comments
     96     - changed slalib macros to coord.h constants
     97     - changed defines to enums
     98 
     99   * main/MainCint.h:
     100     - removed
     101 
     102   * main/MainLinkDef.h:
     103     - added MCosy
     104
     105   * devdrv/Makefile, candrv/Makefile, catalog/Makefile, gui/Makefile,
     106     main/Makefile, videodev/Makefile:
     107     - added CINTHEADERS
     108
     109   * candrv/canopen.cc, candrv/network.cc,candrv/nodedrv.cc, candrv/sdolist.cc
     110     candrv/vmodican.cc, catalog/SaoFile.cc, catalog/SlaPlanets.cc,
     111     catalog/StarCatalog.cc, devdrv/macs.cc, devdrv/shaftencoder.cc,
     112     gui/MGAccuracy.cc, gui/MGCoordinate.cc, gui/MGCoordinates.cc,
     113     gui/MGEmbeddedCanvas.cc, gui/MGImage.cc, gui/MGVelocity.cc,
     114     videodev/Camera.cc, videodev/Filter.cc, videodev/Writer.cc:
     115     - added ClassImp
     116
     117   * candrv/network.h, catalog/SaoFile.h, catalog/SlaPlanets.h,
     118     catalog/Slalib.h, devdrv/macs.h, devdrv/shaftencoder.h,
     119     gui/MGAccuracy.h, gui/MGCoordinate.h, gui/MGCoordinates.h,
     120     gui/MGImage.h, gui/MGSkyPosition.h, gui/MGVelocity.h,
     121     videodev/Filter.h:
     122     - added ClassDef
     123
     124   * videodev/VideodevLinkDef.h:
     125     - added Writer+;
     126     - added Filter+;
     127     - added Camera+;
     128
     129
    2130
    3131 2001/09/10 - Thomas Bretz:
     
    28156
    29157
    30      
     158
    31159 2001/09/07 - Thomas Bretz:
    32160 
  • trunk/MagicSoft/Cosy/base/MThread.h

    r910 r1111  
    22#define MTHREAD_H
    33
     4#ifdef __CINT__
     5typedef unsigned long int pthread_t;
     6#else
    47#include <pthread.h>
     8#endif
    59
    6 class MThread 
     10class MThread
    711{
    812private:
  • trunk/MagicSoft/Cosy/catalog/StarCatalog.h

    r912 r1111  
    7373                  const AltAz &altaz);
    7474
    75     const AltAz GetAltAz() const { return fAltAz*360/D2PI; }
    76     const ZdAz  GetZdAz() const  { return ZdAz(DPI/2-fAltAz.Alt(), fAltAz.Az())*360/D2PI; }
    77     const RaDec GetRaDec() const { return fRaDec*360/D2PI; }
     75    const AltAz GetAltAz() const { return fAltAz*kRad2Deg; }
     76    const ZdAz  GetZdAz() const  { return ZdAz(kPiDiv2-fAltAz.Alt(), fAltAz.Az())*kRad2Deg; }
     77    const RaDec GetRaDec() const { return fRaDec*kRad2Deg; }
    7878
    7979    void  SetPixSize(const double pixsize);
    8080    void  SetLimitMag(const float mag) { fLimitMag = mag; };
     81
     82    ClassDef(StarCatalog, 0)
    8183};
    8284
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.cc

    r921 r1111  
    1818
    1919#include "coord.h"
     20
     21ClassImp(MGAccuracy);
    2022
    2123void MGAccuracy::DrawCoordinateSystem()
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.h

    r918 r1111  
    1212#endif
    1313
    14 class TList;
    1514class TLine;
    1615class TText;
    17 class TCanvas;
    1816
    1917class ZdAz;
    20 class SlaPlanets;
    2118
    2219class MGAccuracy : public MGEmbeddedCanvas
     
    4037
    4138    void Update(ZdAz &pos, ZdAz &acc);
     39
     40    ClassDef(MGAccuracy, 0)
    4241};
    4342
  • trunk/MagicSoft/Cosy/gui/MGCoordinate.cc

    r921 r1111  
    1717#include "slamac.h"
    1818
     19ClassImp(MGCoordinate);
     20
    1921enum {
    2022    IDM_kDeg,
     
    2830: TGFrame(p, 119, flag?76:46, kSunkenFrame|kFixedSize), fDeg(deg), fMin(min), fSec(sec)
    2931{
     32    fList = new MGList;
     33
    3034    // p = pointer to MainFrame (not owner)
    3135    if (flag)
     
    4347        fTextEntryMin->MapWindow();
    4448        fTextEntrySec->MapWindow();
    45         fList.Add(fTextEntrySec);
    46         fList.Add(fTextEntryMin);
    47         fList.Add(fTextEntryDeg);
     49        fList->Add(fTextEntrySec);
     50        fList->Add(fTextEntryMin);
     51        fList->Add(fTextEntryDeg);
    4852
    4953        Set(fTextEntryDeg, fDeg);
     
    6670    fLabelMin->MapWindow();
    6771    fLabelSec->MapWindow();
    68     fList.Add(fLabelSec);
    69     fList.Add(fLabelDeg);
    70     fList.Add(fLabelMin);
     72    fList->Add(fLabelSec);
     73    fList->Add(fLabelDeg);
     74    fList->Add(fLabelMin);
    7175
    7276    Set(fLabelDeg, fDeg);
     
    7882    fLabel->Move(4, 4);
    7983    fLabel->MapWindow();
    80     fList.Add(fLabel);
     84    fList->Add(fLabel);
    8185
    8286    TGLabel *label;
     
    9296        label->Move(39, 26);
    9397        label->MapWindow();
    94         fList.Add(label);
     98        fList->Add(label);
    9599
    96100        label = new TGLabel(this, min);
     
    98102        label->Move(73, 26);
    99103        label->MapWindow();
    100         fList.Add(label);
     104        fList->Add(label);
    101105
    102106        label = new TGLabel(this, sec);
     
    104108        label->Move(107, 26);
    105109        label->MapWindow();
    106         fList.Add(label);
     110        fList->Add(label);
    107111    }
    108112
     
    111115    label->Move(39, ypos);
    112116    label->MapWindow();
    113     fList.Add(label);
     117    fList->Add(label);
    114118
    115119    label = new TGLabel(this, min);
     
    117121    label->Move(73, ypos);
    118122    label->MapWindow();
    119     fList.Add(label);
     123    fList->Add(label);
    120124 
    121125    label = new TGLabel(this, sec);
     
    123127    label->Move(107, ypos);
    124128    label->MapWindow();
    125     fList.Add(label);
     129    fList->Add(label);
    126130
    127131    MapWindow();
     
    130134MGCoordinate::~MGCoordinate()
    131135{
    132     //    cout << "MGCoordinate destroyed." << endl;
     136    delete fList;
    133137}
    134138
  • trunk/MagicSoft/Cosy/gui/MGCoordinate.h

    r921 r1111  
    2929    Int_t fSec;
    3030
    31     MGList fList;
     31    MGList *fList;
    3232
    3333    TGTextEntry *fTextEntryDeg;
     
    5757
    5858    void Print();
     59
     60    ClassDef(MGCoordinate, 0)
    5961};
    6062
  • trunk/MagicSoft/Cosy/gui/MGCoordinates.cc

    r921 r1111  
    1010
    1111#include "MGCoordinate.h"
     12#include "coord.h"
     13
     14ClassImp(MGCoordinates);
    1215
    1316MGCoordinates::MGCoordinates(const TGWindow* p,
  • trunk/MagicSoft/Cosy/gui/MGCoordinates.h

    r921 r1111  
    1111#include <TGFrame.h>
    1212#endif
    13 #ifndef COORD_H
    14 #include "coord.h"
    15 #endif
     13
     14class XY;
    1615
    1716enum {
     
    3837
    3938    void Print();
     39
     40    ClassDef(MGCoordinates, 0)
    4041};
    4142
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r926 r1111  
    44
    55#include "msgqueue.h"
     6#include "coord.h"
    67
    78#include <TROOT.h>
     
    2829#include "SlaStars.h"
    2930
     31ClassImp(MGCosy);
     32
    3033#define IDM_EXIT 1
    3134#define IDM_TEXT 2
     
    5053    //
    5154    TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
    52     fFileMenu->AddEntry ("Exit", IDM_EXIT) ;
    53     //fFileMenu->Associate(this);
     55    fFileMenu->AddEntry("Exit", IDM_EXIT);
     56    fFileMenu->Associate(this);
    5457    fList->Add(fFileMenu);
    5558
     
    516519
    517520                    cout << "Ra/Dec: " << rd.Ra() << kDEG << " " << rd.Dec() << kDEG << endl;
    518                     ZdAz aa=sla.CalcZdAz(rd*D2PI/360.0)*360.0/D2PI;
     521                    ZdAz aa=sla.CalcZdAz(rd*kDeg2Rad)*kRad2Deg;
    519522                    cout << "Zd/Az: " << aa.Zd() << kDEG << " " << aa.Az() << kDEG << endl;
    520523                }
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r921 r1111  
    66#endif
    77
    8 //#ifndef ROOT_TOrdCollection
    9 //#include <TOrdCollection.h>
    10 //#endif
    11 
    12 #ifndef ROOT_TGWidget
    13 #include <TGWidget.h>
    14 #endif
    15 
    16 #include <iostream.h>
    17 
    18 #include "coord.h"
     8class TIterator;
    199
    2010class TGLabel;
     
    2313class TGHorizontal3DLine;
    2414class TGLayoutHints;
     15class TGCompositeFrame;
     16class TGTab;
     17class TGListBox;
     18
     19class ZdAz;
     20class RaDec;
    2521class MsgQueue;
    26 class TIterator;
     22
    2723class MGImage;
    2824class MGList;
     
    3127class MGAccuracy;
    3228class MGVelocity;
    33 class TGCompositeFrame;
    34 class TGTab;
    35 class TGListBox;
    3629
    3730class MGCosy : public TGMainFrame
     
    9992
    10093    Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
     94
     95    ClassDef(MGCosy, 0)
    10196};
    10297
  • trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc

    r920 r1111  
    99#include <TList.h>
    1010#include <TCanvas.h>
     11
     12ClassImp(MGEmbeddedCanvas);
    1113
    1214MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p,
  • trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h

    r913 r1111  
    2626    TList      *fList;
    2727
    28     const UInt_t  fWidth;
    29     const Float_t fRange;
    30     const Float_t fPix;
     28    UInt_t  fWidth; // const: rootcint/TMemberInspector
     29    Float_t fRange; // const: rootcint/TMemberInspector
     30    Float_t fPix;   // const: rootcint/TMemberInspector
    3131
    3232    void InitCanvas();
     
    4040
    4141    void SetModified() { fModified = kTRUE; }
     42
     43    ClassDef(MGEmbeddedCanvas, 0)
    4244};
    4345
  • trunk/MagicSoft/Cosy/gui/MGImage.cc

    r808 r1111  
    1111#include <iostream.h>
    1212#include <pthread.h>
     13
     14ClassImp(MGImage);
    1315
    1416MGImage::MGImage(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options, ULong_t back)
  • trunk/MagicSoft/Cosy/gui/MGImage.h

    r808 r1111  
    4242    void DrawImg(const byte *buffer);
    4343    void DrawColImg(const byte *gbuf, const byte *cbuf);
     44
     45    ClassDef(MGImage, 0)
    4446};
    4547
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc

    r921 r1111  
    1717#include "coord.h"
    1818#include "SlaPlanets.h"
     19
     20ClassImp(MGSkyPosition);
    1921
    2022void MGSkyPosition::InitPlanets()
     
    208210    static int Ry=~0;
    209211
    210     const float rad = D2PI*az/360.0;
     212    const float rad = az*kDeg2Rad;
    211213
    212214    const float s = sin(rad);
     
    306308    const float c = cos(zdaz.Az());
    307309
    308     const float deg = 360.0/D2PI*zdaz.Zd();
     310    const float deg = zdaz.Zd()*kRad2Deg;
    309311
    310312    const float x = s*deg;
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.h

    r913 r1111  
    5858
    5959    void Update(ZdAz &pos);
     60
     61    ClassDef(MGSkyPosition, 0)
    6062};
    6163
  • trunk/MagicSoft/Cosy/gui/MGStarguider.cc

    r924 r1111  
    1010#include "MGCoordinates.h"
    1111
     12#include "coord.h"
     13
     14#include "StarCatalog.h"
     15
    1216#include "Filter.h"
    1317#include "Writer.h"
    1418#include "base/timer.h"
     19
     20ClassImp(MGStarguider);
    1521
    1622enum {
     
    4248
    4349MGStarguider::MGStarguider()
    44 : Camera(), TGMainFrame(gClient->GetRoot(), 768, 700), fRaDec(180, 40)
    45 {
     50: Camera(), TGMainFrame(gClient->GetRoot(), 768, 700)
     51{
     52    fList = new MGList;
     53
     54    fSao = new StarCatalog;
     55    fRaDec = new RaDec(180, 40);
     56
    4657    // p = pointer to MainFrame (not owner)
    4758
     
    5566    fDisplay->AddEntry("Sao &Catalog", IDM_kCatalog);
    5667    fDisplay->Associate(this);
    57     fList.Add(fDisplay);
     68    fList->Add(fDisplay);
    5869
    5970    fFileType = new TGPopupMenu(p);
     
    6273    fFileType->CheckEntry(IDM_kPNG);
    6374    fFileType->Associate(this);
    64     fList.Add(fFileType);
     75    fList->Add(fFileType);
    6576
    6677    fWriteType = new TGPopupMenu(p);
     
    6980    fWriteType->CheckEntry(IDM_kOnce);
    7081    fWriteType->Associate(this);
    71     fList.Add(fWriteType);
     82    fList->Add(fWriteType);
    7283
    7384    fWriteRate = new TGPopupMenu(p);
     
    8192    fWriteRate->CheckEntry(IDM_kRate1m);
    8293    fWriteRate->Associate(this);
    83     fList.Add(fWriteRate);
     94    fList->Add(fWriteRate);
    8495
    8596    fWrtRate = 25*60;
     
    94105    fWrite->DisableEntry(IDM_kStop);
    95106    fWrite->Associate(this);
    96     fList.Add(fWrite);
     107    fList->Add(fWrite);
    97108
    98109    fLimMag = new TGPopupMenu(p);
     
    106117    fLimMag->CheckEntry(IDM_kLimMag8);
    107118    fLimMag->Associate(this);
    108     fList.Add(fLimMag);
    109 
    110     fSao.SetLimitMag(8.0);
     119    fList->Add(fLimMag);
     120
     121    fSao->SetLimitMag(8.0);
    111122
    112123    fSetup = new TGPopupMenu(p);
    113124    fSetup->AddPopup("Lim. &Magnitude", fLimMag);
    114125    fSetup->Associate(this);
    115     fList.Add(fSetup);
     126    fList->Add(fSetup);
    116127
    117128    fMenu = new TGMenuBar(this, 0, 0, kHorizontalFrame);
     
    121132    fMenu->Resize(fMenu->GetDefaultSize());
    122133    AddFrame(fMenu); //, new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0));
    123     fList.Add(fMenu);
     134    fList->Add(fMenu);
    124135
    125136    fCRaDec = new MGCoordinates(this, kETypeRaDec);
    126137    fCRaDec->Move(1, fMenu->GetDefaultHeight()+584);
    127138    AddFrame(fCRaDec);
    128     fList.Add(fCRaDec);
     139    fList->Add(fCRaDec);
    129140
    130141    fCZdAz = new MGCoordinates(this, kETypeZdAz);
    131142    fCZdAz->Move(240+12, fMenu->GetDefaultHeight()+584);
    132143    AddFrame(fCZdAz);
    133     fList.Add(fCZdAz);
     144    fList->Add(fCZdAz);
    134145
    135146    // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
    136147    // AddFrame(fLineSep, new TGLayoutHints (kLHintsNormal | kLHintsExpandX));
    137     // fList.Add(fLineSep);
     148    // fList->Add(fLineSep);
    138149
    139150    //
     
    143154    fImage->Move(0, fMenu->GetDefaultHeight());
    144155    AddFrame(fImage);
    145     fList.Add(fImage);
     156    fList->Add(fImage);
    146157
    147158    //
     
    154165    MapWindow();
    155166
    156     fSao.SetPixSize(0.006);
     167    fSao->SetPixSize(0.006);
    157168}
    158169
    159170MGStarguider::~MGStarguider()
    160171{
     172    delete fSao;
     173    delete fRaDec;
     174
     175    delete fList;
    161176    cout << "Camera Display destroyed." << endl;
    162177}
     
    281296                        fLimMag->UnCheckEntry(i);
    282297
    283                 fSao.SetLimitMag(mp1-IDM_kLimMag3+3);
     298                fSao->SetLimitMag(mp1-IDM_kLimMag3+3);
    284299                return kTRUE;
    285300            }
     
    331346            XY xy = fCRaDec->GetCoordinates();
    332347
    333             fRaDec.Set(xy.X(), xy.Y());
     348            fRaDec->Set(xy.X(), xy.Y());
    334349
    335350            Timer time(tm);
    336             fSao.GetImg(img, cimg, time.CalcMjd(), fRaDec);
     351            fSao->GetImg(img, cimg, time.CalcMjd(), *fRaDec);
    337352            fImage->DrawColImg(img, cimg);
    338353
    339             fCZdAz->SetCoordinates(fSao.GetZdAz());
     354            fCZdAz->SetCoordinates(fSao->GetZdAz());
    340355        }
    341356        else
  • trunk/MagicSoft/Cosy/gui/MGStarguider.h

    r924 r1111  
    1111#include "MGList.h"
    1212#include "MGImage.h"
    13 #include "StarCatalog.h"
     13
     14class RaDec;
    1415
    1516class TGMenuBar;
     
    1920class MGCoordinates;
    2021
     22class StarCatalog;
     23
    2124class MGStarguider : public Camera, public TGMainFrame
    2225{
    2326private:
    24     MGList         fList;
     27    MGList        *fList;
    2528
    2629    TGMenuBar     *fMenu;
     
    3841    MGCoordinates *fCZdAz;
    3942
    40     StarCatalog    fSao;
     43    StarCatalog   *fSao;
    4144
    42     RaDec fRaDec;
     45    RaDec *fRaDec;
    4346
    4447    int fWrtRate;
     
    5053    virtual ~MGStarguider();
    5154
    52     void Update();
     55    //void Update();
    5356
    5457    void Layout();
     
    6164    //
    6265    void ProcessFrame(const unsigned long n, byte *img, struct timeval *tm);
     66
     67    ClassDef(MGStarguider, 0)
    6368};
    6469
  • trunk/MagicSoft/Cosy/gui/MGVelocity.cc

    r921 r1111  
    2020#include "coord.h"
    2121
     22ClassImp(MGVelocity);
     23
    2224void MGVelocity::DrawCoordinateSystem()
    2325{
  • trunk/MagicSoft/Cosy/gui/MGVelocity.h

    r921 r1111  
    5151
    5252    void Update(ZdAz &pos);
     53
     54    ClassDef(MGVelocity, 0)
    5355};
    5456
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r926 r1111  
    2222//#include <sys/resource.h>  // PRIO_PROCESS
    2323
     24ClassImp(MCosy);
     25
    2426typedef struct tm tm_t;
    2527
     
    3234double Rad2SE(double rad)
    3335{
    34     return 16384.0/D2PI*rad;
     36    return 16384.0/k2Pi*rad;
    3537}
    3638
    3739double Rad2ZdRE(double rad)
    3840{
    39     return 16384.0/D2PI*rad*kGearRatio.X();
     41    return 16384.0/k2Pi*rad*kGearRatio.X();
    4042}
    4143
    4244double Rad2AzRE(double rad)
    4345{
    44     return 16384.0/D2PI*rad*kGearRatio.Y();
     46    return 16384.0/k2Pi*rad*kGearRatio.Y();
    4547}
    4648
     
    6870
    6971    ZdAz source = src * 360.0/16384.0;
    70     ZdAz dest   = dst * 360.0/D2PI;
     72    ZdAz dest   = dst * kRad2Deg;
    7173
    7274    if (dest.Zd()>-1e-6 && dest.Zd()<1e-6)
    73         return dst*(16384.0/D2PI);
     75        return dst*(16384.0/k2Pi);
    7476
    7577    const float fZdMin = -67;
     
    122124}
    123125
    124 
     126// --------------------------------------------------------------------------
     127//
     128//  GetSePos, reads the Shaftencoder positions from the Can-drivers
     129//  for the shaftencoders. The two shaft encoders at the elevation axis
     130//  are avaraged. The values are returned as a ZdAz object.
     131//
     132//  The positions are alway up-to-date because the shaftencoders are
     133//  sending all changes immediatly.
     134//
    125135ZdAz MCosy::GetSePos()
    126136{
     137    //
     138    // Get the values
     139    //
    127140    const int p0 = fZd1->GetPos();
    128141    const int p1 = fZd2->GetPos();
     
    144157}
    145158
     159// --------------------------------------------------------------------------
     160//
     161// request the current positions from the rotary encoders.
     162// use GetRePos to get the psotions. If the request fails the function
     163// returns kFALSE, otherwise kTRUE
     164//
     165Bool_t MCosy::RequestRePos()
     166{
     167    //
     168    // Send request
     169    //
     170    fMac2->RequestSDO(0x6004);
     171    fMac1->RequestSDO(0x6004);
     172
     173    //
     174    // Wait until the objects are received.
     175    //
     176    WaitForSdos();
     177
     178    //
     179    // If waitng was not interrupted everything is ok. return.
     180    //
     181    if (!StopWaitingForSDO())
     182        return kTRUE;
     183
     184    //
     185    // If the waiting was interrupted due to a network error,
     186    // print some logging message.
     187    //
     188    if (HasError())
     189        lout << "Error #6004 (requesting re pos from Macs) happened." << endl;
     190
     191    return kFALSE;
     192}
     193
     194// --------------------------------------------------------------------------
     195//
     196//  reads the Rotary encoder positions from the last request of the Macs.
     197//
     198//  The positions are returned as a ZdAz object. Use RequestRePos to request
     199//  the current positions first.
     200//
    146201ZdAz MCosy::GetRePos()
    147202{
     
    149204}
    150205
     206// --------------------------------------------------------------------------
     207//
     208//  reads the Rotary encoder positions from the Macs.
     209//
     210//  The positions are returned as a ZdAz object. The positions are the ones
     211//  which are send as PDOs to the computer. This is done at a given
     212//  frequency. Which means, that this positions are not ought to be
     213//  up-to-date.
     214//
    151215ZdAz MCosy::GetRePosPdo()
    152216{
     
    154218}
    155219
     220// --------------------------------------------------------------------------
     221//
     222//  set the velocity and accelerations for position maneuvers.
     223//
     224//  The acceleratin is set as given (in percent of maximum).
     225//  The velocity is given in percent, depending on the ratio (<1 or >1)
     226//  one of the axis becomes a slower velocity. This is used for maneuvers
     227//  in which both axis are moved synchromously and should reach their
     228//  target position at the same time.
     229//
    156230void MCosy::SetPosVelocity(const Float_t ratio, Float_t vel, Float_t acc)
    157231{
     
    186260}
    187261
     262// --------------------------------------------------------------------------
     263//
     264// Does a relative positioning.
     265//
     266// The steps to move are given in a ZdAz object relative to the current
     267// position. The coordinates are given in Roteryencoder steps.
     268// Axis 1 is moved only if axe1==kTRUE, Axis 2 is moved only
     269// if Axis 2==kTRUE. The function waits for the movement to be finished.
     270//
    188271void MCosy::DoRelPos(const ZdAz &rd, const Bool_t axe1, const Bool_t axe2)
    189272{
    190     SetStatus(kMoving);
     273    SetStatus(MCosy::kMoving);
    191274
    192275    if (axe1) fMac2->StartRelPos(rd.Zd());
     
    200283}
    201284
     285// --------------------------------------------------------------------------
     286//
     287// check for a break-signal (from the msgqueue) and errors.
     288//
     289int MCosy::StopWaitingForSDO() const
     290{
     291    return Break() || HasError();
     292}
     293
     294// --------------------------------------------------------------------------
     295//
     296// Waits for a movement to become finished.
     297//
     298// First waits for all peding Sdos, then waits until both motors are stopped
     299// or waiting for SDOs was stopped (either by an error or by Break)
     300//
     301void MCosy::WaitForEndMovement()
     302{
     303    WaitForSdos();
     304
     305    while ((fMac1->IsPositioning() || fMac2->IsPositioning()) && !StopWaitingForSDO())
     306        usleep(1);
     307}
     308
     309// --------------------------------------------------------------------------
     310//
     311// Check for an error...
     312//
     313// This is ment for usage after the Action: All Motors Stop.
     314//
    202315void MCosy::CheckForError()
    203316{
     317    //
     318    // Check all Can-Nodes for an Error. If there is no error the motor
     319    // status is set to stopped.
     320    //
    204321    if (!HasError())
    205322    {
    206         SetStatus(kStopped);
     323        SetStatus(MCosy::kStopped);
    207324        return;
    208325    }
    209326
    210     SetStatus(kError);
     327    //
     328    // If there is an error, the error status is set to Error.
     329    //
     330    SetStatus(MCosy::kError);
     331
     332    //
     333    // No try to handle the error.
     334    //
    211335    fMac1->HandleError();
    212336    fMac2->HandleError();
     337
     338    //
     339    // If the error couldn't get solved return
     340    //
    213341    if (HasError())
    214342        return;
    215343
    216     SetStatus(kStopped);
    217 }
    218 
     344    //
     345    // Set motor status to stopped
     346    //
     347    SetStatus(MCosy::kStopped);
     348}
     349
     350// --------------------------------------------------------------------------
     351//
     352// Move the telescope to the given position. The position must be given in
     353// a ZdAz object in rad.
     354//
     355// The first positioning is done absolutely. If we didn't reach the
     356// correct psotion we try to correct for this by 10 relative position
     357// maneuvers. If this doesn't help positioning failed.
     358//
     359// As a reference the shaftencoder values are used.
     360//
    219361int MCosy::SetPosition(const ZdAz &dst) // [rad]
    220362{
     
    296438}
    297439
    298 Bool_t MCosy::RequestRePos()
    299 {
    300 
    301     fMac2->RequestSDO(0x6004);
    302     fMac1->RequestSDO(0x6004);
     440// --------------------------------------------------------------------------
     441//
     442// Sets the tracking velocity
     443//
     444// The velocities are given in a ZdAz object in re/min. Return kTRUE
     445// in case of success, kFALSE in case of failure.
     446//
     447Bool_t MCosy::SetVelocity(ZdAz v)
     448{
     449    //
     450    // Send the new velocities for both axes.
     451    //
     452    fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd());  // SetRpmVelocity [re/min]
     453    fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az());  // SetRpmVelocity [re/min]
     454
     455    //
     456    // Wait for the objects to be OKed.
     457    //
    303458    WaitForSdos();
     459
     460    //
     461    // If the waiting for the objects wasn't interrupted return kTRUE
     462    //
    304463    if (!StopWaitingForSDO())
    305464        return kTRUE;
    306465
    307     if (HasError())
    308         lout << "Error #6004 (requesting re pos from Macs) happened." << endl;
    309 
    310     return kFALSE;
    311 }
    312 
    313 Bool_t MCosy::SetVelocity(ZdAz v)
    314 {
    315     fMac2->SendSDO(0x3006, 1, (LWORD_t)v.Zd());  // SetRpmVelocity [re/min]
    316     fMac1->SendSDO(0x3006, 1, (LWORD_t)v.Az());  // SetRpmVelocity [re/min]
    317     WaitForSdos();
    318     if (!StopWaitingForSDO())
    319         return kTRUE;
    320 
     466    //
     467    // print a message if the interruption was due to a Can-node Error
     468    //
    321469    if (HasError())
    322470        lout << "Error #3006 (setting velocity of Macs) happened." << endl;
     
    325473}
    326474
     475// --------------------------------------------------------------------------
     476//
     477// Initializes Tracking mode
     478//
     479// Initializes the accelerations of both axes with 90% of the maximum
     480// acceleration. Set the status for moving and tracking and starts thr
     481// revolution mode.
     482//
    327483void MCosy::InitTracking()
    328484{
     
    336492    fMac1->SetDeceleration(0.90*fMac1->GetVelRes());
    337493
    338     SetStatus(kMoving | kTracking);
     494    SetStatus(MCosy::kMoving | MCosy::kTracking);
    339495
    340496    fMac2->SetRpmMode(TRUE);
     
    342498}
    343499
     500// --------------------------------------------------------------------------
     501//
     502// Limits the speed.
     503//
     504// This function should work as a limiter. If a tracking error is too large
     505// to be corrected fast enough we would get enormous velocities. These
     506// velocities are limited to the maximum velocity.
     507//
    344508void MCosy::LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const
    345509{
     
    527691}
    528692
    529 int MCosy::IsPositioning() const
    530 {
    531     return (fMac1->IsPositioning() || fMac2->IsPositioning()) && !StopWaitingForSDO();
    532 }
    533 
    534 void MCosy::WaitForEndMovement()
    535 {
    536     WaitForSdos();
    537 
    538     while (IsPositioning())
    539         usleep(1);
    540 }
    541 
     693// --------------------------------------------------------------------------
     694//
     695// Stops the movement of both motors.
     696//
     697// Sets the status to stopping. Sets the deceleration to 50% of the maximum.
     698// stops. Quits the revolution mode and wait for the end of the movement.
     699//
    542700void MCosy::StopMovement()
    543701{
    544     SetStatus(kStopping);
    545 
     702    //
     703    // Set status to stopped
     704    //
     705    SetStatus(MCosy::kStopping);
     706
     707    //
     708    // set deceleration to 50%
     709    //
    546710    cout << "Stopping  positioning..." << endl;
    547711    fMac1->SetDeceleration(0.5*fMac1->GetVelRes());
    548712    fMac2->SetDeceleration(0.5*fMac2->GetVelRes());
    549713
    550     cout << "Stoping possible RPM mode..." << endl;
     714    //
     715    // Stop revolution mode (movement)
     716    //
     717    cout << "Stoping possibleRPM mode..." << endl;
    551718    fMac1->SetRpmMode(FALSE);
    552719    fMac2->SetRpmMode(FALSE);
    553720
     721    //
     722    // Wait for the movement to really be finished.
     723    //
    554724    cout << "Waiting for silence..." << endl;
    555725    WaitForEndMovement();
    556726
     727    //
     728    // Check whether everything works fine.
     729    //
    557730    CheckForError();
    558 
    559731    cout << "Movement stopped." << endl;
    560732}
     
    587759
    588760            RaDec rd(37.94, 89.2644);
    589             ZdAz za=sla.CalcZdAz(rd*D2PI/360.0)*16384.0/D2PI;
     761            ZdAz za=sla.CalcZdAz(rd*kDeg2Rad)*16384.0/k2Pi;
    590762
    591763            cout << "Calc Zd: " << za.Zd() << " Az: " << za.Az() << endl;
     
    607779            ZdAz dest = *((ZdAz*)mp);
    608780
    609             SetPosition(dest*D2PI/360.0);
     781            SetPosition(dest*kDeg2Rad);
    610782        }
    611783        cout << "WM_Position: done. (return 0x7777)" << endl;
     
    616788        {
    617789            RaDec dest = *((RaDec*)mp);
    618             TrackPosition(dest*D2PI/360.0);
     790            TrackPosition(dest*kDeg2Rad);
    619791        }
    620792        cout << "WM_Track: done. (return 0x8888)" << endl;
     
    8431015
    8441016
    845 int MCosy::StopWaitingForSDO() const
    846 {
    847     return Break() || HasError();
    848 }
    849 
     1017// --------------------------------------------------------------------------
     1018//
     1019// Start the work of the application:
     1020//
     1021// Start the Can-Network.
     1022// Start the MCosy::TalkThread thread.
     1023// turn on the gui update
     1024//
    8501025void MCosy::Start()
    8511026{
     
    8611036}
    8621037
     1038// --------------------------------------------------------------------------
     1039//
     1040// Start the work of the application:
     1041//
     1042// Turn of the gui update
     1043// stop the MCosy::TalkThread thread.
     1044// Stop the network
     1045//
    8631046void MCosy::Stop()
    8641047{
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r926 r1111  
    3737};
    3838
    39 #define kError     0x01
    40 #define kMoving    0x02
    41 #define kTracking  0x04
    42 #define kStopping  0x08
    43 #define kStopped   0x10
    4439
    4540class TTimer;
     
    5045
    5146private:
     47    enum
     48    {
     49        kError    = 0x01,
     50        kMoving   = 0x02,
     51        kTracking = 0x04,
     52        kStopping = 0x08,
     53        kStopped  = 0x10
     54    };
     55
    5256    ShaftEncoder *fZd1;
    5357    ShaftEncoder *fZd2;
     
    99103
    100104    int StopWaitingForSDO() const;
    101     int IsPositioning() const;
    102105    void CheckForError();
    103106
     
    117120
    118121    static ZdAz CorrectTarget(const ZdAz &src, const ZdAz &dst);
    119 //    static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0));
     122    //    static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0));
    120123
     124    ClassDef(MCosy, 0)
    121125};
    122126
  • trunk/MagicSoft/Cosy/main/MainLinkDef.h

    r924 r1111  
    55#pragma link off all functions;
    66
     7#pragma link C++ class MCosy;
     8
    79#endif
  • trunk/MagicSoft/Cosy/main/Makefile

    r924 r1111  
    3535           MStarguider.cc
    3636
    37 SRCS    = $(SRCFILES)
    38 HEADERS = $(SRCFILES:.cc=.h)
    39 OBJS    = $(SRCFILES:.cc=.o)
     37SRCS        = $(SRCFILES)
     38HEADERS     = $(SRCFILES:.cc=.h)
     39OBJS        = $(SRCFILES:.cc=.o)
     40CINTHEADERS = $(HEADERS)
    4041
    4142############################################################
  • trunk/MagicSoft/Cosy/videodev/Camera.cc

    r910 r1111  
    2121#include <sys/resource.h>
    2222
     23ClassImp(Camera);
     24
    2325inline int Camera::Ioctl(int req, void *opt, const char *str)
    2426{
  • trunk/MagicSoft/Cosy/videodev/Camera.h

    r910 r1111  
    22#define CAMERA_H
    33
     4#ifdef __CINT__
     5typedef unsigned long int pthread_t;
     6struct pthread_mutex_t;
     7struct pthread_cond_t;
     8struct timeval;
     9#else
     10#include <TROOT.h>
    411#include <pthread.h>
    512#include <sys/time.h>
     13#endif
     14
    615
    716typedef unsigned char byte;
     
    95104    void GetPicPar(int *bright, int *hue, int *contrast);
    96105
     106    ClassDef(Camera, 0)
    97107};
    98108
  • trunk/MagicSoft/Cosy/videodev/Filter.cc

    r808 r1111  
    33#include <memory.h>   // memset
    44#include <iostream.h> // cout
     5
     6ClassImp(Filter);
    57
    68void Filter::DrawBox(const int x1, const int y1,
  • trunk/MagicSoft/Cosy/videodev/Filter.h

    r808 r1111  
    11#ifndef FILTER_H
    22#define FILTER_H
     3
     4#ifndef __CINT__
     5#include <TROOT.h>
     6#endif
    37
    48typedef unsigned char byte;
     
    2529public:
    2630    static void Execute(byte *img);
     31
     32    ClassDef(Filter, 0)
    2733};
    2834
  • trunk/MagicSoft/Cosy/videodev/Makefile

    r911 r1111  
    3535           Writer.cc
    3636
    37 SRCS    = $(SRCFILES)
    38 HEADERS = $(SRCFILES:.cc=.h)
    39 OBJS    = $(SRCFILES:.cc=.o)
     37SRCS        = $(SRCFILES)
     38HEADERS     = $(SRCFILES:.cc=.h)
     39OBJS        = $(SRCFILES:.cc=.o)
     40CINTHEADERS = $(HEADERS)
    4041
    4142############################################################
  • trunk/MagicSoft/Cosy/videodev/VideodevLinkDef.h

    r920 r1111  
    55#pragma link off all functions;
    66
     7#pragma link C++ class Writer+;
     8#pragma link C++ class Filter+;
     9
     10#pragma link C++ class Camera+;
     11
    712#endif
  • trunk/MagicSoft/Cosy/videodev/Writer.cc

    r910 r1111  
    88
    99#include "base/timer.h"
     10
     11ClassImp(Writer);
    1012
    1113void Writer::Png(const char *fname, const byte *buf,
  • trunk/MagicSoft/Cosy/videodev/Writer.h

    r808 r1111  
    22#define WRITER_H
    33
     4#ifdef __CINT__
     5struct timeval;
     6#else
     7#include <TROOT.h>
    48#include <sys/time.h>
     9#endif
    510
    611typedef unsigned char byte;
     
    1419    static void Ppm(const char *fname, const byte *img);
    1520    static void Png(const char *fname, const byte *buf, struct timeval *date);
     21
     22    ClassDef(Writer, 0)
    1623};
    1724
Note: See TracChangeset for help on using the changeset viewer.