source: trunk/Cosy/main/MCosy.h@ 9628

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