config_mcs_default.py 3.31 KB
home = celme.Home("GPS 2.0975 E 43.631388 158") ; # Telescope valley
site = celme.Site(home)

# === Mount connection
mount1 = mountastro.Mountastro("HADEC", name="Default mount", manufacturer="Simulator", model="BasicMount", serial_number="0", 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
mount1_axisb.ratio_wheel_puley = 6.132857 # 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
mount1_axisp.ratio_wheel_puley = 6.75 # D=208.0 ; d=30.0 ; f=1.5 ; (D+f/2)/(d+f/2)
mount1_axisp.inc_per_motor_rev = 1421 # DPR for -490000 to +490000
mount1_axisp.senseinc = -1

# --- Initial ha,dec for encoders
#mount1_axisb.update_inc0(10750,-90,mount1_axisb.PIERSIDE_POS1)
mount1.set_param("CONFIGURATION","Fork")
if mount1.get_param("CONFIGURATION")=="German":
    # --- German mount
    mount1.set_param("LABEL_REGULAR","Tube West") ; # Tube west = PIERSIDE_POS1
    mount1.set_param("LABEL_FLIPED","Tube East")
    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))

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