config_mcs_tm350_guitalens.py 3.93 KB
home = celme.Home("GPS 2.0375 E 43.6443484725 136.9")
site = celme.Site(home)

# === ASTROMECCA connection
if connect_real_mount == True:
    mount1 = mountastro.Mountastro_Astromecca("HADEC", name="Guitalens Mount", manufacturer="Astro MECCA", model="TM350", serial_number="beta001", site=site, CONTROLLER_BASE_ID=1, CONTROLLER_POLAR_ID=2)
    mount1.set_channel_params("SERIAL", port=port_serial_controller, baud_rate=115200, delay_init_chan=0.1, end_of_command_to_send="\r\n".encode('utf8'), end_of_command_to_receive="\r\n".encode('utf8'), delay_put_read=0.06)
    mount1.verbose_chan = False
else:
    mount1 = mountastro.Mountastro("HADEC", name="Guitalens Mount", manufacturer="Astro MECCA", model="TM350", serial_number="beta001", site=site, CONTROLLER_BASE_ID=1, CONTROLLER_POLAR_ID=2)
# --- shortcuts
mount1_axisb = mount1.axis[mountastro.Mountaxis.BASE]
mount1_axisp = mount1.axis[mountastro.Mountaxis.POLAR]
# --- simulation or not 
mount1_axisb.real = False
if connect_real_mount == True:
    mount1_axisb.real = True
mount1_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)
mount1_axisb.inc_per_motor_rev = 1540 # DPR for -490000 to +490000
mount1_axisb.senseinc = 1
mount1_axisp.real = False
if connect_real_mount == True:
    mount1_axisp.real = False
mount1_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)
mount1_axisp.inc_per_motor_rev = 1421
mount1_axisp.senseinc = -1

# --- Initial ha,dec for encoders
#mount1_axisb.update_inc0(10750,-90,mount1_axisb.PIERSIDE_POS1)
mount1.set_param("CONFIGURATION","German")
if mount1.get_param("CONFIGURATION")=="German":
    # --- German mount
    mount1.set_param("LABEL_REGULAR","Tube East") ; # Tube west = PIERSIDE_POS1
    mount1.set_param("LABEL_FLIPED","Tube West")
    mount1.set_param("CAN_REVERSE",True)
    mount1.set_param("LIME_REVERSE",+30) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
    mount1.set_param("LIMW_REVERSE",-30) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
    mount1_axisb.update_inc0(0,-90,mount1_axisb.PIERSIDE_POS1)
    mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1) 
    if mount1_axisb.real == True:
        mount1_axisb.update_inc0(62500,-90,mount1_axisb.PIERSIDE_POS1)
    if mount1_axisp.real == True:
        mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1)
    mount1.park_ha = 270
    mount1.park_dec = 90
    mount1.park_side = mount1_axisb.PIERSIDE_POS1    
elif mount1.get_param("CONFIGURATION")=="Fork":
    # --- Fork mount. Tube always "west" in "auto"
    mount1.set_param("LABEL_REGULAR","Regular") ; # Regular = PIERSIDE_POS1
    mount1.set_param("LABEL_FLIPED","Fliped")
    mount1.set_param("CAN_REVERSE",False)
    mount1.set_param("LIME_REVERSE",+90) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
    mount1.set_param("LIMW_REVERSE",-90) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
    mount1_axisb.update_inc0(0,0,mount1_axisb.PIERSIDE_POS1)
    mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1) 
    if mount1_axisb.real == True:
        mount1_axisb.update_inc0(62500,0,mount1_axisb.PIERSIDE_POS1)
    if mount1_axisp.real == True:
        mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1) 
    else:
        mount1_axisp._incsimu = -239793.8
    mount1.park_ha = 0
    mount1.park_dec = 0
    mount1.park_side = mount1_axisb.PIERSIDE_POS1    
    
# --- first read of encoders (zero values the first time)
incsimus = ["" for kaxis in range(mountastro.Mountaxis.AXIS_MAX)] 
mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)        
# --- second read of encoders (valid values)
time.sleep(0.05)
mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)        
# --- Init the simulation values according the real ones
mount1_axisb.synchro_real2simu()
# --- Get the initial position
res = mount1.hadec_coord()
mount1.log.print("Initial position = {}".format(res))

# ======= ASTROMECCA parameters
mount1.speedslew(5.0,5.0)
mount1.disp()