Commit 163ddb743c1c04fc051c7105b17433f39e864bab

Authored by Alain Klotz
1 parent fc092b38
Exists in dev

Mise à jour de TNC Raspberry.

mount_tnc/raspberry/camera1.tcl
... ... @@ -5,6 +5,7 @@ set hostname [lindex [hostaddress] end]
5 5 set path_script [file dirname [info script]]
6 6 source ${path_script}/astro_resources.tcl
7 7 load libcatalog_tcl[info sharedlibextension]
  8 +set ::audace(posobs,observateur,gps) {GPS 2.0375 E 43.6443484725 136.9}
8 9 if {$hostname=="rapido2"} {
9 10 set catalog_astrom_path "/home/pi/catalogs/USNOA2"
10 11 set audace(rapido2,portcom) "/dev/ttyAMA0"
... ... @@ -13,6 +14,12 @@ if {$hostname=="rapido2"} {
13 14 set audace(rapido2,portcom) "//./COM6"
14 15 }
15 16  
  17 +catch { del_circle }
  18 +catch {
  19 + #--- Efface les reperes des objets
  20 + $audace(hCanvas) delete catalog_overlay
  21 +}
  22 +
16 23 # mount_scx11.hadec_goto("22h00m",0)
17 24 # (Guitalens Mount) hadec_goto HA cmd >> TALK1 ; MSTOP ; ABORT
18 25 # (Guitalens Mount) hadec_goto HA cmd >> TALK1 ; A=26944.439 ; B=80833 ; C=-11.473 ; D=7.284 ; E=-11.319 ; F=2.716
... ... @@ -28,9 +35,10 @@ set data_save_filename "" ; #"pec_n.txt"
28 35 set plot_theo "no" ; # "yes"=plot the theoretical curve
29 36  
30 37 set methodes ""
  38 +lappend methodes "astrometry_ha"
31 39 #lappend methodes "rotation_pole"
32 40 #lappend methodes "scan_delta"
33   -lappend methodes "pole_find"
  41 +## lappend methodes "pole_find"
34 42 #lappend methodes "cinematique_acq"
35 43 #lappend methodes "cinematique_acqpec"
36 44 #lappend methodes "cinematique_add"
... ... @@ -40,6 +48,44 @@ lappend methodes "pole_find"
40 48 foreach methode $methodes {
41 49  
42 50 console::affiche_resultat "=== methode= $methode\n"
  51 +
  52 + if {$methode=="astrometry_ha"} {
  53 + # loadima suivia-1
  54 + set ra [mc_angle2deg 23h00m]
  55 + set dec 0.0
  56 + set naxis1 [lindex [buf1 getkwd NAXIS1] 1]
  57 + set naxis2 [lindex [buf1 getkwd NAXIS2] 1]
  58 + set xc [expr $naxis1/2.0]
  59 + set yc [expr $naxis2/2.0]
  60 + set home $::audace(posobs,observateur,gps)
  61 + set jd [expr [mc_date2jd [lindex [buf1 getkwd DATE-OBS] 1]] + 30./86400]
  62 + set hip [list 1 0 $ra $dec J2000 now 0 0 1]
  63 + set res [mc_hip2tel $hip $jd $home 101325 300]
  64 + lassign $res rac decc hac azc elevc
  65 + set lst [mc_date2lst $jd $home -format deg]
  66 + set ha [expr $lst-$ra]
  67 + set bin1 [lindex [buf1 getkwd BIN1] 1]
  68 + set pixdim1 [expr 4.54*$bin1]
  69 + set pixdim2 $pixdim1
  70 + set foclen 0.400
  71 + set catastar [calibwcs_new $ra $dec $pixdim1 $pixdim1 $foclen USNOA2 ${catalog_astrom_path}]
  72 + #set catastar [calibwcs $ra $dec $pixdim1 $pixdim1 $foclen USNO ${catalog_astrom_path}]
  73 + if {$catastar>6} {
  74 + catalog_overlay USNOA2 ${catalog_astrom_path} 13
  75 + # --- parametres d'entrée de la réfraction
  76 + set xy [list $xc $yc]
  77 + set res [buf1 xy2radec $xy]
  78 + set raj2000 [lindex $res 0] ; # J2000
  79 + set decj2000 [lindex $res 1] ; # J2000
  80 + set hip [list 1 0 $raj2000 $decj2000 J2000 now 0 0 1]
  81 + set res [mc_hip2tel $hip $jd $home 101325 300]
  82 + lassign $res rao deco hao azo elevo
  83 + set dra [expr $rao-$rac]
  84 + set ddec [expr $deco-$decc]
  85 + console::affiche_resultat "ha=[format %.4f $hao] dec=[format %.4f $deco] dra=[format %.4f $dra]\n"
  86 + }
  87 + }
  88 +
43 89 if {$methode=="rotation_pole"} {
44 90 az_open_if_needed
45 91 set pc [az_putread PC]
... ... @@ -277,12 +323,6 @@ foreach methode $methodes {
277 323 set bufno 1
278 324 set visuno 1
279 325 set super_sortie 0
280   -
281   - catch { del_circle }
282   - catch {
283   - #--- Efface les reperes des objets
284   - $audace(hCanvas) delete catalog_overlay
285   - }
286 326  
287 327 if {$mode=="acq"} {
288 328 lassign [cam1 nbcells] n1 n2
... ...
mount_tnc/raspberry/mountastro_astromecca.py
... ... @@ -632,20 +632,7 @@ class Mountastro_Astromecca(Mountastro,Mountchannel):
632 632 # --- Overloading method according the language protocol
633 633 err = self.NO_ERROR
634 634 res = 0
635   - if False:
636   - kaxis = 0
637   - current_axis = self.axis[kaxis]
638   - if current_axis.real==True:
639   - err, res = self._my_inc_goto(kaxis, 0, 20000)
640   - kaxis = 1
641   - current_axis = self.axis[kaxis]
642   - if current_axis.real==True:
643   - err, res = self._my_inc_goto(kaxis, 0, 20000)
644   - else:
645   - if self.site.latitude>=0:
646   - self.hadec_goto(-90,90,side=1)
647   - else:
648   - self.hadec_goto(-90,-90,side=1)
  635 + self.hadec_goto(self.park_ha,self.park_dec,side=self.park_side)
649 636 return err, res
650 637  
651 638 def hadec_travel(self):
... ... @@ -1066,6 +1053,7 @@ class Mountastro_Astromecca(Mountastro,Mountchannel):
1066 1053 axisr.language_protocol = "SCX11"
1067 1054 # ---
1068 1055 self.mult_inc_per_sec_drift = 1.017 * 0.9914 ; # 0.9984 # 1.00517
  1056 + self.mult_inc_per_sec_drift = 1.0082+0.0082*1.4
1069 1057  
1070 1058 # #####################################################################
1071 1059 # #####################################################################
... ... @@ -1181,7 +1169,7 @@ if __name__ == "__main__":
1181 1169 mount_scx11.hadec_goto(0,56)
1182 1170  
1183 1171 if example == 2:
1184   - home = celme.Home("GPS 2.25 E 43.567 148")
  1172 + home = celme.Home("GPS 2.0375 E 43.6443484725 136.9")
1185 1173 site = celme.Site(home)
1186 1174  
1187 1175 # === SCX11 connection
... ... @@ -1192,17 +1180,38 @@ if __name__ == "__main__":
1192 1180 mount_scx11_axisb = mount_scx11.axis[Mountaxis.BASE]
1193 1181 mount_scx11_axisp = mount_scx11.axis[Mountaxis.POLAR]
1194 1182 # --- simulation or not
1195   - mount_scx11_axisb.real = False
1196   - mount_scx11_axisb.ratio_wheel_puley = 6.32721
  1183 + mount_scx11_axisb.real = True
  1184 + mount_scx11_axisb.ratio_wheel_puley = 6.132857; # 6.27819 ; # 6.32721 ; # D=208.0 ; d=32.5 ; f=1.5 ; (D+f/2)/(d+f/2)
1197 1185 mount_scx11_axisb.inc_per_motor_rev = 1540 # DPR for -490000 to +490000
1198 1186 mount_scx11_axisb.senseinc = 1
1199 1187 mount_scx11_axisp.real = False
1200   - mount_scx11_axisp.ratio_wheel_puley = 6.8262
  1188 + mount_scx11_axisp.ratio_wheel_puley = 6.75 ; # 6.75 ; # 6.7462935 ; # D=208.0 ; d=30.0 ; f=1.5 ; (D+f/2)/(d+f/2)
1201 1189 mount_scx11_axisp.inc_per_motor_rev = 1421
1202 1190 mount_scx11_axisp.senseinc = -1
  1191 + # ---
1203 1192 # --- Initial ha,dec for encoders
1204   - mount_scx11_axisb.update_inc0(-17800,-90,mount_scx11_axisb.PIERSIDE_POS1)
1205   - mount_scx11_axisp.update_inc0(2345,90,mount_scx11_axisp.PIERSIDE_POS1)
  1193 + #mount_scx11_axisb.update_inc0(10750,-90,mount_scx11_axisb.PIERSIDE_POS1)
  1194 + if False:
  1195 + # --- German mount
  1196 + mount_scx11.reversing = True
  1197 + mount_scx11.lim_side_east = +30 ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  1198 + mount_scx11.lim_side_west = -30 ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  1199 + mount_scx11_axisb.update_inc0(62500,-90,mount_scx11_axisb.PIERSIDE_POS1)
  1200 + mount_scx11_axisp.update_inc0(6500,90,mount_scx11_axisp.PIERSIDE_POS1)
  1201 + mount_scx11.park_ha = 270
  1202 + mount_scx11.park_dec = 90
  1203 + mount_scx11.park_side = mount_scx11_axisb.PIERSIDE_POS1
  1204 + else:
  1205 + # --- Fork mount. Tube always "west" in "auto"
  1206 + mount_scx11.reversing = False
  1207 + mount_scx11.lim_side_east = -180 ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  1208 + mount_scx11.lim_side_west = -180 ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  1209 + mount_scx11_axisb.update_inc0(62500,0,mount_scx11_axisb.PIERSIDE_POS1)
  1210 + mount_scx11_axisp.update_inc0(6500,90,mount_scx11_axisp.PIERSIDE_POS1)
  1211 + mount_scx11.park_ha = 0
  1212 + mount_scx11.park_dec = 0
  1213 + mount_scx11.park_side = mount_scx11_axisb.PIERSIDE_POS1
  1214 +
1206 1215 #mount_scx11_axisb.update_inc0(0,-90,mount_scx11_axisb.PIERSIDE_POS1)
1207 1216 #mount_scx11_axisp.update_inc0(0,90,mount_scx11_axisp.PIERSIDE_POS1)
1208 1217 # --- first read of encoders (zero values the first time)
... ... @@ -1227,7 +1236,7 @@ if __name__ == "__main__":
1227 1236 mount_scx11.disp()
1228 1237 dt = time.time()-t0
1229 1238  
1230   - if False:
  1239 + if True:
1231 1240 try:
1232 1241 mount_scx11.pad_create("pad_dev1")
1233 1242 except (KeyboardInterrupt, SystemExit):
... ...
mount_tnc/raspberry/mountpad.py
... ... @@ -211,6 +211,40 @@ class Mountpad(Thread):
211 211 with self.pad_lock:
212 212 self._main.hadec_move_stop()
213 213  
  214 + def pad_cbk_move_w_lim(self,event):
  215 + if event.type==tk.EventType.ButtonPress:
  216 + with self.pad_lock:
  217 + incsimus = [0 for kaxis in range(2)]
  218 + increals, incsimus = self._main.read_encs(incsimus)
  219 + kaxis = 1
  220 + current_axis = self._main.axis[kaxis]
  221 + inc0 = current_axis.inc0
  222 + print("increals={} inc0={}".format(increals[kaxis],inc0))
  223 + if current_axis.real==True:
  224 + if abs(increals[kaxis] - inc0) < 2:
  225 + kaxis = 0
  226 + current_axis = self._main.axis[kaxis]
  227 + pc = -1*current_axis.inc_per_sky_rev *0.25
  228 + err, res = self._main.inc_goto(kaxis, pc, 30000)
  229 + pass
  230 +
  231 + def pad_cbk_move_e_lim(self,event):
  232 + if event.type==tk.EventType.ButtonPress:
  233 + with self.pad_lock:
  234 + incsimus = [0 for kaxis in range(2)]
  235 + increals, incsimus = self._main.read_encs(incsimus)
  236 + kaxis = 1
  237 + current_axis = self._main.axis[kaxis]
  238 + inc0 = current_axis.inc0
  239 + print("increals={} inc0={}".format(increals[kaxis],inc0))
  240 + if current_axis.real==True:
  241 + if abs(increals[kaxis] - inc0) < 2:
  242 + kaxis = 0
  243 + current_axis = self._main.axis[kaxis]
  244 + pc = current_axis.inc_per_sky_rev *0.25
  245 + err, res = self._main.inc_goto(kaxis, pc, 30000)
  246 + pass
  247 +
214 248 def pad_cbk_park(self):
215 249 if False:
216 250 ha = 90
... ... @@ -389,23 +423,31 @@ class Mountpad(Thread):
389 423 self.tkroot.rowconfigure(0, weight=1)
390 424 self.tkroot.columnconfigure(0, weight=1)
391 425 button_N = tk.Button(frame_move, text="N", height=3, width=10, font=fontStyle_1)
392   - button_N.grid(row=0, column=1, sticky="nsew")
  426 + button_N.grid(row=0, column=2, sticky="nsew")
393 427 button_N.bind('<Button-1>',self.pad_cbk_move_n_event)
394 428 button_N.bind('<ButtonRelease>',self.pad_cbk_move_n_event)
  429 +
  430 + button_limE = tk.Button(frame_move, text="Lim E", height=3, width=5, font=fontStyle_1)
  431 + button_limE.bind('<Button-1>',self.pad_cbk_move_e_lim)
  432 + button_limE.grid(row=1, column=0, sticky="nsew")
395 433 button_E = tk.Button(frame_move, text="E", height=3, width=10, font=fontStyle_1)
396 434 button_E.bind('<Button-1>',self.pad_cbk_move_e_event)
397 435 button_E.bind('<ButtonRelease>',self.pad_cbk_move_e_event)
398   - button_E.grid(row=1, column=0, sticky="nsew")
  436 + button_E.grid(row=1, column=1, sticky="nsew")
399 437 entry_speed_drift = tk.Entry(frame_move, textvariable=self.pad_var_speed_drift, width=10, justify='center', font=fontStyle_1)
400   - entry_speed_drift.grid(row=1, column=1, sticky="nsew")
  438 + entry_speed_drift.grid(row=1, column=2, sticky="nsew")
401 439 button_W = tk.Button(frame_move, text="W", height=3, width=10, font=fontStyle_1)
402 440 button_W.bind('<Button-1>',self.pad_cbk_move_w_event)
403 441 button_W.bind('<ButtonRelease>',self.pad_cbk_move_w_event)
404   - button_W.grid(row=1, column=2, sticky="nsew")
  442 + button_W.grid(row=1, column=3, sticky="nsew")
  443 + button_limW = tk.Button(frame_move, text="Lim W", height=3, width=5, font=fontStyle_1)
  444 + button_limW.bind('<Button-1>',self.pad_cbk_move_w_lim)
  445 + button_limW.grid(row=1, column=4, sticky="nsew")
  446 +
405 447 button_S = tk.Button(frame_move, text="S", height=3, width=10, font=fontStyle_1)
406 448 button_S.bind('<Button-1>',self.pad_cbk_move_s_event)
407 449 button_S.bind('<ButtonRelease>',self.pad_cbk_move_s_event)
408   - button_S.grid(row=2, column=1, sticky="nsew")
  450 + button_S.grid(row=2, column=2, sticky="nsew")
409 451 frame_move.pack(side = tk.TOP, pady=5)
410 452  
411 453 frame_stop = tk.Frame(self.tkroot)
... ...