Blame view

src/devices/Telescope.py 1.4 KB
ddf59dd4   haribo   Remaniement :
1
2
from common.models import *
from .Device import DeviceController
9774228b   haribo   Date: 22/06/2016
3
from enum import Enum
ac26ad2b   haribo   Date: 22/07/2016
4
import configparser
9774228b   haribo   Date: 22/06/2016
5
6
7
8
9
10

class RotatorEnum(Enum):
    none = "None"
    synchro = "Synchro"
    tracking = "Tracking"

ec372f36   haribo   Date: 28/06/2016
11
class MoveModeEnum(Enum):
9774228b   haribo   Date: 22/06/2016
12
13
14
15
16
17
18
19
20
    goto = "Goto"
    track = "Track"
    goto_track = "GotoTrack"

class CoordsFrameEnum(Enum):
    hadec = "Hadec"
    radec = "Radec"
    altaz = "Altaz"

ac26ad2b   haribo   Date: 22/07/2016
21
22
CONFIG_FILE = "../simulators/socket_config.ini"

ddf59dd4   haribo   Remaniement :
23
class TelescopeController(DeviceController):
9774228b   haribo   Date: 22/06/2016
24
25
26
27
28
29
30
31
32
33
34
35

    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),
ec372f36   haribo   Date: 28/06/2016
36
            ("MOVE_MODE", [1, ], MoveModeEnum),
9774228b   haribo   Date: 22/06/2016
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
            ("COORDS_FRAME", [1, ], CoordsFrameEnum),
        ]

        self.get_msgs = [
            "POSITION",
            "STATUS",
            "SETUP",
        ]

        self.do_msgs = [
            ("DOORS", [1, ], bool),
            ("START", [0, ],),
            ("ABORT", [0, ],),
            ("STOP", [0, ],),
            ("HOMING", [0, ],),
        ]

ac26ad2b   haribo   Date: 22/07/2016
54
55
56
57
58
        config = configparser.ConfigParser()
        config.read(CONFIG_FILE)

        self.ip = config.get("Telescope", "ip")
        self.port = int(config.get("Telescope", "port"))
9774228b   haribo   Date: 22/06/2016
59

ac26ad2b   haribo   Date: 22/07/2016
60
        print(self.ip, self.port)