Commit 31e3fa71a4cf7c81090c5e20fea30ecee7362c0c

Authored by Etienne Pallier
1 parent f2382c40
Exists in dev

do_init() finalized and do_GOTO() implemented and tested on Gemini

sockets_tele/README.txt
... ... @@ -63,12 +63,16 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
63 63 ********************************************************************************************
64 64 4) WORK CURRENTLY IN PROGRESS...
65 65  
66   - - set date&time, set lat&long
  66 + - tests updated
67 67  
68 68  
69 69 ********************************************************************************************
70 70 5) DONE
71 71  
  72 + - GOTO
  73 + - finalize do_init()
  74 +
  75 + - set date&time, set lat&long
72 76 - README file enriched
73 77 - help => liste cdes possibles
74 78  
... ... @@ -88,16 +92,18 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
88 92 ********************************************************************************************
89 93 6) TODO LIST
90 94  
  95 + - remplacer utf-8 par unicode ou iso...
  96 +
91 97 - cdes 05 (p100):
92 98 - cde 05 => return long list of parameters (= GROS GET)
93 99 - ENQ = 05
94 100  
95 101 - Table d'attributs pour chaque telescope (config)
96 102  
97   - - set DATE & TIME (p109)
  103 + - (X) set DATE & TIME (p109)
98 104 - Ce que fait AK avec TCL ou C: sprintf(ligne,":SC%02d/%02d/%02d#:SL%02d:%02d:%02.0f#:SG+00#",m,d,y-2000,h,min,s);
99 105  
100   - (X) 1) :SG+00#
  106 + 1) :SG+00#
101 107 => TU
102 108  
103 109 2) SC%02d/%02d/%02d#:
... ... @@ -113,35 +119,17 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
113 119  
114 120 - _connect() ou connect() ?
115 121  
116   - - GOTO(position, blocking=Y/N):
117   - - non bloquant par défaut pour Gemini
118   - - après goto, tester position avec ':Gv#' (p103) : on devrait avoir 'S', puis 'C', puis 'T'
119   - - N (for "no tracking")
120   - - T (for Tracking)
121   - - G (for Guiding)
122   - - C (for Centering)
123   - - S (for Slewing)
124   -
125   - - MOVE(direction, rate, duration):
126   - - move dans une direction (N,S,E,O) à l'infini
127   - - ':Q#' pour arrêter (p 108)
128   - - duration: infinie si pas donnée
129   - - rate (p108): 4 vitesses différentes (prendre la plus lente par défaut), entre 0 et 1:
130   - - [0-0.25] : RC => Rate Center. Subsequent Move commands will move at Centering Speed.
131   - - [0.25-0.50] : RG => Rate Guide. Subsequent Move commands will move at Guiding Speed.
132   - - [0.50-0.75] : RM => Rate Move. Subsequent Move commands will move at Centering Speed.
133   - - [0.75-1.0] : RS => Rate Slew. Subsequent Move commands will move at Slewing Speed.
134 122  
135 123 - POSITION (p103):
136   - - set("home", lat, long)
137   - - radec.goto()
138   - - STARTUP position = CWD
139   - - :hC#
140   - - position required for a Cold or Warm Start, pointing to the celestial pole of the given hemisphere (north or south),
141   - with the counterweight pointing downwards (CWD position). From L4, V1.0 up
142   - - HOME position parking => par defaut, c'est CWD, mais ca peut etre different
143   - - :hP#
144   - - defaults to the celestial pole visible at the given hemisphere (north or south) and can be set by the user
  124 + - MOVE(direction, rate, duration):
  125 + - move dans une direction (N,S,E,O) à l'infini
  126 + - ':Q#' pour arrêter (p 108)
  127 + - duration: infinie si pas donnée
  128 + - rate (p108): 4 vitesses différentes (prendre la plus lente par défaut), entre 0 et 1:
  129 + - [0-0.25] : RC => Rate Center. Subsequent Move commands will move at Centering Speed.
  130 + - [0.25-0.50] : RG => Rate Guide. Subsequent Move commands will move at Guiding Speed.
  131 + - [0.50-0.75] : RM => Rate Move. Subsequent Move commands will move at Centering Speed.
  132 + - [0.75-1.0] : RS => Rate Slew. Subsequent Move commands will move at Slewing Speed.
145 133  
146 134 - Implémenter les commandes NATIVES (non LX-200) :
147 135 - < ou >, termine par ':' + checksum + #
... ... @@ -149,10 +137,6 @@ Pour lancer le client sur le &quot;simulateur&quot; de telescope (localhost, port 11110):
149 137  
150 138  
151 139  
152   - GOTO:
153   - :Sr18:23:45#:Sd+34:00:00#:MS#
154   - (MS = move start)
155   - = Goto RA=18h23m45s Dec=+34d00m00s J2000
156 140  
157 141  
158 142  
... ...
sockets_tele/client_gemini_run.py
... ... @@ -137,6 +137,9 @@ with SocketClientTelescopeGEMINI(HOST, PORT, DEBUG) as tsock:
137 137 data_received = tsock.receive_data()
138 138 '''
139 139  
  140 + tsock.do_GOTO(ra='22:00:00',dec='+30:00:00')
  141 + tsock.do_GOTO(ra='21:00:00',dec='+20:00:00')
  142 +
140 143 # Do EXPERT mode execution
141 144 while True:
142 145  
... ... @@ -162,6 +165,8 @@ with SocketClientTelescopeGEMINI(HOST, PORT, DEBUG) as tsock:
162 165 #print("Received: {}".format(data_received))
163 166 #print("Useful data received: {}".format(data_useful))
164 167 '''
  168 +
  169 + #tsock.do_PARK()
165 170  
166 171 #tsock.close()
167 172  
... ...
sockets_tele/src/client/socket_client_telescope_abstract.py
... ... @@ -87,11 +87,12 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
87 87 'TIME': [],
88 88 'LONGITUDE': [],
89 89 'LATITUDE': [],
  90 + 'VELOCITY': [],
90 91 }
91 92 _cmd_do = {
92   - 'INIT': [],
  93 + #'INIT': [],
93 94 'PARK': [],
94   - 'GOTO': [],
  95 + 'MOVE': [],
95 96 'WARM_START': [],
96 97 'PREC_REFR': [],
97 98 }
... ... @@ -221,8 +222,30 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
221 222  
222 223 # RA/DEC
223 224 # @abstract
  225 + '''
  226 + Sets the object's Right Ascension and the object status to "Not Selected".
  227 + The :Sd# command has to follow to complete the selection.
  228 + The subsequent use of the :ON...# command is recommended (p106)
  229 + :Sr<hh>:<mm>.<m>#
  230 + or
  231 + :Sr<hh>:<mm>:<ss>#
  232 + 0 if invalid
  233 + 1 if valid
  234 + '''
224 235 def get_RA(self): return self._get("RA")
225 236 def set_RA(self, ra): return self._set("RA", ra)
  237 +
  238 + '''
  239 + Sets the object's declination.
  240 + It is important that the :Sr# command has been send prior.
  241 + Internal calculations are done that may take up to 0.5 seconds.
  242 + If the coordinate selection is valid the object status is set to "Selected"
  243 + :Sd{+-}<dd>{*°}<mm>#
  244 + or
  245 + :Sd{+- }<dd>{*°:}<mm>:<ss>
  246 + 0 if invalid
  247 + 1 if valid
  248 + '''
226 249 def get_DEC(self): return self._get("DEC")
227 250 def set_DEC(self, dec): return self._set("DEC", dec)
228 251 # @abstract
... ... @@ -243,16 +266,28 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
243 266 def get_LATITUDE(self): return self._get('LATITUDE')
244 267 def set_LATITUDE(self, latitude): return self._set('LATITUDE', latitude)
245 268  
  269 + def get_VELOCITY(self): return self._get('VELOCITY')
246 270  
247 271  
248 272 ''' DO commands '''
249 273  
250 274 # @abstract
251   - def do_INIT(self): return self._do("INIT")
  275 + #def do_INIT(self): return self._do("INIT")
  276 +
  277 + ''' do_PARK() (p103)
  278 + - STARTUP position = CWD
  279 + - :hC#
  280 + - position required for a Cold or Warm Start, pointing to the celestial pole of the given hemisphere (north or south),
  281 + with the counterweight pointing downwards (CWD position). From L4, V1.0 up
  282 + - HOME position parking => par defaut, c'est CWD, mais ca peut etre different
  283 + - :hP#
  284 + - defaults to the celestial pole visible at the given hemisphere (north or south) and can be set by the user
  285 + '''
252 286 # @abstract
253   - def do_park(self): return self._do("PARK")
  287 + def do_PARK(self): return self._do("PARK")
  288 + def do_MOVE(self): return self._do("MOVE")
254 289 # @abstract
255   - def do_goto(self, pos:Position): return self._do("GOTO")
  290 + #def do_GOTO(self, pos:Position): return self._do("GOTO")
256 291 def do_WARM_START(self): return self._do("WARM_START")
257 292 def do_PREC_REFR(self): return self._do("PREC_REFR")
258 293  
... ...
sockets_tele/src/client/socket_client_telescope_gemini.py
... ... @@ -90,6 +90,9 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
90 90 'DATE': ['GC', 'SC'],
91 91 'TIME': ['GL', 'SL'],
92 92  
  93 + 'VELOCITY': ['Gv'],
  94 +
  95 +
93 96  
94 97 }
95 98 ''' Commands dictionary
... ... @@ -97,9 +100,9 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
97 100 '''
98 101 # @override
99 102 _cmd_do = {
100   - 'INIT': [],
101   - 'PARK': [],
102   - 'GOTO': [],
  103 + #'INIT': [],
  104 + 'PARK': ['hP'],
  105 + 'MOVE': ['MS'],
103 106 'WARM_START': ['bW'],
104 107 'PREC_REFR': ['p3'],
105 108 }
... ... @@ -219,19 +222,10 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
219 222 elapsed_time += 1
220 223 if elapsed_time == TIMEOUT: raise TimeoutException()
221 224 ACK = self.get_ACK()
222   -
223   -
224   - '''
225   - 3) Send cde ':p3#' : Precession & Refraction (see page 107)
226   - Ask Gemini to do Precession calculation
227   - Coordinates transferred to the Gemini refer to the standard epoch J2000.0.
228   - Refraction is calculated (From L4, V1.0 up)
229   - '''
230   - ###self.do_PREC_REFR()
231   -
  225 +
232 226  
233 227 '''
234   - 4) Set timezone, date, and time (p109)
  228 + 3) Set timezone, date, and time (p109)
235 229 '''
236 230  
237 231 '''
... ... @@ -293,7 +287,7 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
293 287  
294 288  
295 289 '''
296   - 5) Set LOCATION (lat,long) (p103,110)
  290 + 4) Set LOCATION (lat,long) (p103,110)
297 291 Pour l'observatoire de Guitalens:
298 292 Sg = 2.0375 E
299 293 St = 43.6443 N
... ... @@ -352,7 +346,54 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
352 346 if res != res_dd_mm: raise UnexpectedCommandReturnCode(res)
353 347  
354 348  
  349 + '''
  350 + 5) Send cde ':p3#' : Precession & Refraction (see page 107)
  351 + Ask Gemini to do Precession calculation
  352 + Coordinates transferred to the Gemini refer to the standard epoch J2000.0.
  353 + Refraction is calculated (From L4, V1.0 up)
  354 + '''
  355 + self.do_PREC_REFR()
  356 +
  357 +
  358 + ''' GOTO (p105)
  359 + - GOTO(position, blocking=Y/N):
  360 + (MS = move start)
  361 + = Goto RA=18h23m45s Dec=+34d00m00s J2000
  362 + - radec.goto()
  363 + '''
  364 + def do_GOTO(self, ra, dec):
  365 + radec = self.get_RADEC()
  366 + print("Current position is", radec)
355 367  
  368 + '''
  369 + :Sr18:23:45#:Sd+34:00:00#:MS#
  370 + '''
  371 + res = self.set_RA(ra)
  372 + if res != '1': raise UnexpectedCommandReturnCode(res)
  373 + res = self.set_DEC(dec)
  374 + if res != '1': raise UnexpectedCommandReturnCode(res)
  375 + # MOVE non bloquant par défaut pour Gemini
  376 + self.do_MOVE()
  377 +
  378 + '''
  379 + After MOVE, test position with ':Gv#' (p103) : on devrait avoir 'S', puis 'C', puis 'T'
  380 + - N (for "no tracking")
  381 + - T (for Tracking)
  382 + - G (for Guiding)
  383 + - C (for Centering)
  384 + - S (for Slewing)
  385 + '''
  386 + v = None
  387 + while v != 'T':
  388 + v = self.get_VELOCITY()
  389 + print("Velocity is", v)
  390 + time.sleep(2)
  391 +
  392 + time.sleep(2)
  393 + radec = self.get_RADEC()
  394 + print("Current position is", radec)
  395 +
  396 +
356 397  
357 398  
358 399  
... ...