|
|
|
@ -22,6 +22,8 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
|
self.settings['port'] = 8081
|
|
|
|
|
self.write_default_profiles()
|
|
|
|
|
|
|
|
|
|
# TODO make it possible, to play a .mp3 file instead of tts
|
|
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
|
# #
|
|
|
|
|
# Actions #
|
|
|
|
@ -214,629 +216,109 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog("gear.not.retractable")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
|
# #
|
|
|
|
|
# Checklists #
|
|
|
|
|
# #
|
|
|
|
|
#################################################################
|
|
|
|
|
|
|
|
|
|
# TODO make it possible, to play a .mp3 file instead of tts
|
|
|
|
|
# TODO read checklists from fg
|
|
|
|
|
@intent_handler(IntentBuilder('CheckListIntent').require('check.list'))
|
|
|
|
|
def handle_check_list_intent(self, message):
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# Before Start Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
tn = self.connect()
|
|
|
|
|
|
|
|
|
|
cl_request = message.data['utterance']
|
|
|
|
|
|
|
|
|
|
checklist_count = self.get_item_count(tn, "/sim/checklists")
|
|
|
|
|
|
|
|
|
|
if checklist_count == 0:
|
|
|
|
|
self.speak("No checklists has been found")
|
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
|
|
for i in range(0, checklist_count):
|
|
|
|
|
checklist = i
|
|
|
|
|
checklist_title = self.get_prop(tn, "/sim/checklists/checklist[" + str(checklist) + "]/title")
|
|
|
|
|
checklist_title = checklist_title.replace('/', '|')
|
|
|
|
|
checklist_title = "^" + checklist_title
|
|
|
|
|
match = re.search(checklist_title, cl_request, re.I)
|
|
|
|
|
|
|
|
|
|
if match != None:
|
|
|
|
|
self.speak(checklist_title + " checklist")
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('BeforeStartCheckIntent').require('before.start.check'))
|
|
|
|
|
def handle_before_start_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.before.start.cockpit.preparation")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'completed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.gear.pin")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'removed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.signs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.adirs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'nav', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.fuel.quantity")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'check|checked', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.to.data")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.baro.ref")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.window")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'close|closed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.beacon")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.before.start.thr.lever")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'idle', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.parking.break")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off|set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("Before start checklist completed")
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# After Start Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('AfterStartCheckIntent').require('after.start.check'))
|
|
|
|
|
def handle_after_start_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.after.start.anti.ice")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.ecam.status")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'checked|check', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.start.pitch.trim")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.start.rudder.trim")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'0|zero', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("After start checklist completed")
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
# #
|
|
|
|
|
# Taxi Check #
|
|
|
|
|
# #
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('TaxiCheckIntent').require('taxi.check'))
|
|
|
|
|
def handle_taxi_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.taxi.flight.controls")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'checked|check', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.flight.instruments")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'checked|check', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.briefing")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'confirmed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.flaps.settings")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.v.spd")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.atc")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.to.no.blue")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'no blue|all green', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.to.rwy")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'confirmed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.cabin.crew")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'confirmed|advised', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.taxi.tcas")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'TA|RA|on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.eng.mode.sel")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off|norm|normal|start', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.packs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off|packs?', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("Before start checklist completed")
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
# #
|
|
|
|
|
# Climb Check #
|
|
|
|
|
# #
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('ClimbCheckIntent').require('climb.check'))
|
|
|
|
|
def handle_climb_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.climb.gear.up")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'up|retracted', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.flaps")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'up|retracted|0', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.packs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.baro.ref")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("After take off checklist completed")
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# Approach Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('ApprCheckIntent').require('appr.check'))
|
|
|
|
|
def handle_appr_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.general.briefing")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'confirmed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.ecam.status")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'checked|check', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.seat.belts")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.baro.ref")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.appr.min")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.eng.mode.sel")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off|norm|normal|start', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("Approach checklist completed")
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
# #
|
|
|
|
|
# LDG Check #
|
|
|
|
|
# #
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('LDGCheckIntent').require('ldg.check'))
|
|
|
|
|
def handle_ldg_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.ldg.no.blue")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'no blue|all green', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("Landing checklist completed")
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# After LDG Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('AfterLDGCheckIntent').require('after.ldg.check'))
|
|
|
|
|
def handle_after_ldg_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.general.flaps")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'up|retracted', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.ldg.spoilers")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'disarmed', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.ldg.apu")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off|on|start', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.ldg.radar")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.after.ldg.wx")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("After landing checklist completed")
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# Parking Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('ParkingCheckIntent').require('parking.check'))
|
|
|
|
|
def handle_parking_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.general.apu.bleed")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.parking.eng")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.seat.belts")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.parking.lights")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.parking.fuel.pumps")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.parking.break")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'on|off|set', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
self.speak("Parking checklist completed")
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
# #
|
|
|
|
|
# Securing Check #
|
|
|
|
|
# #
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('SecuringCheckIntent').require('securing.check'))
|
|
|
|
|
def handle_securing_check_intent(self, message):
|
|
|
|
|
# TODO make checklist plane specific
|
|
|
|
|
response = self.get_response("check.general.adirs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.securing.oxygen")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.apu.bleed")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.securing.emer.exit.lt")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.general.signs")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("check.securing.apu.bat")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
match = re.search(r'off', response, re.I)
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('FlightControlCheckIntent').require('flight.control.check'))
|
|
|
|
|
def handle_securing_check_intent(self, message):
|
|
|
|
|
self.speak("Full up")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full down")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full left")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full right")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full left")
|
|
|
|
|
sleep(4)
|
|
|
|
|
self.speak("Full right")
|
|
|
|
|
sleep(4)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Flight controls checked")
|
|
|
|
|
self.speak("Required checklist wasn't found")
|
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
|
|
# TODO make the programm use all pages, not only the first
|
|
|
|
|
page = ""
|
|
|
|
|
if self.prop_exist(tn, "page", "/sim/checklists/checklist[" + str(checklist) + "]") == 1:
|
|
|
|
|
page = "page/"
|
|
|
|
|
|
|
|
|
|
item_count = self.get_item_count(tn, "/sim/checklists/checklist[" + str(checklist) + "]/" + page)
|
|
|
|
|
|
|
|
|
|
if item_count == 0:
|
|
|
|
|
self.speak("The required checklist has no entrys")
|
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
|
|
for i in range(0, item_count):
|
|
|
|
|
item = i
|
|
|
|
|
item_name = self.get_prop(tn, "/sim/checklists/checklist[" + str(checklist) + "]/" + page + "item[" + str(item) + "]/name")
|
|
|
|
|
item_value = self.get_prop(tn, "/sim/checklists/checklist[" + str(checklist) + "]/" + page + "item[" + str(item) + "]/value")
|
|
|
|
|
item_name = self.expand_adverbations(item_name)
|
|
|
|
|
item_name = item_name.replace('/', ' ') # maybe make the replace '/' -> ' and ' to be spoken out better
|
|
|
|
|
self.speak(item_name)
|
|
|
|
|
|
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
|
if response == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
# check if F/O has to confirm as well
|
|
|
|
|
item_value_check = re.sub("\(BOTH\)", "", item_value, flags=re.I) # Add more indication of this case, that are used in other A/C
|
|
|
|
|
fo_conf = 0
|
|
|
|
|
if item_value_check != item_value:
|
|
|
|
|
fo_conf = 1
|
|
|
|
|
item_value = item_value_check
|
|
|
|
|
|
|
|
|
|
item_value = self.expand_adverbations(item_value)
|
|
|
|
|
item_value = re.sub('/', '|', item_value)
|
|
|
|
|
item_value = re.sub('_', '', item_value)
|
|
|
|
|
item_value = re.sub('\(', ' ', item_value)
|
|
|
|
|
item_value = re.sub('\)', ' ', item_value)
|
|
|
|
|
response = self.expand_adverbations(response)
|
|
|
|
|
match = re.search(item_value, response, re.I)
|
|
|
|
|
|
|
|
|
|
if match == None:
|
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
if fo_conf == 1:
|
|
|
|
|
self.speak(item_value)
|
|
|
|
|
|
|
|
|
|
self.speak(checklist_title + " checklist completed")
|
|
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('FlightControlCheckIntent').require('flight.control.check'))
|
|
|
|
|
def handle_securing_check_intent(self, message):
|
|
|
|
|
self.speak("Full up")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full down")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full left")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full right")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Full left")
|
|
|
|
|
sleep(4)
|
|
|
|
|
self.speak("Full right")
|
|
|
|
|
sleep(4)
|
|
|
|
|
self.speak("Neutral")
|
|
|
|
|
sleep(2)
|
|
|
|
|
self.speak("Flight controls checked")
|
|
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
|
# #
|
|
|
|
@ -1084,7 +566,7 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
|
|
|
|
|
|
return tn
|
|
|
|
|
|
|
|
|
|
# running an nasal command
|
|
|
|
|
# running a nasal command
|
|
|
|
|
def nasal_exec(self, tn, call):
|
|
|
|
|
tn.write("nasal\r\n")
|
|
|
|
|
tn.write(call + "\r\n")
|
|
|
|
@ -1108,9 +590,23 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
|
ret = ret + 1
|
|
|
|
|
|
|
|
|
|
ret = ret - 1
|
|
|
|
|
tn.write("cd /\r\n")
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
# checks if a property exists at a given path
|
|
|
|
|
def prop_exist(self, tn, prop, path):
|
|
|
|
|
tn.write("ls " + path + "\r\n")
|
|
|
|
|
found = 0
|
|
|
|
|
result = " "
|
|
|
|
|
|
|
|
|
|
while result != "":
|
|
|
|
|
result = tn.read_until("\n", 1)
|
|
|
|
|
match = re.search(prop, result, re.I)
|
|
|
|
|
if match != None:
|
|
|
|
|
found = 1
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
return found
|
|
|
|
|
|
|
|
|
|
# get ip address
|
|
|
|
|
def get_ip(self):
|
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
|
@ -1266,6 +762,46 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
|
self.settings['profiles'] = profiles
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
# expands adverbations to full words
|
|
|
|
|
def expand_adverbations(self, text):
|
|
|
|
|
# TODO reduce collisions when used with other a/c
|
|
|
|
|
# TODO add more adverbations
|
|
|
|
|
text = re.sub("\sALT\s?", "altitude", text, flags=re.I)
|
|
|
|
|
text = re.sub("L/G", "landing gear", text, flags=re.I)
|
|
|
|
|
text = re.sub("SPLRS", "spoilers", text, flags=re.I)
|
|
|
|
|
text = re.sub("PREP", "preperation", text, flags=re.I)
|
|
|
|
|
text = re.sub("^TO ", "take off ", text)
|
|
|
|
|
text = re.sub(" TO$", " take off", text) # have it twice to prevent collisions with words containing 'to'
|
|
|
|
|
text = re.sub("REF", "reference", text, flags=re.I)
|
|
|
|
|
text = re.sub("A/SKID", "anti skid", text, flags=re.I)
|
|
|
|
|
text = re.sub("N/W", "nose weel", text, flags=re.I)
|
|
|
|
|
text = re.sub("A/THR", "auto thrust", text, flags=re.I)
|
|
|
|
|
text = re.sub(" THR ", "thrust", text, flags=re.I)
|
|
|
|
|
text = re.sub("Eng ", "engine", text, flags=re.I)
|
|
|
|
|
text = re.sub("Mstr", "master", text, flags=re.I)
|
|
|
|
|
text = re.sub("PB", "push button", text, flags=re.I)
|
|
|
|
|
text = re.sub("man", "manual", text, flags=re.I)
|
|
|
|
|
text = re.sub("FLT", "flight", text, flags=re.I)
|
|
|
|
|
text = re.sub("INST", "instruments", text, flags=re.I)
|
|
|
|
|
text = re.sub("TEMP", "temperature", text, flags=re.I)
|
|
|
|
|
text = re.sub(" LT", "light", text, flags=re.I)
|
|
|
|
|
text = re.sub("SEL", "selector", text, flags=re.I)
|
|
|
|
|
text = re.sub("LDG", "landing", text, flags=re.I)
|
|
|
|
|
text = re.sub("MDA", "minimum decent altitude", text, flags=re.I)
|
|
|
|
|
text = re.sub("DH", "decision height", text, flags=re.I)
|
|
|
|
|
text = re.sub("EXT", "external", text, flags=re.I)
|
|
|
|
|
text = re.sub("FLX", "flex", text, flags=re.I)
|
|
|
|
|
text = re.sub("EMER", "emergency", text, flags=re.I)
|
|
|
|
|
text = re.sub("BRK", "break", text, flags=re.I)
|
|
|
|
|
text = re.sub("KG", "kilogram", text, flags=re.I)
|
|
|
|
|
text = re.sub("LB", "pounds", text, flags=re.I)
|
|
|
|
|
text = re.sub("LBS", "pounds", text, flags=re.I)
|
|
|
|
|
text = re.sub("AS RQRD", "on|set|off|normal", text, flags=re.I) # since we don't know, what is needed in the current situation
|
|
|
|
|
text = re.sub("CONF", "config", text, flags=re.I)
|
|
|
|
|
text = re.sub(" OR ", "|", text, flags=re.I)
|
|
|
|
|
text = re.sub("0", "zero", text, flags=re.I)
|
|
|
|
|
return text
|
|
|
|
|
|
|
|
|
|
# exit routine to properly close the tn con
|
|
|
|
|
def exit(self, tn):
|
|
|
|
|
tn.close
|
|
|
|
|