Added periodic check of command queue
This commit is contained in:
parent
5fd6c6a753
commit
9cb4e1f74c
|
@ -1,6 +1,6 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import threading
|
import threading
|
||||||
import astropy.coordinates import SkyCoord as sc
|
from astropy.coordinates import SkyCoord as sc
|
||||||
|
|
||||||
class Sat:
|
class Sat:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -8,46 +8,89 @@ class Sat:
|
||||||
self.attitude = sc(0,0, unit='deg', frame='icrs')
|
self.attitude = sc(0,0, unit='deg', frame='icrs')
|
||||||
self.saturation = 0
|
self.saturation = 0
|
||||||
self.battery = 10000
|
self.battery = 10000
|
||||||
self.system_modes =
|
self.MTE = 0
|
||||||
{
|
self.kill = False
|
||||||
"opt_read": False
|
self.system_modes = {
|
||||||
"opt_cool": False
|
"opt_read": False,
|
||||||
"rad_mode": False
|
"opt_cool": False,
|
||||||
"grv_mode": False
|
"rad_mode": False,
|
||||||
"HGA_mode": "off" #off/rx/tx
|
"grv_mode": False,
|
||||||
"LGA_mode": "idle" #idle/dup/tx
|
"HGA_mode": "off", #off/rx/tx
|
||||||
"torquers": False
|
"LGA_mode": "idle", #idle/dup/tx, for power these modes will be automatic
|
||||||
"gyro_del": False
|
"torquers": False,
|
||||||
|
"gyro_del": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def inst_optical():
|
def getLoc(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def inst_optical(self):
|
||||||
"""
|
"""
|
||||||
Main Telescope
|
Main Telescope
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def inst_radiation():
|
def inst_ultraviolet(self):
|
||||||
|
"""
|
||||||
|
UV band Telescope
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def inst_Hydrogen_line(self):
|
||||||
|
"""
|
||||||
|
hydrogen line radio telescope
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def inst_radiation(self):
|
||||||
"""
|
"""
|
||||||
beta/gamma detector
|
beta/gamma detector
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def inst_gravitometer():
|
def inst_gravitometer(self):
|
||||||
"""
|
"""
|
||||||
local gravity and potential gravity waves (rare)
|
local gravity and potential gravity waves (rare)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def inst_hg_antenna():
|
def inst_hg_antenna(self):
|
||||||
"""
|
"""
|
||||||
tight beam antenna for high speed up/downlink
|
tight beam antenna for high speed up/downlink
|
||||||
has to point at your ground station.
|
has to point at your ground station.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def check_command_q():
|
def check_command_q(self):
|
||||||
pass
|
with open('test_q', 'r+') as q:
|
||||||
|
commands = q.readlines()
|
||||||
|
remainder = ""
|
||||||
|
for com in commands:
|
||||||
|
if int(com.split(":")[0]) == self.MTE:
|
||||||
|
print("got com -> ", com)
|
||||||
|
else:
|
||||||
|
remainder += com
|
||||||
|
q.truncate(0)
|
||||||
|
q.seek(0)
|
||||||
|
q.write(remainder)
|
||||||
|
|
||||||
def update():
|
def update(self):
|
||||||
pass
|
self.check_command_q()
|
||||||
|
self.MTE += 1
|
||||||
|
if not self.kill:
|
||||||
|
threading.Timer(1, self.update).start()
|
||||||
|
else:
|
||||||
|
print("heading to bed")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
BoSLOO = Sat()
|
||||||
|
BoSLOO.update()
|
||||||
|
#while True:
|
||||||
|
# try:
|
||||||
|
# pass
|
||||||
|
# except KeyboardInterrupt:
|
||||||
|
# BoSLOO.kill = True
|
||||||
|
# print("Good night!")
|
||||||
|
# break
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue