def syncronize(host, port,azimuth,altitude): """Syncronize actual position with the azimuth/altitude provided""" import synscan UDP_IP = os.getenv("SYNSCAN_UDP_IP",host) UDP_PORT = int(os.getenv("SYNSCAN_UDP_PORT",port)) smc=synscan.motors(UDP_IP,UDP_PORT) smc.set_pos(azimuth,altitude)
def track(host, port, azimuth_speed, altitude_speed): """Move at desired speed (degrees per second)""" import synscan UDP_IP = os.getenv("SYNSCAN_UDP_IP",host) UDP_PORT = int(os.getenv("SYNSCAN_UDP_PORT",port)) smc=synscan.motors(UDP_IP,UDP_PORT) smc.track(azimuth_speed,altitude_speed)
def goto(host, port,azimuth,altitude,wait): """Do a GOTO to a target azimuth/altitude""" import synscan UDP_IP = os.getenv("SYNSCAN_UDP_IP",host) UDP_PORT = int(os.getenv("SYNSCAN_UDP_PORT",port)) smc=synscan.motors(UDP_IP,UDP_PORT) smc.goto(azimuth,altitude,syncronous=wait)
def stop(host, port,wait): """Stop Motors""" import synscan UDP_IP = os.getenv("SYNSCAN_UDP_IP",host) UDP_PORT = int(os.getenv("SYNSCAN_UDP_PORT",port)) smc=synscan.motors(UDP_IP,UDP_PORT) smc.axis_stop_motion(1,syncronous=wait) smc.axis_stop_motion(2,syncronous=wait)
def switch(host, port, on,seconds): """Activate/Deactivate mount auxiliary switch. ON must be bool (1 or 0)""" import synscan import time UDP_IP = os.getenv("SYNSCAN_UDP_IP",host) UDP_PORT = int(os.getenv("SYNSCAN_UDP_PORT",port)) smc=synscan.motors(UDP_IP,UDP_PORT) if seconds>0: smc.set_switch(on) time.sleep(seconds) smc.set_switch(not on) else: smc.set_switch(on)
def watch(host, port, seconds): """Watch values""" import synscan import json import time UDP_IP = os.getenv("SYNSCAN_UDP_IP", host) UDP_PORT = os.getenv("SYNSCAN_UDP_PORT", port) smc = synscan.motors(UDP_IP, UDP_PORT) while True: response = smc.update_current_values(logaxis=3) t = time.localtime() response['TIME'] = time.strftime("%H:%M:%S", t) print( json.dumps(response, sort_keys=False, indent=4, separators=(',', ': '))) time.sleep(seconds)
import time import synscan smc = synscan.motors() #Set actual position az=0 alt=0 smc.set_pos(0, 0) #define a grid and walk over his points for az in range(0, 180, 30): for alt in range(0, 90, 30): smc.goto(az, alt, syncronous=True) #Goto and wait to finish smc.set_switch(True) #Activate camera with the integrate switch time.sleep(2) smc.set_switch(False)
import synscan # '''Goto example''' mount_ip_address = "192.168.0.145" smc = synscan.motors(mount_ip_address) #Syncronize mount actual position to (0,0) smc.set_pos(0, 0) #Move forward and wait to finish smc.goto(30, 30, syncronous=True) #Return to original position and exit without wait smc.goto(0, 0, syncronous=False)