tiny amount of progress.

This commit is contained in:
Laika 2021-05-01 09:36:26 -04:00
parent 813783c9f9
commit a9a7e1eead

View file

@ -1,12 +1,16 @@
import numpy as np import numpy as np
import threading import threading
from astropy.coordinates import SkyCoord as sc from astropy.coordinates import SkyCoord as sc
from os import system
#debugg to rebuild the file every test
system('cp command_q test_q')
class Sat: class Sat:
def __init__(self): def __init__(self):
self.location = self.getLoc() self.location = self.get_loc()
self.attitude = sc(0,0, unit='deg', frame='icrs') self.attitude = sc(0,0, unit='deg', frame='icrs')
self.saturation = 0
self.battery = 10000 self.battery = 10000
self.MTE = 0 self.MTE = 0
self.kill = False self.kill = False
@ -20,41 +24,53 @@ class Sat:
"torquers": False, "torquers": False,
"gyro_del": False, "gyro_del": False,
} }
self.maneuver_q = []
self.maneuver_TTC = 0 #time to completion
self.gyro_saturation = 0
def getLoc(self): self.lens_temp =
def get_loc(self):
"""
retrieve location from orbit sim
"""
pass pass
def inst_optical(self): def get_status(self, command="null"):
print("BoSLOO STATUS:")
print("Feelin Fine <3")
def inst_optical(self, command="null"):
""" """
Main Telescope Main Telescope
""" """
pass pass
def inst_ultraviolet(self): def inst_ultraviolet(self, command="null"):
""" """
UV band Telescope UV band Telescope
""" """
pass pass
def inst_Hydrogen_line(self): def inst_hydrogen_line(self, command="null"):
""" """
hydrogen line radio telescope hydrogen line radio telescope
""" """
def inst_radiation(self): def inst_radiation(self, command="null"):
""" """
beta/gamma detector beta/gamma detector
""" """
pass pass
def inst_gravitometer(self): def inst_gravitometer(self, command="null"):
""" """
local gravity and potential gravity waves (rare) local gravity and potential gravity waves (rare)
""" """
pass pass
def inst_hg_antenna(self): def inst_hg_antenna(self, command="null"):
""" """
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.
@ -63,24 +79,47 @@ class Sat:
def check_command_q(self): def check_command_q(self):
with open('test_q', 'r+') as q: with open('test_q', 'r+') as q:
commands = q.readlines() commands = q.read().splitlines()
remainder = "" remainder = ""
for com in commands: for com in commands:
if int(com.split(":")[0]) == self.MTE: if int(com.split(":")[0]) == self.MTE:
print("got com -> ", com) print("got com -> ", com)
com_type = com.split(":")[1]
if com_type.strip() == "status":
self.get_status(com)
elif com_type.strip() == "point":
self.set_target(com)
elif com_type.strip() == "uload":
self.upload(com)
elif com_type.strip() == "dload":
self.download()
elif com_type.strip() == "list":
self.list_drive()
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
elif com_type.strip() == "status":
else: else:
remainder += com remainder += com + '\n'
q.truncate(0) q.truncate(0)
q.seek(0) q.seek(0)
q.write(remainder) q.write(remainder)
def update(self): def update(self):
self.check_command_q() self.check_command_q()
self.MTE += 1
if not self.kill: if not self.kill:
threading.Timer(1, self.update).start() threading.Timer(1, self.update).start()
else: else:
print("heading to bed") print("heading to bed")
self.MTE += 1
if __name__ == "__main__": if __name__ == "__main__":