Beispiel #1
0
def execute_release():
    global RELEASED
    LOG.info("RELEASING!")
    orbit_lib.speak("Releasing in")
    time.sleep(3)
    for t in [3, 2, 1]:
        orbit_lib.speak(t)
        time.sleep(1)
    orbit_lib.releaseChord()
    RELEASED = True
Beispiel #2
0
def switch_health_check():
    global CURRENT_STATE
    location = orbit_lib.LOCATION
    battStatus = orbit_lib.getBatteryStatus()
    if (location['provider'] != 'gps'):
        LOG.error("Network Provider not sufficient: %s" % location['provider'])
        return
    if (battStatus['level'] < 30):
        LOG.error("Battery too low: %s" % battStatus['level'])
        return
    LOG.info("Health Check Passed")
    orbit_lib.speak("Health Check Complete")
    orbit_lib.sendTextData("Health Good")
    orbit_lib.speak("Beginning Ascent")
    CURRENT_STATE = "ASCENT"
Beispiel #3
0
def MAIN_LOOP():
    global LOG
    global CURRENT_STATE
    orbit_lib.speak("Loading")
    self = sys.modules[__name__]
    setup_custom_logger("orbit")
    LOG = logging.getLogger("orbit")
    signal.signal(signal.SIGINT, signal_handler)
    orbit_lib.speak("Starting")

    # Ininite loop for state driven work
    while RUNNING:
        try:
            LOG.debug("Current State: %s" % CURRENT_STATE)
            stateData = STATE_ORDER[CURRENT_STATE]
            funcExec = getattr(self, stateData['execute'])
            funcSwitch = getattr(self, stateData['switch'])
            funcExec()
            funcSwitch()
            time.sleep(.01)
        except:
            time.sleep(1)
            LOG.error(traceback.print_exc())
            CURRENT_STATE = "RECOVER"
Beispiel #4
0
def execute_recovery():
    orbit_lib.speak("Recovery!")
    LOG.critical("Attempting Recovery")
    orbit_lib.sendTextData("Recovery!")
Beispiel #5
0
def execute_parachute():
    orbit_lib.speak("Releasing parachute!")
    orbit_lib.sendTextData("Parachute!")
    orbit_lib.releaseParachute()
Beispiel #6
0
def switch_release():
    global CURRENT_STATE
    orbit_lib.speak("Performing Flight")
    CURRENT_STATE = "FLIGHT"