예제 #1
0
    def __init__(self):
        super().__init__()
        logger.info("Initializing...")
        self.init_parameters()
        self.command_queue = Queue()
        self.downlink_queue = Queue()
        self.FMQueue = Queue()
        self.commands_to_execute = []
        self.downlinks_to_execute = []
        self.telemetry = Telemetry(self)
        self.burn_queue = Queue()
        self.reorientation_queue = Queue()
        self.reorientation_list = []
        self.maneuver_queue = Queue()  # maneuver queue
        # self.init_comms()
        self.command_handler = CommandHandler()
        self.downlink_handler = DownlinkHandler()
        self.command_counter = 0
        self.downlink_counter = 0
        self.command_definitions = CommandDefinitions(self)
        self.init_sensors()
        self.last_opnav_run = datetime.now()  # Figure out what to set to for first opnav run
        self.log_dir = LOG_DIR
        self.logger = get_log()
        self.attach_sigint_handler()  # FIXME

        if os.path.isdir(self.log_dir):
            self.flight_mode = RestartMode(self)
        else:
            os.makedirs(CISLUNAR_BASE_DIR)
            os.mkdir(LOG_DIR)
            self.flight_mode = BootUpMode(self)
        self.create_session = create_sensor_tables_from_path(DB_FILE)
예제 #2
0
    def __init__(self):
        super().__init__()
        logger.info("Initializing...")
        self.init_parameters()
        self.command_queue = Queue()
        self.downlink_queue = Queue()
        self.FMQueue = Queue()
        self.commands_to_execute = []
        self.downlinks_to_execute = []
        self.burn_queue = Queue()
        self.reorientation_queue = Queue()
        self.reorientation_list = []
        self.maneuver_queue = Queue()  # maneuver queue
        self.opnav_queue = Queue()  # determine state of opnav success
        # self.init_comms()
        logger.info("Initializing commands and downlinks")
        self.command_handler = CommandHandler()
        self.downlink_handler = DownlinkHandler()
        self.command_counter = 0
        self.downlink_counter = 0
        self.command_definitions = CommandDefinitions(self)
        self.last_opnav_run = datetime.now()  # Figure out what to set to for first opnav run
        self.log_dir = LOG_DIR
        self.logger = get_log()
        self.attach_sigint_handler()  # FIXME
        self.file_block_bank = {}
        self.need_to_reboot = False
        self.gom: Gomspace
        self.gyro: GyroSensor
        self.adc: ADC
        self.rtc: RTC
        self.radio: Radio
        self.mux: camera.CameraMux
        self.camera: camera.Camera
        self.nemo_manager: NemoManager
        self.init_sensors()

        # Opnav subprocess variables
        self.opnav_proc_queue = Queue()
        self.opnav_process = Process()  # define the subprocess

        if os.path.isdir(self.log_dir):
            logger.info("We are in Restart Mode")
            self.flight_mode = RestartMode(self)
        else:
            logger.info("We are in Bootup Mode")
            os.makedirs(CISLUNAR_BASE_DIR, exist_ok=True)
            os.mkdir(LOG_DIR)
            self.flight_mode = BootUpMode(self)
        self.create_session = create_sensor_tables_from_path(DB_FILE)
        logger.info("Initializing Telemetry")
        self.telemetry = Telemetry(self)
        logger.info("Done intializing")
예제 #3
0
    def __init__(self):
        super().__init__()
        logger.info("Initializing...")
        self.init_parameters()
        self.command_queue = Queue()
        self.downlink_queue = Queue()
        self.FMQueue = Queue()
        self.commands_to_execute = []
        self.downlinks_to_execute = []
        self.telemetry = Telemetry(self)
        self.burn_queue = Queue()
        self.reorientation_queue = Queue()
        self.reorientation_list = []
        self.maneuver_queue = Queue()  # maneuver queue
        self.opnav_queue = Queue()   # determine state of opnav success
        # self.init_comms()
        self.command_handler = CommandHandler()
        self.downlink_handler = DownlinkHandler()
        self.command_counter = 0
        self.downlink_counter = 0
        self.command_definitions = CommandDefinitions(self)
        self.last_opnav_run = datetime.now()  # Figure out what to set to for first opnav run
        self.log_dir = LOG_DIR
        self.logger = get_log()
        self.attach_sigint_handler()  # FIXME
        self.need_to_reboot = False

        self.gom = None
        self.gyro = None
        self.adc = None
        self.rtc = None
        self.radio = None
        self.mux = None
        self.camera = None
        self.init_sensors()

        # Telemetry
        self.tlm = Telemetry(self)

        # Opnav subprocess variables
        self.opnav_proc_queue = Queue()
        self.opnav_process = Process()  # define the subprocess

        if os.path.isdir(self.log_dir):
            self.flight_mode = RestartMode(self)
        else:
            os.makedirs(CISLUNAR_BASE_DIR, exist_ok=True)
            os.mkdir(LOG_DIR)
            self.flight_mode = BootUpMode(self)
        self.create_session = create_sensor_tables_from_path(DB_FILE)
예제 #4
0
from utils.exceptions import UnknownFlightModeException

from communications.command_definitions import CommandDefinitions

# Necessary modes to implement
# BootUp, Restart, Normal, Eclipse, Safety, Propulsion,
# Attitude Adjustment, Transmitting, OpNav (image processing)
# TestModes

no_transition_modes = [
    FMEnum.SensorMode.value, FMEnum.TestMode.value, FMEnum.CommsMode.value,
    FMEnum.Command.value
]

logger = get_log()


class FlightMode:
    # Override in Subclasses to tell CommandHandler the functions and arguments this flight mode takes
    command_codecs = {}
    sensordata_codecs = {}
    downlink_codecs = {}

    # Map argument names to (packer,unpacker) tuples
    # This tells CommandHandler how to serialize the arguments for commands to this flight mode
    command_arg_types = {}
    sensordata_arg_unpackers = {}
    downlink_arg_types = {}

    flight_mode_id = -1  # Value overridden in FM's implementation
예제 #5
0
#
# Created by Stefan Brechter ([email protected]) on 03/11/2020
#
# Cislunar Explorers
# Space Systems Design Studio
# Cornell University
#
# For detailed descriptions and analysis of the following test file please
# look at the accompanying End of Semester Report found here:
# https://cornell.app.box.com/file/664230352636

from ADCDriver import ADC
import time
from utils.log import get_log

test_log = get_log()

assert sum([1, 2, 3]) == 6, "Should be 6"


def test_ADC_initialize():
    return ADC()


def test_ADC_read_pressure(testADC):
    test_log.info(testADC.read_pressure())


def test_ADC_read_pressure_continuous(testADC):
    while True:
        test_log.info(testADC.read_pressure())