| 1 | #ifndef COSY_MStarguider | 
|---|
| 2 | #define COSY_MStarguider | 
|---|
| 3 |  | 
|---|
| 4 | #include "PixClient.h" | 
|---|
| 5 | #include "MGImage.h" | 
|---|
| 6 |  | 
|---|
| 7 | #include "MPointing.h" | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef MARS_MObservatory | 
|---|
| 10 | #include "MObservatory.h" | 
|---|
| 11 | #endif | 
|---|
| 12 | #ifndef MARS_MTime | 
|---|
| 13 | #include "MTime.h" | 
|---|
| 14 | #endif | 
|---|
| 15 | #ifndef MARS_MGList | 
|---|
| 16 | #include "MGList.h" | 
|---|
| 17 | #endif | 
|---|
| 18 |  | 
|---|
| 19 | class TArrayF; | 
|---|
| 20 | class TGLabel; | 
|---|
| 21 | class TGButton; | 
|---|
| 22 | class TString; | 
|---|
| 23 | //class TSocket; | 
|---|
| 24 |  | 
|---|
| 25 | class TTimer; | 
|---|
| 26 |  | 
|---|
| 27 | class TGMenuBar; | 
|---|
| 28 | class TGPopupMenu; | 
|---|
| 29 | class TGTextEntry; | 
|---|
| 30 |  | 
|---|
| 31 | class PixGetter; | 
|---|
| 32 |  | 
|---|
| 33 | class MGImage; | 
|---|
| 34 | class MGCoordinates; | 
|---|
| 35 |  | 
|---|
| 36 | class StarCatalog; | 
|---|
| 37 | class MStarList; | 
|---|
| 38 | class MCosy; | 
|---|
| 39 | class MCaos; | 
|---|
| 40 | // class MStargLeds; | 
|---|
| 41 | class MStargHistograms; | 
|---|
| 42 | class MGNumStars; | 
|---|
| 43 | class MGStarg; | 
|---|
| 44 | class FilterLed; | 
|---|
| 45 | class Ring; | 
|---|
| 46 |  | 
|---|
| 47 | class Leds; | 
|---|
| 48 | #include <TGButton.h> | 
|---|
| 49 | class MStarguider : public PixClient, public TGMainFrame | 
|---|
| 50 | { | 
|---|
| 51 | private: | 
|---|
| 52 | PixGetter     *fGetter; | 
|---|
| 53 |  | 
|---|
| 54 | MGList        *fList; | 
|---|
| 55 |  | 
|---|
| 56 | TGMenuBar     *fMenu; | 
|---|
| 57 | MGImage       *fImage; | 
|---|
| 58 | MGImage       *fZoomImage; | 
|---|
| 59 |  | 
|---|
| 60 | MGStarg       *fGStarg; | 
|---|
| 61 | MGNumStars    *fGNumStars; | 
|---|
| 62 |  | 
|---|
| 63 | TGPopupMenu   *fDisplay; | 
|---|
| 64 | TGPopupMenu   *fMode; | 
|---|
| 65 | TGPopupMenu   *fWritePictures; | 
|---|
| 66 | TGPopupMenu   *fSetup; | 
|---|
| 67 | TGPopupMenu   *fOperations; | 
|---|
| 68 |  | 
|---|
| 69 | TGPopupMenu   *fFileType; | 
|---|
| 70 | TGPopupMenu   *fWriteType; | 
|---|
| 71 | TGPopupMenu   *fWriteRate; | 
|---|
| 72 | TGPopupMenu   *fInterpol; | 
|---|
| 73 | TGPopupMenu   *fLimMag; | 
|---|
| 74 | TGPopupMenu   *fChannel; | 
|---|
| 75 |  | 
|---|
| 76 | TGPopupMenu   *fCaosWrite; | 
|---|
| 77 | TGPopupMenu   *fCaosPrint; | 
|---|
| 78 | TGPopupMenu   *fCaosAnalyse; | 
|---|
| 79 | TGPopupMenu   *fCaOs; | 
|---|
| 80 |  | 
|---|
| 81 | MGCoordinates *fCRaDec; | 
|---|
| 82 | MGCoordinates *fCZdAz; | 
|---|
| 83 |  | 
|---|
| 84 | MGCoordinates *fPZdAz; | 
|---|
| 85 | MGCoordinates *fDZdAz; | 
|---|
| 86 | MGCoordinates *fSZdAz; | 
|---|
| 87 |  | 
|---|
| 88 | TGTextEntry   *fPixSize; | 
|---|
| 89 | TGTextEntry   *fAngle; | 
|---|
| 90 | TGTextEntry   *fCut; | 
|---|
| 91 |  | 
|---|
| 92 | TGLabel       *fFps; | 
|---|
| 93 | TGLabel       *fPosZoom; | 
|---|
| 94 | TGLabel       *fSkyBright; | 
|---|
| 95 | TGLabel       *fCZdAzText; | 
|---|
| 96 | TGLabel       *fPZdAzText; | 
|---|
| 97 | TGLabel       *fDZdAzText; | 
|---|
| 98 | public: | 
|---|
| 99 | TGButton      *fTPoint; | 
|---|
| 100 | //    TGButton      *fStargTPoint; | 
|---|
| 101 | private: | 
|---|
| 102 | ZdAz          fPos; | 
|---|
| 103 | ZdAz          fD; | 
|---|
| 104 | AltAz         fAltAzOffsetFromTp; | 
|---|
| 105 |  | 
|---|
| 106 | Int_t          fNumStarsDetected; | 
|---|
| 107 | Int_t          fNumStarsCorrelated; | 
|---|
| 108 |  | 
|---|
| 109 | StarCatalog   *fSao; | 
|---|
| 110 | MCosy         *fCosy; | 
|---|
| 111 | MCaos         *fCaos; | 
|---|
| 112 | MCaos         *fStargCaos; | 
|---|
| 113 | MStargHistograms *fStargHistograms; | 
|---|
| 114 |  | 
|---|
| 115 | RaDec *fRaDec; | 
|---|
| 116 |  | 
|---|
| 117 | TTimer *fTimer; | 
|---|
| 118 | MTime   fTime; | 
|---|
| 119 | MTime   fTimeFromTp; | 
|---|
| 120 |  | 
|---|
| 121 | std::ofstream *fOutTp; | 
|---|
| 122 | std::ofstream *fOutStargTp; | 
|---|
| 123 | //    ofstream *fOutRq; | 
|---|
| 124 |  | 
|---|
| 125 | Int_t fDx; | 
|---|
| 126 | Int_t fDy; | 
|---|
| 127 |  | 
|---|
| 128 | byte fIntRate; | 
|---|
| 129 | int  fWrtRate; | 
|---|
| 130 |  | 
|---|
| 131 | UInt_t fStatus; | 
|---|
| 132 | Double_t fLastBright; | 
|---|
| 133 |  | 
|---|
| 134 | Double_t fRadius; // LED radius [cm] | 
|---|
| 135 |  | 
|---|
| 136 | Int_t fTPointFromCC; | 
|---|
| 137 |  | 
|---|
| 138 | Int_t fStarguiderW; | 
|---|
| 139 | Int_t fStarguiderH; | 
|---|
| 140 | Int_t fStarguiderX; | 
|---|
| 141 | Int_t fStarguiderY; | 
|---|
| 142 |  | 
|---|
| 143 | Float_t fSkyOffsetX;  // Offset between camera center and sky position | 
|---|
| 144 | Float_t fSkyOffsetY;  // Offset between camera center and sky position | 
|---|
| 145 |  | 
|---|
| 146 | Float_t fFindStarCut; | 
|---|
| 147 | Int_t   fFindStarBox; | 
|---|
| 148 |  | 
|---|
| 149 | TString fTPointStarName; | 
|---|
| 150 | Float_t fTPointStarMag; | 
|---|
| 151 |  | 
|---|
| 152 | void Toggle(TGPopupMenu *p, UInt_t id); | 
|---|
| 153 | void SwitchOff(TGPopupMenu *p, UInt_t id); | 
|---|
| 154 | void ToggleStargAnalysis(); | 
|---|
| 155 | //    void ToggleFindStar(); | 
|---|
| 156 | void ToggleStarguider(); | 
|---|
| 157 | void ToggleCaosFilter(); | 
|---|
| 158 | void SetChannel(); | 
|---|
| 159 | Int_t CalcTrackingError(const Leds &, MStarList &, ZdAz &, const MTime &, const double &bright, Int_t &num, const Ring ¢er, Int_t numleds, Int_t numrings); | 
|---|
| 160 | ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag, Int_t &num) const; | 
|---|
| 161 | bool Interpolate(const unsigned long n, byte *img) const; | 
|---|
| 162 | void FindStar(const FilterLed &f, const FilterLed &f2, const Ring ¢er, const MTime &t, Int_t numleds, Int_t numrings); | 
|---|
| 163 |  | 
|---|
| 164 | void InitGui(Int_t channel); | 
|---|
| 165 |  | 
|---|
| 166 | void UpdatePosZoom(); | 
|---|
| 167 | void DrawZoomImage(const byte *img); | 
|---|
| 168 | void DrawCosyImage(const byte *img); | 
|---|
| 169 |  | 
|---|
| 170 | Bool_t HandleTimer(TTimer *t); | 
|---|
| 171 |  | 
|---|
| 172 | void SetRotationAngle(Double_t angle); | 
|---|
| 173 | void SetPixSize(Double_t size); | 
|---|
| 174 | void SetCut(Double_t cut); | 
|---|
| 175 |  | 
|---|
| 176 | Bool_t DoTPoint(); | 
|---|
| 177 |  | 
|---|
| 178 | public: | 
|---|
| 179 | MStarguider(MObservatory::LocationName_t obs, Int_t channel); | 
|---|
| 180 | virtual ~MStarguider(); | 
|---|
| 181 |  | 
|---|
| 182 | void SetupEnv(TEnv &env); | 
|---|
| 183 |  | 
|---|
| 184 | void Layout(); | 
|---|
| 185 | void CloseWindow(); | 
|---|
| 186 |  | 
|---|
| 187 | Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); | 
|---|
| 188 |  | 
|---|
| 189 | Bool_t HandleDoubleClick(Event_t *event); | 
|---|
| 190 |  | 
|---|
| 191 | void SetPointingPosition(RaDec rd); | 
|---|
| 192 | void SetCosy(MCosy *c) { fCosy = c; } | 
|---|
| 193 |  | 
|---|
| 194 | XY GetCoordinates() const; | 
|---|
| 195 |  | 
|---|
| 196 | // | 
|---|
| 197 | // Execution of one frame - this function may be overloaded! | 
|---|
| 198 | // | 
|---|
| 199 | void ProcessFrame(const unsigned long n, byte *img, struct timeval *tm); | 
|---|
| 200 |  | 
|---|
| 201 | void Print(TString &str, Double_t deg) const; | 
|---|
| 202 | void Print(Option_t *o) const { } | 
|---|
| 203 |  | 
|---|
| 204 | void StartTPoint(char *cmd=0);// { if (fTPointFromCC<0) fTPointFromCC=0; } | 
|---|
| 205 | void StartStarguider(bool on); | 
|---|
| 206 |  | 
|---|
| 207 | Int_t GetStarguiderMode() const; | 
|---|
| 208 |  | 
|---|
| 209 | ClassDef(MStarguider, 0) | 
|---|
| 210 | }; | 
|---|
| 211 |  | 
|---|
| 212 | #endif | 
|---|
| 213 |  | 
|---|
| 214 |  | 
|---|