This repository has been archived by the owner on Jul 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
core.py
58 lines (50 loc) · 1.61 KB
/
core.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
from satellite_tle import fetch_tle
from orbit_predictor.sources import get_predictor_from_tle_lines
from apscheduler.schedulers.background import BackgroundScheduler
from pytz import utc
import config
from threading import Lock
# Main scheduler
scheduler = BackgroundScheduler()
# Decoding queue
decoding_queue = list()
# Radio mutex
radio_lock = Lock()
# Init scheduler
def initScheduler():
scheduler.configure(timezone=utc)
scheduler.start()
# Satellite class
class Satellite:
def __init__(self, name, norad, priority, min_elevation, frequency, downlink, delete_processed_files):
self.name = name
self.norad = norad
self.priority = priority
self.min_elevation = min_elevation
self.frequency = frequency
self.downlink = downlink
self.delete_processed_files = delete_processed_files
def fetchTLE(self):
tle = fetch_tle.fetch_tle_from_celestrak(self.norad)
name, line1, line2 = tle
self.tle_1 = line1
self.tle_2 = line2
def getPredictor(self):
self.predictor = get_predictor_from_tle_lines((self.tle_1, self.tle_2))
return self.predictor
# Recording class
class Recording:
def __init__(self, satellite, filename, date, passobj):
self.satellite = satellite
self.filename = filename
self.date = date
self.passobj = passobj
# Update TLE
def updateTLEs():
for satellite in config.satellites:
print("Fetching TLE for " + satellite.name)
satellite.fetchTLE()
print(" " + satellite.tle_1)
print(" " + satellite.tle_2)
print()
print()