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

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