from common.models import * from .Device import DeviceController from enum import Enum import configparser class RotatorEnum(Enum): none = "None" synchro = "Synchro" tracking = "Tracking" class MoveModeEnum(Enum): goto = "Goto" track = "Track" goto_track = "GotoTrack" class CoordsFrameEnum(Enum): hadec = "Hadec" radec = "Radec" altaz = "Altaz" CONFIG_FILE = "../simulators/socket_config.ini" class TelescopeController(DeviceController): def __init__(self): super().__init__() self.set_msgs = [ ("SPEED", [2, 3], float), ("COORDS", [2, 3], float), ("TRACKING_SPEED", [2, 3], float), ("ACCEL", [2, 3], float), ("ROTATOR", [1, ], RotatorEnum), ("FOCUS", [1, ], float), ("MOVE_MODE", [1, ], MoveModeEnum), ("COORDS_FRAME", [1, ], CoordsFrameEnum), ] self.get_msgs = [ "POSITION", "STATUS", "SETUP", ] self.do_msgs = [ ("DOORS", [1, ], bool), ("START", [0, ],), ("ABORT", [0, ],), ("STOP", [0, ],), ("HOMING", [0, ],), ] config = configparser.ConfigParser() config.read(CONFIG_FILE) self.ip = config.get("Telescope", "ip") self.port = int(config.get("Telescope", "port")) print(self.ip, self.port)