-
Notifications
You must be signed in to change notification settings - Fork 3
The comm.py Module
The comm.py module is the main point of interaction between this application and the satellite. It acts a client to both, and interprets commands sent from the operator to the satellite, and also interprets telemetry sent from the satellite.
While the comm.py module runs, it polls the communications
table of the database that the web application runs on every 5 seconds (this time interval may be changed in the future). See here for the line of code that sets this value. Each poll, the comm.py module will execute a query to check whether there are any communications where is_queued==true && receiver=='comm'
. If there are, it will send these commands to the satellite and,
- If the response is received successfully, the response is logged and the
is_queued
value of the communication object that was sent to the satellite will changed tofalse
denoting that it has successfully completed - Otherwise, an error message will be logged (printed to stdout) and the
is_queued
value of the communication object will remain unchanged (assumption here is that the communication failed for network reasons so the comm.py module will try sending the communication again next polling iteration)
To extend the comm.py module, there are 4 files of interest in the root directory of the project:
Acts a loop for constantly checking commands sent by an operator in the communications table, and sending them to a socket.
This module posts the commands in automation.txt (a file with commands separated by newlines) to the communications table with an is_queued
value of true
and a receiver
value of 'comm'
, which will result in them being sent to the satellite by comm.py during its next polling iteration.
The script then loads the next passover time, and utlizes the linux at
program to schedule the next time automation will run. You will need to install at
, which can be done with sudo apt-get install at
on Ubuntu.
If there are no new passover times left in the database, the script grabs the TLE from the most recent housekeeping data and parses the TLE using the python package pyorbital. Acquisition of Signal (AOS) times for passovers in the next 24 hours are calculated using get_next_passes()
and those passovers are then added to the database.
Run this script to schedule automation.py to run at the next passover time. Only necessary to run if no automation is scheduled (ie. passovers have ran out, or for initially setting up automation).