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

Last change on this file since 9435 was 9435, 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#define WM_STARGTPOINT 0x1014
47#define WM_STARGMODE 0x1015
48
49class Dkc;
50
51class MGCosy;
52class MCosy;
53class MStarguider;
54class MDriveCom;
55class MEnv;
56
57class TTimer;
58
59class MCosy : public Network, public MsgQueue, public TObject
60{
61 friend class MSlewing;
62 friend class MTracking;
63
64private:
65 const MObservatory::LocationName_t fObservatory;
66
67 MStarguider *fStarguider;
68
69 Dkc *fMac1;
70 Dkc *fMac2;
71
72 MGCosy *fWin;
73 MDriveCom *fCom;
74
75 TTimer *fUpdateGui;
76
77 TMutex fMutexGui;
78
79 ZdAz fTrackingError; // [rad] Tracking Offset between SE and calc-pos
80 ZdAz fZdAzSoll; // [rad] Soll position when moving
81 RaDec fRaDec; // Position to track
82 ZdAz fAccuracy; // Actual accuracy of Tracking
83 ZdAz fMin;
84 ZdAz fMax;
85
86 MPointing fBending;
87
88 UInt_t fStatus;
89
90 ofstream *fOutTp;
91 MLog *fOutRep;
92
93 ZdAz AlignTrackingPos(ZdAz pointing) const;
94 Bool_t CheckRange(const ZdAz &d) const;
95 Double_t Starguider(Double_t mjd, ZdAz &dest) const;
96
97 void SetStatus(UInt_t stat) { fStatus = stat; }
98 UInt_t GetStatus() const { return fStatus; }
99
100 int SetPosition(const ZdAz &dst, Bool_t track=kFALSE);
101 void TrackPosition(const RaDec &dst); // ra, dec [rad]
102 void TrackPositionGRB(const RaDec &dst); // ra, dec [rad]
103
104 void TerminateApp();
105
106 int StopWaitingForSDO() const;
107 void CheckForError();
108
109 void StopMovement();
110
111 void WaitForEndMovement();
112
113 void Constructor(Int_t id1, Int_t id2);
114 //void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
115 //void ConstructorDemo();
116
117 void ReadConfig(MEnv &env);
118
119 bool CheckNetwork();
120
121 void Start() { }
122
123public:
124 MCosy(MEnv &env, MDriveCom *com, const char *pointing);
125 ~MCosy();
126
127 void Start(MEnv &env);
128 void Stop();
129
130 Int_t Proc(int msg, void *mp);
131
132 Bool_t HandleTimer(TTimer *t);
133
134 ZdAz GetPointingPos(void) const;
135 void SetStarguider(MStarguider *s) { fStarguider = s; }
136
137 static TString GetFileName(const char *path, const char *name, const char *ext);
138
139 MGCosy *GetWin() { return fWin; }
140
141 ZdAz GetSePos() const; // [revolutions]
142
143 MLog *GetOutRep() { return fOutRep; }
144
145 MDriveCom *GetDriveCom() { return fCom; }
146
147 ClassDef(MCosy, 0)
148};
149
150#endif
Note: See TracBrowser for help on using the repository browser.