Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion dev/run_gs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from ground_core import GroundStation
from ground_core.light_status import FlaskApp
import requests
flaskApp = None
flask_url = 'http://127.0.0.1:5000/update_colors'

def system_msg_callback(msg):
'''
Expand All @@ -7,8 +11,31 @@ def system_msg_callback(msg):
Note that this is a blocking function so nothing with loops or sleeps should be done here.
'''
print("System message received: ", msg)



def lightTower_heartbeat_callback(self, msg):
"""
This callback will be triggered for the ScanTheCode mission

"""

data = {
'colors': msg,
}

# Send the POST request with the new colors
response = requests.post(flask_url, json=data)

def startFlask(self):
self.flaskApp = FlaskApp()
self.flaskApp.run()





if __name__ == "__main__":
gs = GroundStation()
gs.add_callback("RXPTH", system_msg_callback)
gs.add_callback("RXPTH", system_msg_callback)
gs.add_callback("RXCOD", lightTower_heartbeat_callback)