Telescope.py
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from pyrosapp.models import *
from .Device import DeviceObj
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 TelescopeObj(DeviceObj):
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)