2018-01-31 08:46:55 +00:00
|
|
|
import sys
|
2018-03-01 15:13:08 +00:00
|
|
|
import socket
|
2018-01-31 08:46:55 +00:00
|
|
|
import re
|
|
|
|
import json
|
2018-02-02 00:05:44 +00:00
|
|
|
from time import sleep
|
2018-02-01 21:07:26 +00:00
|
|
|
from telnetlib import Telnet
|
2018-01-31 08:46:55 +00:00
|
|
|
|
|
|
|
from adapt.intent import IntentBuilder
|
2018-03-02 09:44:50 +00:00
|
|
|
from mycroft.audio import wait_while_speaking
|
2018-01-31 08:46:55 +00:00
|
|
|
from mycroft import MycroftSkill, intent_handler
|
|
|
|
from mycroft.skills.core import MycroftSkill
|
|
|
|
from mycroft.util.log import getLogger
|
2018-02-27 15:37:42 +00:00
|
|
|
from mycroft.util import normalize
|
2018-01-31 08:46:55 +00:00
|
|
|
|
|
|
|
LOGGER = getLogger(__name__)
|
|
|
|
|
|
|
|
class FlightGearCopilotSkill(MycroftSkill):
|
|
|
|
def __init__(self):
|
|
|
|
super(FlightGearCopilotSkill, self).__init__()
|
2018-03-05 14:45:39 +00:00
|
|
|
# Already existing options are here read only -> will not be overwritten
|
2018-02-01 16:47:57 +00:00
|
|
|
self.settings['host'] = "localhost"
|
|
|
|
self.settings['port'] = 8081
|
2018-03-05 14:45:39 +00:00
|
|
|
self.write_default_profiles()
|
2018-01-31 08:46:55 +00:00
|
|
|
|
2018-02-28 10:34:19 +00:00
|
|
|
# TODO make it possible, to play a .mp3 file instead of tts
|
|
|
|
|
2018-02-02 15:45:52 +00:00
|
|
|
#################################################################
|
|
|
|
# #
|
|
|
|
# Actions #
|
|
|
|
# #
|
|
|
|
#################################################################
|
|
|
|
|
2018-01-31 16:36:49 +00:00
|
|
|
#########################
|
|
|
|
# #
|
|
|
|
# Flaps #
|
|
|
|
# #
|
|
|
|
#########################
|
|
|
|
|
2018-01-31 08:46:55 +00:00
|
|
|
@intent_handler(IntentBuilder('FlapsIntent').require('flaps'))
|
|
|
|
def handle_flaps_intent(self, message):
|
2018-02-27 15:37:42 +00:00
|
|
|
flaps_request = normalize(message.data['utterance'])
|
2018-01-31 08:46:55 +00:00
|
|
|
if flaps_request == "flaps":
|
|
|
|
self.speak_dialog("no.setting")
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
# extracting the flaps setting from the utterance
|
|
|
|
match = re.match(r'.*flaps.* (up|full|down|\d{1,2}).*', flaps_request, re.I)
|
2018-01-31 16:36:49 +00:00
|
|
|
if match == None:
|
|
|
|
self.speak_dialog("no.valid.flaps")
|
|
|
|
sys.exit(0)
|
2018-01-31 08:46:55 +00:00
|
|
|
flaps_request = match.group(1)
|
|
|
|
|
2018-02-02 00:05:44 +00:00
|
|
|
tn = self.connect()
|
2018-01-31 08:46:55 +00:00
|
|
|
|
2018-02-01 21:07:26 +00:00
|
|
|
# get acid
|
2018-02-21 18:46:17 +00:00
|
|
|
acid = self.get_prop(tn, "/sim/aircraft")
|
2018-01-31 08:46:55 +00:00
|
|
|
|
2018-02-01 12:26:10 +00:00
|
|
|
# read acid to know which profile to use
|
2018-02-02 00:05:44 +00:00
|
|
|
profile = None
|
2018-01-31 08:46:55 +00:00
|
|
|
for i_profiles in self.settings['profiles']:
|
2018-01-31 16:36:49 +00:00
|
|
|
for i_acid in i_profiles['acid']:
|
2018-02-21 18:46:17 +00:00
|
|
|
if i_acid == acid:
|
2018-01-31 16:36:49 +00:00
|
|
|
profile = i_profiles
|
2018-01-31 08:46:55 +00:00
|
|
|
break
|
2018-01-31 16:36:49 +00:00
|
|
|
if profile != None:
|
2018-01-31 08:46:55 +00:00
|
|
|
break
|
|
|
|
|
2018-02-02 00:05:44 +00:00
|
|
|
# check if the profile was found
|
2018-01-31 16:36:49 +00:00
|
|
|
if profile == None:
|
2018-03-06 10:54:53 +00:00
|
|
|
self.speak_dialog("no.profile")
|
2018-02-02 00:05:44 +00:00
|
|
|
self.exit(tn)
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-02 00:05:44 +00:00
|
|
|
# get kias
|
2018-02-21 18:46:17 +00:00
|
|
|
kias = int(float(self.get_prop(tn, "/velocities/airspeed-kt")))
|
2018-02-01 21:07:26 +00:00
|
|
|
|
2018-02-22 10:06:34 +00:00
|
|
|
# find the flaps settings for the flaps id
|
2018-02-02 00:05:44 +00:00
|
|
|
o_flaps = None
|
2018-01-31 16:36:49 +00:00
|
|
|
for i_flaps in profile['flaps']:
|
|
|
|
if str(i_flaps['id']) == str(flaps_request):
|
|
|
|
o_flaps = i_flaps
|
|
|
|
break
|
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
# check if flaps setting is known
|
2018-01-31 16:36:49 +00:00
|
|
|
if o_flaps == None:
|
|
|
|
self.speak_dialog("flaps.setting.unknown")
|
2018-02-02 00:05:44 +00:00
|
|
|
self.exit(tn)
|
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
flaps = int(self.get_prop(tn, str(profile['flaps-path'])))
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-01-31 08:46:55 +00:00
|
|
|
# check if extend or retract flaps
|
2018-01-31 16:36:49 +00:00
|
|
|
if str(flaps_request) == "down" or str(flaps_request) == "full":
|
2018-02-22 10:06:34 +00:00
|
|
|
if flaps == o_flaps['value']:
|
|
|
|
self.speak_dialog("keep.flaps")
|
|
|
|
self.exit(tn)
|
|
|
|
else:
|
|
|
|
flaps_mov = "extend"
|
|
|
|
flaps_name = flaps_request
|
|
|
|
flaps_request = o_flaps['value']
|
2018-01-31 16:36:49 +00:00
|
|
|
elif str(flaps_request) == "up":
|
2018-02-22 10:06:34 +00:00
|
|
|
if flaps == o_flaps['value']:
|
|
|
|
self.speak_dialog("keep.flaps")
|
|
|
|
self.exit(tn)
|
|
|
|
else:
|
|
|
|
flaps_mov = "retract"
|
|
|
|
flaps_name = flaps_request
|
|
|
|
flaps_request = o_flaps['value']
|
2018-01-31 08:46:55 +00:00
|
|
|
else:
|
2018-02-22 10:06:34 +00:00
|
|
|
flaps_name = str(flaps_request)
|
2018-02-02 00:05:44 +00:00
|
|
|
if int(flaps_request) > flaps:
|
2018-01-31 08:46:55 +00:00
|
|
|
flaps_mov = "extend"
|
2018-02-02 00:05:44 +00:00
|
|
|
elif int(flaps_request) < flaps:
|
2018-01-31 08:46:55 +00:00
|
|
|
flaps_mov = "retract"
|
|
|
|
else:
|
|
|
|
self.speak_dialog("keep.flaps")
|
2018-02-02 00:05:44 +00:00
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
# get ground speed
|
2018-02-21 18:46:17 +00:00
|
|
|
gs = int(float(self.get_prop(tn, "/velocities/groundspeed-kt")))
|
2018-02-02 00:05:44 +00:00
|
|
|
|
|
|
|
# skip speed check is speed is <= 30
|
|
|
|
if gs > 30:
|
|
|
|
# check if speed is high/low enough for retraction/extention
|
|
|
|
if flaps_mov == "extend":
|
|
|
|
if o_flaps['max-spd'] < kias:
|
|
|
|
self.speak_dialog("spd.high")
|
|
|
|
self.exit(tn)
|
|
|
|
else:
|
|
|
|
self.speak("Speed checked.")
|
|
|
|
else:
|
|
|
|
if o_flaps['min-spd'] > kias:
|
|
|
|
self.speak_dialog("spd.low")
|
|
|
|
self.exit(tn)
|
|
|
|
else:
|
|
|
|
self.speak("Speed checked.")
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-22 20:37:17 +00:00
|
|
|
flaps_request = int(flaps_request)
|
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
if flaps_mov == "extend":
|
2018-02-22 10:06:34 +00:00
|
|
|
pos_reached = 0
|
|
|
|
while pos_reached == 0:
|
|
|
|
self.nasal_exec(tn, "controls.flapsDown(1);")
|
|
|
|
flaps = int(self.get_prop(tn, str(profile['flaps-path'])))
|
|
|
|
if flaps == flaps_request:
|
|
|
|
pos_reached = 1
|
2018-02-21 18:46:17 +00:00
|
|
|
else:
|
2018-02-22 10:06:34 +00:00
|
|
|
pos_reached = 0
|
|
|
|
while pos_reached == 0:
|
|
|
|
self.nasal_exec(tn, "controls.flapsDown(-1);")
|
|
|
|
flaps = int(self.get_prop(tn, str(profile['flaps-path'])))
|
|
|
|
if flaps == flaps_request:
|
|
|
|
pos_reached = 1
|
|
|
|
|
|
|
|
self.speak("Flaps " + flaps_name)
|
2018-02-02 00:05:44 +00:00
|
|
|
tn.close
|
2018-01-31 08:46:55 +00:00
|
|
|
|
2018-01-31 16:36:49 +00:00
|
|
|
|
|
|
|
#########################
|
|
|
|
# #
|
|
|
|
# Gear #
|
|
|
|
# #
|
|
|
|
#########################
|
|
|
|
|
2018-02-01 12:26:10 +00:00
|
|
|
@intent_handler(IntentBuilder('GearUpIntent').require('gearup'))
|
|
|
|
def handle_gear_up_intent(self, message):
|
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
tn = self.connect()
|
|
|
|
|
|
|
|
# get acid
|
2018-02-22 09:44:33 +00:00
|
|
|
acid = self.get_prop(tn, "/sim/aircraft")
|
2018-02-01 12:26:10 +00:00
|
|
|
|
|
|
|
# read acid to know which profile to use
|
2018-02-22 09:44:33 +00:00
|
|
|
profile = None
|
2018-02-01 12:26:10 +00:00
|
|
|
for i_profiles in self.settings['profiles']:
|
|
|
|
for i_acid in i_profiles['acid']:
|
|
|
|
if i_acid == acid:
|
|
|
|
profile = i_profiles
|
|
|
|
break
|
|
|
|
if profile != None:
|
|
|
|
break
|
|
|
|
|
|
|
|
if profile == None:
|
2018-03-06 10:54:53 +00:00
|
|
|
self.speak_dialog("no.profile")
|
2018-02-02 00:05:44 +00:00
|
|
|
self.exit(tn)
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
if profile['gear-retractable'] == "true":
|
2018-02-01 12:26:10 +00:00
|
|
|
self.speak("Gear up")
|
2018-02-21 18:46:17 +00:00
|
|
|
self.nasal_exec(tn, "controls.gearDown(-1)")
|
2018-02-01 12:26:10 +00:00
|
|
|
else:
|
|
|
|
self.speak_dialog("gear.not.retractable")
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('GearDownIntent').require('geardown'))
|
|
|
|
def handle_gear_down_intent(self, message):
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
tn = self.connect()
|
|
|
|
|
|
|
|
# get acid
|
2018-02-22 09:44:33 +00:00
|
|
|
acid = self.get_prop(tn, "/sim/aircraft")
|
2018-02-01 12:26:10 +00:00
|
|
|
|
|
|
|
# read acid to know which profile to use
|
2018-02-22 09:44:33 +00:00
|
|
|
profile = None
|
2018-02-01 12:26:10 +00:00
|
|
|
for i_profiles in self.settings['profiles']:
|
|
|
|
for i_acid in i_profiles['acid']:
|
|
|
|
if i_acid == acid:
|
|
|
|
profile = i_profiles
|
|
|
|
break
|
|
|
|
if profile != None:
|
|
|
|
break
|
|
|
|
|
|
|
|
if profile == None:
|
2018-03-06 10:54:53 +00:00
|
|
|
self.speak_dialog("no.profile")
|
2018-02-02 00:05:44 +00:00
|
|
|
self.exit(tn)
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-21 18:46:17 +00:00
|
|
|
if profile['gear-retractable'] == "true":
|
2018-02-01 12:26:10 +00:00
|
|
|
self.speak("Gear down")
|
2018-02-21 18:46:17 +00:00
|
|
|
self.nasal_exec(tn, "controls.gearDown(1)")
|
2018-02-01 12:26:10 +00:00
|
|
|
else:
|
|
|
|
self.speak_dialog("gear.not.retractable")
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-02-01 16:47:57 +00:00
|
|
|
#################################################################
|
|
|
|
# #
|
|
|
|
# Checklists #
|
|
|
|
# #
|
|
|
|
#################################################################
|
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
@intent_handler(IntentBuilder('CheckListIntent').require('check.list'))
|
|
|
|
def handle_check_list_intent(self, message):
|
2018-02-02 15:45:52 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
tn = self.connect()
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
cl_request = message.data['utterance']
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
checklist_count = self.get_item_count(tn, "/sim/checklists")
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
if checklist_count == 0:
|
|
|
|
self.speak("No checklists has been found")
|
|
|
|
self.exit(tn)
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-03-07 00:07:37 +00:00
|
|
|
for i in range(0, checklist_count):
|
2018-02-23 23:31:51 +00:00
|
|
|
checklist = i
|
|
|
|
checklist_title = self.get_prop(tn, "/sim/checklists/checklist[" + str(checklist) + "]/title")
|
2018-02-27 22:02:22 +00:00
|
|
|
checklist_title = checklist_title.replace('/', '|')
|
2018-03-07 08:44:12 +00:00
|
|
|
checklist_title = "^" + checklist_title
|
|
|
|
match = re.search(checklist_title, cl_request, re.I)
|
2018-03-10 12:04:40 +00:00
|
|
|
checklist_title = checklist_title[1:]
|
|
|
|
checklist_title = checklist_title.replace('|', ', ')
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
if match != None:
|
2018-03-07 00:07:37 +00:00
|
|
|
self.speak(checklist_title + " checklist")
|
2018-02-23 23:31:51 +00:00
|
|
|
break
|
2018-02-21 18:46:17 +00:00
|
|
|
|
|
|
|
if match == None:
|
2018-02-23 23:31:51 +00:00
|
|
|
self.speak("Required checklist wasn't found")
|
|
|
|
self.exit(tn)
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
# 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/"
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
item_count = self.get_item_count(tn, "/sim/checklists/checklist[" + str(checklist) + "]/" + page)
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
if item_count == 0:
|
|
|
|
self.speak("The required checklist has no entrys")
|
|
|
|
self.exit(tn)
|
2018-02-21 18:46:17 +00:00
|
|
|
|
2018-03-07 00:07:37 +00:00
|
|
|
for i in range(0, item_count):
|
2018-02-23 23:31:51 +00:00
|
|
|
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")
|
2018-02-28 10:34:19 +00:00
|
|
|
item_name = self.expand_adverbations(item_name)
|
|
|
|
item_name = item_name.replace('/', ' ') # maybe make the replace '/' -> ' and ' to be spoken out better
|
2018-02-23 23:31:51 +00:00
|
|
|
self.speak(item_name)
|
|
|
|
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response == None:
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
sys.exit(0)
|
2018-02-28 10:34:19 +00:00
|
|
|
|
|
|
|
# check if F/O has to confirm as well
|
2018-03-07 00:07:37 +00:00
|
|
|
item_value_check = re.sub("\(BOTH\)", "", item_value, flags=re.I) # Add more indication of this case, that are used in other A/C
|
2018-02-28 10:34:19 +00:00
|
|
|
fo_conf = 0
|
|
|
|
if item_value_check != item_value:
|
|
|
|
fo_conf = 1
|
|
|
|
item_value = item_value_check
|
|
|
|
|
|
|
|
item_value = self.expand_adverbations(item_value)
|
2018-03-07 00:07:37 +00:00
|
|
|
item_value = re.sub('/', '|', item_value)
|
|
|
|
item_value = re.sub('_', '', item_value)
|
2018-03-15 13:13:17 +00:00
|
|
|
item_value = re.sub('\(.*\)', ' ', item_value)
|
2018-03-07 00:07:37 +00:00
|
|
|
response = self.expand_adverbations(response)
|
2018-02-23 23:31:51 +00:00
|
|
|
match = re.search(item_value, response, re.I)
|
2018-02-28 10:34:19 +00:00
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
if match == None:
|
|
|
|
self.speak("Checklist not completed")
|
|
|
|
sys.exit(0)
|
2018-02-02 15:45:52 +00:00
|
|
|
|
2018-02-28 21:50:24 +00:00
|
|
|
if fo_conf == 1:
|
2018-02-28 10:34:19 +00:00
|
|
|
self.speak(item_value)
|
|
|
|
|
2018-03-07 00:07:37 +00:00
|
|
|
self.speak(checklist_title + " checklist completed")
|
|
|
|
|
2018-07-13 19:07:52 +00:00
|
|
|
@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")
|
2018-02-02 15:45:52 +00:00
|
|
|
|
2018-02-28 14:10:25 +00:00
|
|
|
#################################################################
|
|
|
|
# #
|
|
|
|
# Configuration #
|
|
|
|
# #
|
|
|
|
#################################################################
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('FlightGearPortIntent').require('conf.flightgear.port'))
|
|
|
|
def handle_flight_gear_port_intent(self, message):
|
|
|
|
port = normalize(message.data['utterance'])
|
2018-02-28 22:04:41 +00:00
|
|
|
port = re.sub('\D', '', port)
|
2018-02-28 14:10:25 +00:00
|
|
|
|
2018-03-01 16:44:53 +00:00
|
|
|
if int(port) < 0 or int(port) > 65535:
|
|
|
|
self.speak("Port '" + str(port) + "' out of range")
|
2018-02-28 14:10:25 +00:00
|
|
|
sys.exit(0)
|
|
|
|
|
2018-03-01 15:13:08 +00:00
|
|
|
self.settings['port'] = int(port)
|
2018-02-28 14:10:25 +00:00
|
|
|
|
|
|
|
self.speak("I will use now port " + str(port) + " to connect to flightgear")
|
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('AddToProfileIntent').require('conf.add.to.profile'))
|
|
|
|
def handle_add_to_profile_intent(self, message):
|
|
|
|
tn = self.connect()
|
2018-03-02 16:09:06 +00:00
|
|
|
|
2018-03-02 15:51:03 +00:00
|
|
|
# re to get the profile name
|
2018-03-06 22:25:46 +00:00
|
|
|
match = re.search("profile .*$", message.data['utterance'], re.I)
|
2018-03-02 15:51:03 +00:00
|
|
|
if match == None:
|
|
|
|
self.speak("I didn't understand a profile name")
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
# remove 'profile '
|
2018-03-06 22:25:46 +00:00
|
|
|
profile = re.sub("profile ", '', match.group(0))
|
2018-03-02 15:51:03 +00:00
|
|
|
|
|
|
|
profile_id = 0
|
|
|
|
|
|
|
|
# check if profile exists
|
|
|
|
for i_profile in self.settings['profiles']:
|
|
|
|
match = re.search(i_profile['name'], profile, re.I)
|
|
|
|
if match != None:
|
|
|
|
break
|
|
|
|
|
|
|
|
profile_id = profile_id + 1
|
|
|
|
|
2018-03-06 22:25:46 +00:00
|
|
|
# get acid
|
2018-07-13 19:07:52 +00:00
|
|
|
acid = self.get_prop(tn, "/sim/aircraft")
|
2018-03-06 22:25:46 +00:00
|
|
|
|
2018-03-02 15:51:03 +00:00
|
|
|
# check if acid exists in the profile
|
|
|
|
for i_acid in i_profile['acid']:
|
|
|
|
if i_acid == acid:
|
|
|
|
self.speak("The Aircraft ID does already exsists in this profile")
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
# add acid to profile
|
|
|
|
self.settings['profiles'][profile_id]['acid'].append(acid)
|
|
|
|
self.speak("Added the aircraft to the profile")
|
2018-02-28 14:10:25 +00:00
|
|
|
|
|
|
|
@intent_handler(IntentBuilder('CreateProfileIntent').require('conf.create.profile'))
|
|
|
|
def handle_create_profile_intent(self, message):
|
|
|
|
tn = self.connect()
|
2018-03-06 10:54:53 +00:00
|
|
|
profile = {}
|
2018-02-28 14:10:25 +00:00
|
|
|
|
2018-03-02 16:09:06 +00:00
|
|
|
# re to get the profile name
|
2018-03-06 22:25:46 +00:00
|
|
|
match = re.search("profile .*$", message.data['utterance'], re.I)
|
2018-03-02 16:09:06 +00:00
|
|
|
if match == None:
|
|
|
|
self.speak("I didn't understand a profile name")
|
|
|
|
self.exit(tn)
|
|
|
|
|
|
|
|
# remove 'profile '
|
2018-03-06 22:25:46 +00:00
|
|
|
profile['name'] = re.sub("profile ", "", match.group(0))
|
2018-03-06 10:54:53 +00:00
|
|
|
|
2018-03-01 15:13:08 +00:00
|
|
|
# get acid
|
2018-03-06 10:54:53 +00:00
|
|
|
profile['acid'] = []
|
|
|
|
profile['acid'].append(self.get_prop(tn, "/sim/aircraft"))
|
2018-03-02 16:09:06 +00:00
|
|
|
|
|
|
|
# ask user if the gear is retractable
|
|
|
|
self.speak("Has this aircraft a retractable gear?")
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
2018-03-06 10:54:53 +00:00
|
|
|
match = re.search("yes|affirm|ok", response, re.I)
|
2018-03-02 16:09:06 +00:00
|
|
|
if match != None:
|
2018-03-06 10:54:53 +00:00
|
|
|
profile['gear_retractable'] = "true"
|
|
|
|
else:
|
|
|
|
profile['gear_retractable'] = "false"
|
2018-03-02 16:09:06 +00:00
|
|
|
|
2018-02-28 14:10:25 +00:00
|
|
|
# TODO find flaps path
|
2018-03-06 22:25:46 +00:00
|
|
|
profile['flaps-path'] = "/controls/flight/flap-lever"
|
2018-03-02 16:09:06 +00:00
|
|
|
|
2018-03-06 10:54:53 +00:00
|
|
|
profile['flaps'] = []
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps = {}
|
|
|
|
flaps['value'] = "Never occuring value"
|
|
|
|
|
|
|
|
# make sure the flaps are fully up
|
|
|
|
for i in range(0, 10):
|
|
|
|
self.nasal_exec(tn, "controls.flapsDown(-1);")
|
2018-03-06 10:54:53 +00:00
|
|
|
|
|
|
|
# scan a maximum of 10 flaps positions... should be enough for every plane
|
|
|
|
for i in range(0,10):
|
|
|
|
# if the flaps pos is the same as with the previous step, then break
|
|
|
|
if self.get_prop(tn, profile['flaps-path']) == flaps['value']:
|
|
|
|
break
|
|
|
|
flaps = {}
|
|
|
|
# ask the user how to name the flaps positions
|
|
|
|
self.speak("How to name the current flaps position?")
|
|
|
|
while True:
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
|
|
|
|
# extracting the flaps setting from the response
|
2018-03-06 22:25:46 +00:00
|
|
|
match = re.match(r'.*(up|full|down|\d{1,2}).*', response, re.I)
|
2018-03-06 10:54:53 +00:00
|
|
|
if match != None:
|
|
|
|
flaps['id'] = match.group(1)
|
|
|
|
break
|
|
|
|
self.speak_dialog("no.valid.flaps")
|
|
|
|
self.speak("Please repeat")
|
|
|
|
|
|
|
|
flaps['value'] = self.get_prop(tn, profile['flaps-path'])
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['min-spd'] = 0
|
|
|
|
flaps['max-spd'] = 999
|
2018-03-06 10:54:53 +00:00
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
self.nasal_exec(tn, "controls.flapsDown(1);")
|
|
|
|
|
|
|
|
# ask if the user wants to add speeds for the flaps settings
|
|
|
|
self.speak("Do you want to add speeds for the flaps settings?")
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
|
|
|
match = re.search("yes|affirm|ok", response, re.I)
|
|
|
|
if match != None:
|
|
|
|
for flaps in profile['flaps']:
|
|
|
|
self.speak("What's the maximum speed with flaps " + str(flaps['id']) + "?")
|
|
|
|
while True:
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
|
|
|
match = re.search("\d{1,4}", response)
|
|
|
|
if match != None:
|
|
|
|
flaps['max-spd'] = match.group(0)
|
|
|
|
break
|
|
|
|
self.speak("I didn't understand a valid speed, please repeat")
|
|
|
|
|
|
|
|
self.speak("What's the minimum speed with flaps " + str(flaps['id']) + "?")
|
|
|
|
while True:
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
|
|
|
match = re.search("\d{1,4}", response)
|
|
|
|
if match != None:
|
|
|
|
flaps['min-spd'] = match.group(0)
|
|
|
|
break
|
|
|
|
self.speak("I didn't understand a valid speed, please repeat")
|
2018-02-02 15:45:52 +00:00
|
|
|
|
2018-03-06 22:25:46 +00:00
|
|
|
self.settings['profiles'].append(profile)
|
|
|
|
self.speak("Successfully added profile " + profile['name'])
|
|
|
|
|
2018-03-01 15:13:08 +00:00
|
|
|
@intent_handler(IntentBuilder('FindFlightGearIntent').require('conf.find.fg'))
|
|
|
|
def handle_find_flight_gear_intent(self, message):
|
|
|
|
self.speak("Ok, I'm looking for a running flightgear on port " + str(self.settings['port']) + ". This can take a while.")
|
|
|
|
|
|
|
|
# check localhost first
|
|
|
|
ip = "127.0.0.1"
|
|
|
|
try:
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
result = sock.connect_ex((ip, self.settings['port']))
|
|
|
|
if result == 0:
|
|
|
|
self.speak("Found an instance on my self, do you want to use this computer?")
|
2018-03-02 09:44:50 +00:00
|
|
|
wait_while_speaking()
|
2018-03-01 15:13:08 +00:00
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
2018-03-05 14:45:39 +00:00
|
|
|
match = re.search("yes|affirm|ok", response, re.I)
|
2018-03-01 15:13:08 +00:00
|
|
|
if match != None:
|
|
|
|
self.settings['host'] = "localhost"
|
2018-03-02 09:44:50 +00:00
|
|
|
self.speak("New host " + self.settings['host'] + " is set")
|
2018-03-01 15:13:08 +00:00
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
self.speak("Ok, I continue to search")
|
|
|
|
sock.close()
|
|
|
|
|
|
|
|
except socket.error:
|
|
|
|
pass
|
|
|
|
|
2018-03-01 16:30:16 +00:00
|
|
|
# get network
|
|
|
|
net = self.get_ip()
|
|
|
|
net = re.sub("\d[1-3]$", '', net)
|
|
|
|
|
|
|
|
# scan network
|
2018-07-13 19:07:52 +00:00
|
|
|
for host_part in range(1, 254):
|
2018-03-01 16:30:16 +00:00
|
|
|
ip = net + str(host_part)
|
|
|
|
try:
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
result = sock.connect_ex((ip, self.settings['port']))
|
|
|
|
if result == 0:
|
|
|
|
# if a connection is found, ask user if it's the correct one
|
|
|
|
try:
|
|
|
|
(host, dummy, dummy) = socket.gethostbyaddr(ip)
|
|
|
|
host = socket.getfqdn(host)
|
|
|
|
except socket.gaierror:
|
|
|
|
pass
|
|
|
|
self.speak("Found an instance on " + host + ", do you want to use this computer?")
|
2018-03-02 09:44:50 +00:00
|
|
|
wait_while_speaking()
|
2018-03-01 16:30:16 +00:00
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
2018-03-05 14:45:39 +00:00
|
|
|
match = re.search("yes|affirm|ok", response, re.I)
|
2018-03-01 16:30:16 +00:00
|
|
|
if match != None:
|
|
|
|
self.settings['host'] = host
|
2018-03-02 09:44:50 +00:00
|
|
|
self.speak("New host " + self.settings['host'] + " is set")
|
2018-03-01 16:30:16 +00:00
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
self.speak("Ok, I continue to search")
|
|
|
|
sock.close()
|
|
|
|
|
|
|
|
except socket.error:
|
|
|
|
pass
|
2018-03-01 15:13:08 +00:00
|
|
|
|
|
|
|
self.speak("I haven't found any running flightgear on port " + str(self.settings['port']))
|
|
|
|
|
2018-03-05 14:45:39 +00:00
|
|
|
# load the default profile config
|
|
|
|
@intent_handler(IntentBuilder('Load DefaultProfilesIntent').require('load.default.profile'))
|
|
|
|
def handle_load_default_profile_intent(self, message):
|
|
|
|
self.speak("This will remove all profiles what you have added. Do you want to continue?")
|
|
|
|
wait_while_speaking()
|
|
|
|
response = self.get_response("dummy")
|
|
|
|
if response != None:
|
|
|
|
match = re.search("yes|affirm|ok", response, re.I)
|
|
|
|
if match != None:
|
|
|
|
self.write_default_profiles()
|
|
|
|
self.speak("Profiles reseted")
|
|
|
|
|
2018-02-02 15:45:52 +00:00
|
|
|
#################################################################
|
|
|
|
# #
|
|
|
|
# Help functions #
|
|
|
|
# #
|
|
|
|
#################################################################
|
|
|
|
|
2018-02-02 00:05:44 +00:00
|
|
|
# connect to fg
|
|
|
|
def connect(self):
|
|
|
|
try:
|
|
|
|
tn = Telnet(self.settings['host'], self.settings['port'])
|
|
|
|
except:
|
|
|
|
self.speak_dialog("no.telnet.con")
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
# switch to data mode
|
|
|
|
tn.write("data\r\n")
|
|
|
|
|
|
|
|
return tn
|
|
|
|
|
2018-02-27 22:02:22 +00:00
|
|
|
# running a nasal command
|
2018-02-21 18:46:17 +00:00
|
|
|
def nasal_exec(self, tn, call):
|
|
|
|
tn.write("nasal\r\n")
|
|
|
|
tn.write(call + "\r\n")
|
|
|
|
tn.write("##EOF##\r\n")
|
|
|
|
|
|
|
|
# get a prop from the property tree
|
|
|
|
def get_prop(self, tn, prop):
|
|
|
|
tn.write("get " + prop + "\r\n")
|
|
|
|
ret = tn.read_until("\r")
|
|
|
|
tn.read_until("\n")
|
|
|
|
return ret[:-1]
|
|
|
|
|
2018-02-22 20:37:17 +00:00
|
|
|
# count number of items in a prop tree dir
|
|
|
|
def get_item_count(self, tn, directory):
|
|
|
|
tn.write("ls " + directory + "\r\n")
|
|
|
|
ret = 0
|
|
|
|
result = " "
|
|
|
|
|
|
|
|
while result != "":
|
|
|
|
result = tn.read_until("\n", 1)
|
|
|
|
ret = ret + 1
|
|
|
|
|
|
|
|
ret = ret - 1
|
|
|
|
return ret
|
|
|
|
|
2018-02-23 23:31:51 +00:00
|
|
|
# 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
|
|
|
|
|
2018-03-01 16:30:16 +00:00
|
|
|
# get ip address
|
|
|
|
def get_ip(self):
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
|
try:
|
|
|
|
# doesn't even have to be reachable
|
|
|
|
s.connect(('10.255.255.255', 1))
|
|
|
|
IP = s.getsockname()[0]
|
|
|
|
except:
|
|
|
|
IP = '127.0.0.1'
|
|
|
|
finally:
|
|
|
|
s.close()
|
|
|
|
return IP
|
|
|
|
|
2018-03-05 14:45:39 +00:00
|
|
|
# write the defaults to the settings.json file
|
|
|
|
def write_default_profiles(self):
|
|
|
|
|
|
|
|
# DEFINITION of the settings['profiles'] structure
|
|
|
|
# [
|
|
|
|
# {
|
|
|
|
# "name": "<profile-name>",
|
|
|
|
# "acid":
|
|
|
|
# [
|
|
|
|
# "<Aircraft-id> can be found in /???",
|
|
|
|
# ...
|
|
|
|
# ],
|
|
|
|
# flaps:
|
|
|
|
# [
|
|
|
|
# {
|
|
|
|
# "id": "<flaps-name> can be up|down|full|number",
|
|
|
|
# "min-spd": "<minimum speed for save retraction>",
|
|
|
|
# "max-spd": "<maximum speed for save extention>",
|
|
|
|
# "value": "<value in the prop tree>"
|
|
|
|
# },
|
|
|
|
# ...
|
|
|
|
# ]
|
|
|
|
# "flaps-path": "<path to current flaps-position>"
|
|
|
|
# "gear-retractable": "<true|false>"
|
|
|
|
# },
|
|
|
|
# ...
|
|
|
|
# ]
|
|
|
|
profiles = []
|
|
|
|
|
|
|
|
#################
|
|
|
|
# Airbus A320 #
|
|
|
|
#################
|
|
|
|
profile = {}
|
|
|
|
profile['name'] = "Airbus A320"
|
|
|
|
profile['gear-retractable'] = "true"
|
|
|
|
profile['flaps-path'] = "/controls/flight/flap-lever"
|
|
|
|
|
|
|
|
# ACIDs
|
|
|
|
profile['acid'] = []
|
|
|
|
profile['acid'].append("A320-200-CFM")
|
|
|
|
profile['acid'].append("A320-200-IAE")
|
|
|
|
profile['acid'].append("A320-100-CFM")
|
|
|
|
profile['acid'].append("A320neo-CFM")
|
|
|
|
profile['acid'].append("A320neo-PW")
|
|
|
|
|
|
|
|
# Flaps settings
|
|
|
|
profile['flaps'] = []
|
|
|
|
|
|
|
|
# Flaps up
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = "up"
|
|
|
|
flaps['min-spd'] = 210
|
|
|
|
flaps['max-spd'] = 350
|
|
|
|
flaps['value'] = 0
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
# Flaps 1
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = 1
|
|
|
|
flaps['min-spd'] = 180
|
|
|
|
flaps['max-spd'] = 230
|
|
|
|
flaps['value'] = 0
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
# Flaps 2
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = 2
|
|
|
|
flaps['min-spd'] = 165
|
|
|
|
flaps['max-spd'] = 200
|
|
|
|
flaps['value'] = 0
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
# Flaps 3
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = 3
|
|
|
|
flaps['min-spd'] = 150
|
|
|
|
flaps['max-spd'] = 185
|
|
|
|
flaps['value'] = 0
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
# Flaps full
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = "full"
|
|
|
|
flaps['min-spd'] = 140
|
|
|
|
flaps['max-spd'] = 177
|
|
|
|
flaps['value'] = 0
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
profiles.append(profile)
|
|
|
|
|
|
|
|
#################
|
|
|
|
# c172p #
|
|
|
|
#################
|
|
|
|
profile = {}
|
|
|
|
profile['name'] = "c172p"
|
|
|
|
profile['gear-retractable'] = "false"
|
2018-03-06 22:25:46 +00:00
|
|
|
profile['flaps-path'] = "/controls/flight/flaps"
|
2018-03-05 14:45:39 +00:00
|
|
|
|
|
|
|
# ACIDs
|
|
|
|
profile['acid'] = []
|
|
|
|
profile['acid'].append("c172p")
|
|
|
|
|
|
|
|
# Flaps settings
|
|
|
|
profile['flaps'] = []
|
|
|
|
|
|
|
|
# Flaps up
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = "up"
|
|
|
|
flaps['min-spd'] = 54
|
|
|
|
flaps['max-spd'] = 300
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['value'] = 0
|
2018-03-05 14:45:39 +00:00
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
2018-03-06 22:25:46 +00:00
|
|
|
# Flaps 10
|
2018-03-05 14:45:39 +00:00
|
|
|
flaps = {}
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['id'] = 10
|
2018-03-05 14:45:39 +00:00
|
|
|
flaps['min-spd'] = 48
|
|
|
|
flaps['max-spd'] = 110
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['value'] = 0.3333334
|
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
# Flaps 20
|
|
|
|
flaps = {}
|
|
|
|
flaps['id'] = "20"
|
|
|
|
flaps['min-spd'] = 43
|
|
|
|
flaps['max-spd'] = 85
|
|
|
|
flaps['value'] = 0.6666668
|
2018-03-05 14:45:39 +00:00
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
2018-03-06 22:25:46 +00:00
|
|
|
# Flaps full
|
2018-03-05 14:45:39 +00:00
|
|
|
flaps = {}
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['id'] = "full"
|
2018-03-05 14:45:39 +00:00
|
|
|
flaps['min-spd'] = 43
|
|
|
|
flaps['max-spd'] = 85
|
2018-03-06 22:25:46 +00:00
|
|
|
flaps['value'] = 1
|
2018-03-05 14:45:39 +00:00
|
|
|
profile['flaps'].append(flaps)
|
|
|
|
|
|
|
|
profiles.append(profile)
|
|
|
|
|
|
|
|
self.settings['profiles'] = profiles
|
|
|
|
pass
|
|
|
|
|
2018-02-28 10:34:19 +00:00
|
|
|
# expands adverbations to full words
|
2018-02-28 21:50:24 +00:00
|
|
|
def expand_adverbations(self, text):
|
2018-02-28 10:34:19 +00:00
|
|
|
# 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)
|
2018-03-10 12:04:40 +00:00
|
|
|
text = re.sub("THR ", "thrust", text, flags=re.I)
|
|
|
|
text = re.sub("Eng ", "engine ", text, flags=re.I)
|
2018-02-28 10:34:19 +00:00
|
|
|
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)
|
2018-03-10 12:04:40 +00:00
|
|
|
text = re.sub(" LT", " light", text, flags=re.I)
|
2018-02-28 10:34:19 +00:00
|
|
|
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)
|
2018-03-10 12:04:40 +00:00
|
|
|
text = re.sub("EMER ", "emergency ", text, flags=re.I)
|
2018-02-28 10:34:19 +00:00
|
|
|
text = re.sub("BRK", "break", text, flags=re.I)
|
2018-03-07 00:07:37 +00:00
|
|
|
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
|
2018-03-09 16:39:23 +00:00
|
|
|
text = re.sub("AS REQUIRED", "on|set|off|normal", text, flags=re.I) # since we don't know, what is needed in the current situation
|
2018-03-07 00:07:37 +00:00
|
|
|
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)
|
2018-03-09 16:39:23 +00:00
|
|
|
text = re.sub("GEN ", "generator", text, flags=re.I)
|
|
|
|
text = re.sub("POS ", "position", text, flags=re.I)
|
|
|
|
text = re.sub(" IAS", "indicated air speed", text, flags=re.I)
|
|
|
|
text = re.sub("RWY", "runway", text, flags=re.I)
|
|
|
|
text = re.sub("HDG", "heading", text, flags=re.I)
|
|
|
|
text = re.sub("HDG", "heading", text, flags=re.I)
|
|
|
|
text = re.sub("GND ", "ground", text, flags=re.I)
|
|
|
|
text = re.sub("APPR ", "approach", text, flags=re.I)
|
|
|
|
text = re.sub("FREQ ", "frequency", text, flags=re.I)
|
2018-03-15 13:13:17 +00:00
|
|
|
text = re.sub("STD ", "standart", text, flags=re.I)
|
|
|
|
text = re.sub("AFT ", "after", text, flags=re.I)
|
|
|
|
text = re.sub("FWD ", "foreward", text, flags=re.I)
|
2018-02-28 10:34:19 +00:00
|
|
|
return text
|
|
|
|
|
2018-02-02 00:05:44 +00:00
|
|
|
# exit routine to properly close the tn con
|
2018-02-02 00:14:36 +00:00
|
|
|
def exit(self, tn):
|
2018-02-02 00:05:44 +00:00
|
|
|
tn.close
|
|
|
|
sys.exit(0)
|
2018-01-31 16:36:49 +00:00
|
|
|
|
2018-01-31 08:46:55 +00:00
|
|
|
def stop(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def create_skill():
|
|
|
|
return FlightGearCopilotSkill()
|