source: trunk/MagicSoft/Cosy/main/MCosy.h@ 9195

Last change on this file since 9195 was 9132, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.2 KB
Line 
1#ifndef COSY_MCosy
2#define COSY_MCosy
3
4//#include "coord.h"
5#include "msgqueue.h"
6#include "MPointing.h"
7
8#ifndef MARS_MThread
9#define COSY_MThread
10#include "MThread.h"
11#endif
12
13#ifndef COSY_Network
14#include "network.h"
15#endif
16#ifndef MARS_MObservatory
17#include "MObservatory.h"
18#endif
19#ifndef ROOT_TMutex
20#include <TMutex.h>
21#endif
22
23#define kDEG ((char)0x9c) // Linux 'ø'
24
25#define WM_WAIT WM_NULL
26//#define WM_PRESET 0x1000
27#define WM_POSITION 0x1001
28#define WM_TRACK 0x1002
29#define WM_STOP 0x1003
30//#define WM_CALIB 0x1004
31#define WM_TPOINT 0x1005
32#define WM_NEWTRACK 0x1006
33#define WM_LOADBENDING 0x1007
34#define WM_RESETBENDING 0x1008
35#define WM_CALCALTAZ 0x1009
36#define WM_HOME 0x100a
37#define WM_TESTSE 0x100b
38#define WM_GEAR 0x100c
39#define WM_DISPLAY 0x100d
40#define WM_TRACKPOS 0x100e
41#define WM_POSITION1 0x100f
42#define WM_ENDSWITCH 0x1010
43#define WM_GRB 0x1011
44#define WM_PREPS 0x1012
45#define WM_ARM 0x1013
46
47class Dkc;
48
49class MGCosy;
50class MCosy;
51class MStarguider;
52class MDriveCom;
53class MEnv;
54
55class TTimer;
56
57class MCosy : public Network, public MsgQueue, public TObject
58{
59 friend class MSlewing;
60 friend class MTracking;
61
62private:
63 const MObservatory::LocationName_t fObservatory;
64
65 MStarguider *fStarguider;
66
67 Dkc *fMac1;
68 Dkc *fMac2;
69
70 MGCosy *fWin;
71 MDriveCom *fCom;
72
73 TTimer *fUpdateGui;
74
75 TMutex fMutexGui;
76
77 ZdAz fTrackingError; // [rad] Tracking Offset between SE and calc-pos
78 ZdAz fZdAzSoll; // [rad] Soll position when moving
79 RaDec fRaDec; // Position to track
80 ZdAz fAccuracy; // Actual accuracy of Tracking
81 ZdAz fMin;
82 ZdAz fMax;
83
84 MPointing fBending;
85
86 UInt_t fStatus;
87
88 ofstream *fOutTp;
89 MLog *fOutRep;
90
91 ZdAz AlignTrackingPos(ZdAz pointing) const;
92 Bool_t CheckRange(const ZdAz &d) const;
93 Double_t Starguider(Double_t mjd, ZdAz &dest) const;
94
95 void SetStatus(UInt_t stat) { fStatus = stat; }
96 UInt_t GetStatus() const { return fStatus; }
97
98 int SetPosition(const ZdAz &dst, Bool_t track=kFALSE);
99 void TrackPosition(const RaDec &dst); // ra, dec [rad]
100 void TrackPositionGRB(const RaDec &dst); // ra, dec [rad]
101
102 void TerminateApp();
103
104 int StopWaitingForSDO() const;
105 void CheckForError();
106
107 void StopMovement();
108
109 void WaitForEndMovement();
110
111 void Constructor(Int_t id1, Int_t id2);
112 //void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
113 //void ConstructorDemo();
114
115 void ReadConfig(MEnv &env);
116
117 bool CheckNetwork();
118
119 void Start() { }
120
121public:
122 MCosy(MEnv &env, MDriveCom *com, const char *pointing);
123 ~MCosy();
124
125 void Start(MEnv &env);
126 void Stop();
127
128 Int_t Proc(int msg, void *mp);
129
130 Bool_t HandleTimer(TTimer *t);
131
132 ZdAz GetPointingPos(void) const;
133 void SetStarguider(MStarguider *s) { fStarguider = s; }
134
135 static TString GetFileName(const char *path, const char *name, const char *ext);
136
137 MGCosy *GetWin() { return fWin; }
138
139 ZdAz GetSePos() const; // [revolutions]
140
141 MLog *GetOutRep() { return fOutRep; }
142
143 MDriveCom *GetDriveCom() { return fCom; }
144
145 ClassDef(MCosy, 0)
146};
147
148#endif
Note: See TracBrowser for help on using the repository browser.