From 8a2ca44ef0c5ea20cbb201c6fa854bcb56931dd5 Mon Sep 17 00:00:00 2001 From: merspieler Date: Thu, 1 Feb 2018 13:24:09 +0100 Subject: [PATCH 1/4] Splitted gear intent into two Signed-off-by: merspieler --- vocab/en-us/gear.voc | 1 - vocab/en-us/geardown.voc | 3 +++ vocab/en-us/gearup.voc | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 vocab/en-us/gear.voc create mode 100644 vocab/en-us/geardown.voc create mode 100644 vocab/en-us/gearup.voc diff --git a/vocab/en-us/gear.voc b/vocab/en-us/gear.voc deleted file mode 100644 index 3f47798..0000000 --- a/vocab/en-us/gear.voc +++ /dev/null @@ -1 +0,0 @@ -gear diff --git a/vocab/en-us/geardown.voc b/vocab/en-us/geardown.voc new file mode 100644 index 0000000..f754bb6 --- /dev/null +++ b/vocab/en-us/geardown.voc @@ -0,0 +1,3 @@ +gear down +extend gear +extend the gear diff --git a/vocab/en-us/gearup.voc b/vocab/en-us/gearup.voc new file mode 100644 index 0000000..d83dfbc --- /dev/null +++ b/vocab/en-us/gearup.voc @@ -0,0 +1,3 @@ +gear up +retract gear +retract the gear From 87f7a80b743600426d0a49643b6c12384d4a17c2 Mon Sep 17 00:00:00 2001 From: merspieler Date: Thu, 1 Feb 2018 13:26:10 +0100 Subject: [PATCH 2/4] Changes to the gear intents Signed-off-by: merspieler --- __init__.py | 58 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index 5de68a9..a6813a5 100644 --- a/__init__.py +++ b/__init__.py @@ -72,8 +72,7 @@ class FlightGearCopilotSkill(MycroftSkill): profile = None - # TODO read acid to know which profile to use - + # read acid to know which profile to use for i_profiles in self.settings['profiles']: for i_acid in i_profiles['acid']: if i_acid == acid: @@ -137,16 +136,57 @@ class FlightGearCopilotSkill(MycroftSkill): # # ######################### - @intent_handler(IntentBuilder('GearIntent').require('gear')) - def handle_gear_intent(self, message): - gear_request = message.data['utterance'] - if gear_request == "gear": - self.speak_dialog("no.gear.action") + @intent_handler(IntentBuilder('GearUpIntent').require('gearup')) + def handle_gear_up_intent(self, message): + + # TODO add connection to fg + # TODO read acid from fg + + # read acid to know which profile to use + 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: + # TODO when creation of profiles via voice is possible, add dialog how to + self.speak("Profile not found") sys.exit(0) - match = re.match(r'.*gear.* (up|down|) +.*|.*(retract|extend) .*gear.*', gear_request, re.i) + if profile['gear-retractable'] == true: + # TODO set gear up in fg + self.speak("Gear up") + else: + self.speak_dialog("gear.not.retractable") - self.speak("Gear " + str(gear_request)) + @intent_handler(IntentBuilder('GearDownIntent').require('geardown')) + def handle_gear_down_intent(self, message): + + # TODO add connection to fg + # TODO read acid from fg + + # read acid to know which profile to use + 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: + # TODO when creation of profiles via voice is possible, add dialog how to + self.speak("Profile not found") + sys.exit(0) + + if profile['gear-retractable'] == true: + # TODO set gear down in fg + self.speak("Gear down") + else: + self.speak_dialog("gear.not.retractable") def stop(self): pass From e9b68341f0c4499131d15141171534199801c860 Mon Sep 17 00:00:00 2001 From: merspieler Date: Thu, 1 Feb 2018 17:47:37 +0100 Subject: [PATCH 3/4] Added checklist Signed-off-by: merspieler --- vocab/en-us/ldgcheck.voc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 vocab/en-us/ldgcheck.voc diff --git a/vocab/en-us/ldgcheck.voc b/vocab/en-us/ldgcheck.voc new file mode 100644 index 0000000..e9b29c5 --- /dev/null +++ b/vocab/en-us/ldgcheck.voc @@ -0,0 +1,2 @@ +landing check list +landing checklist From e9ee1bddd3f23dbebe2e849e68007f08cca9d541 Mon Sep 17 00:00:00 2001 From: merspieler Date: Thu, 1 Feb 2018 17:47:57 +0100 Subject: [PATCH 4/4] Added first checklist intent Signed-off-by: merspieler --- __init__.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/__init__.py b/__init__.py index a6813a5..a1c92dd 100644 --- a/__init__.py +++ b/__init__.py @@ -12,6 +12,9 @@ LOGGER = getLogger(__name__) class FlightGearCopilotSkill(MycroftSkill): def __init__(self): super(FlightGearCopilotSkill, self).__init__() + self.settings['host'] = "localhost" + self.settings['port'] = 8081 + # TODO add self.settings['profiles'] with default profiles (A32X and c172p) # DEFINITION of the settings['profiles'] structure # [ @@ -188,6 +191,27 @@ class FlightGearCopilotSkill(MycroftSkill): else: self.speak_dialog("gear.not.retractable") + +################################################################# +# # +# Checklists # +# # +################################################################# + +# TODO add all possible checklist +# TODO make it possible, to play a .mp3 file instead of tts + +######################### +# # +# LDG Check # +# # +######################### + + @intent_handler(IntentBuilder('LDGCheckIntent').require('ldgcheck')) + def handle_ldg_check_intent(self, message): + # TODO make checklist plane specific + self.speak("Landing no blue. . . Landing checklist completed") + def stop(self): pass