Commit 9e82d12e54d951541d9bc27aaeba602474bce806

Authored by Etienne Pallier
1 parent 7d8f698f
Exists in dev

new procedure initialize()

sockets_tele/README.txt
... ... @@ -67,6 +67,7 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
67 67 - 3 types of commands
68 68 - \x00 at end
69 69 - ACK (cde 6)
  70 + - procedure initialize()
70 71  
71 72  
72 73 ********************************************************************************************
... ... @@ -96,7 +97,6 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
96 97 - :SG{+-}hh# ???
97 98 - radec.goto()
98 99 - help => liste cdes possibles
99   - - set("init") (ou do("init") ???) ou set("config")
100 100 - _connect() ou connect() ?
101 101 - set("home", lat, long)
102 102  
... ...
sockets_tele/client_gemini_run.py
... ... @@ -63,6 +63,7 @@ with SocketClientTelescopeGEMINI(HOST, PORT, DEBUG) as tsock:
63 63  
64 64 ack = tsock.get("ACK")
65 65 print("ACK is", ack)
  66 +
66 67  
67 68 # TEST BAS NIVEAU POUR ACK 06:
68 69 '''
... ... @@ -127,8 +128,9 @@ with SocketClientTelescopeGEMINI(HOST, PORT, DEBUG) as tsock:
127 128 '''
128 129 # wrong: b'00010000\\x00\\x06\\x00\x00'
129 130 # ok:
130   - tsock.mysock.sendto(b'00010000\x00\x06\x00\x00', (HOST, PORT))
  131 + \x05\x00\x00\
131 132 #tsock.mysock.sendto(b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00', (HOST, PORT))
  133 + #tsock.mysock.sendto(b'00010000\x00\x05\x00\x00', (HOST, PORT))
132 134 tsock.mysock.sendto(b'00010000\x00\x06\x00\x00', (HOST, PORT))
133 135 data_received = tsock.receive_data()
134 136 '''
... ...
sockets_tele/src/client/socket_client_abstract.py
... ... @@ -144,6 +144,21 @@ class SocketClientAbstract():
144 144  
145 145  
146 146 def send_data(self, data:str):
  147 + '''
  148 + The chosen way to send data is this:
  149 + # - :GD#
  150 + b'00030000:GD#\x00'
  151 +
  152 + Another way to send data (which also works), is it better ?
  153 + # - :GD#
  154 + ###tsock.mysock.sendto(b'\x00\x00\x00\x01\x00\x00\x00\x00\x3A\x47\x44\x23\x00', (HOST, PORT))
  155 + # - :GR#
  156 + ###tsock.mysock.sendto(b'\x00\x00\x00\x01\x00\x00\x00\x00\x3A\x47\x52\x23\x00', (HOST, PORT))
  157 + # - ACK 06 OK !!! :
  158 + tsock.mysock.sendto(b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x06\x00\x00', (HOST, PORT))
  159 +
  160 + Which one is the best method ?
  161 + '''
147 162 log_d("\n\nCommand to send is "+repr(data))
148 163 encapsulated_data = self._encapsulate_data_to_send(data)
149 164 #print("before _send", encapsulated_data)
... ...
sockets_tele/src/client/socket_client_telescope_gemini.py
... ... @@ -128,24 +128,17 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
128 128 - b# while waiting for the selection of the Startup Mode,
129 129 - S# during a Cold Start (new in L4),
130 130 - G# after completed startup ==> MEANS ALL IS OK
131   -
  131 + '''
  132 + ACK = self.get("ACK")
  133 +
  134 + '''
132 135 2) IF telescope is not ready (still starting up), ask it to do a Warm Start ('bW#')
133 136 During Startup, with a "b#" being returned, the PC can select the startup mode by sending a
134 137 • bC# for selecting the Cold Start,
135 138 • bW# for selecting the Warm Start,
136 139 • bR# for selecting the Warm Restart
137 140 If not ok (still starting up, no 'G#' in return), send 'bW#' (see above) for selecting the Warm Start
138   -
139   - 3) Send cde ':p3#' : Precession & Refraction (see page 107)
140   - Ask Gemini to do Precession calculation
141   - Coordinates transferred to the Gemini refer to the standard epoch J2000.0.
142   - Refraction is calculated (From L4, V1.0 up)
143   - '''
144   -
145   - # 1) get ACK
146   - ACK = self.get("ACK")
147   -
148   - # 2) IF telescope is not ready (still starting up), ask it to do a Warm Start
  141 + '''
149 142 if ACK != 'G':
150 143 self.do("WARM_START")
151 144 ACK = self.get("ACK")
... ... @@ -156,7 +149,13 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
156 149 if elapsed_time == TIMEOUT: raise TimeoutException()
157 150 ACK = self.get("ACK")
158 151  
159   - # 3) Do precession & refraction
  152 +
  153 + '''
  154 + 3) Send cde ':p3#' : Precession & Refraction (see page 107)
  155 + Ask Gemini to do Precession calculation
  156 + Coordinates transferred to the Gemini refer to the standard epoch J2000.0.
  157 + Refraction is calculated (From L4, V1.0 up)
  158 + '''
160 159 self.do("PRECESSION_AND_REFRACTION")
161 160  
162 161  
... ... @@ -234,15 +233,15 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
234 233  
235 234 if generic_cmd == "INIT": return self.initialize()
236 235  
237   - #if command == "WARM_START": specific_cmds = ('bW',)
238   - if generic_cmd == "WARM_START": specific_cmds = ('',)
  236 + if generic_cmd == "WARM_START": specific_cmds = ('bW',)
  237 + #if generic_cmd == "WARM_START": specific_cmds = ('',)
239 238  
240 239 ''' Precession & Refraction (see page 107)
241 240 Ask Gemini to do Precession calculation
242 241 Coordinates transferred to the Gemini refer to the standard epoch J2000.0.
243 242 Refraction is calculated (From L4, V1.0 up)
244 243 '''
245   - #if command == "PRECESSION_AND_REFRACTION": specific_cmds = (':p3#',)
  244 + #if generic_cmd == "PRECESSION_AND_REFRACTION": specific_cmds = (':p3#',)
246 245 if generic_cmd == "PRECESSION_AND_REFRACTION": specific_cmds = ('',)
247 246  
248 247 return self._get_result(specific_cmds)
... ...