-
Notifications
You must be signed in to change notification settings - Fork 5
/
__ADCS__.py
109 lines (82 loc) · 3.31 KB
/
__ADCS__.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""---------------------------------------------------------------------------
Copyright (C) 2017, Jonathan "Jonny" Hyman
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------
Rocket Project
Autonomous Digital Control Station
https://github.com/jonnyhyman/ADCS
- HDCS Communications
- Microcontroller robust duplex communications ("Microlink")
- Micro reliable test matrix uploads ("TM")
- Micros remote upload triggering ("UC")
- Automatic exceeded range aborts ("ER")
- Countdown control (Halt,Start,Set)
- HACS robust duplex communications
-----------------------------------------------------------------------------
"""
VERSION = 6.8
from time import time
import sys
try:
inhibit = str(sys.argv[1]).lower()
except IndexError:
inhibit = None
if inhibit is not None:
# >> options are:
# -- n2o: to inhibit wireless sensing
# -- auto: to inhibit auto command actions
print('>> ADCS INHIBIT ',inhibit,'<<')
import Definitions
from State_Generator import State_Generator
from Telemetry_link import Wireless_Sensing
from Microlink import Microlink
from HDCS_Link import HDCS_Link
from HACS_Link import HACS_Link
from Actions import Actions
from Logging import Log
if __name__ == '__main__':
""" Instantiate classes """
micro = Microlink(['Micro1','Micro2','Micro3','Micro4'],strict=True)
if inhibit != 'n2o':
n2o = Wireless_Sensing(
port = Definitions.N2O['port'],
mac_addr = Definitions.N2O['mac'],
# ip = Definitions.N2O['ip'],
)
state = State_Generator()
hdcs = HDCS_Link()
hacs = HACS_Link()
act = Actions(micro,hdcs)
""" Initialize variables """
Command = dict(Definitions.Command)
State = dict(Definitions.State)
log = Log([State,Command])
while True:
# Acquire human input and update commands
hdcsCmd = hdcs.transceive_and_parse(State)
hacsCmd = hacs.update(State)
if hdcsCmd:
Command.update(hdcsCmd)
print('hdcs cmd update! >>',hdcsCmd)
if hacsCmd != {}:
Command.update(hacsCmd)
print('hacs cmd update! >>',hacsCmd)
# ADCS Command Actions
act.Cmd(Command, State)
# Micro Command Actions -> Update State
state.Generator(State, micro.Microevent(Command,State,show=1), micro.order)
# Telemetry State Update
if inhibit != 'n2o':
state.Telemetry(State, [n2o], verbose=0)
# ADCS Auto Command Actions
act.Auto(Command,State,inhibit)
log.Commit()