Запуск файла в оболочке Python с помощью голоса - PullRequest
0 голосов
/ 04 ноября 2018

Я пытаюсь выяснить, как я могу запустить файл (Main.py), используя мой голос, чтобы сделать это, я должен запустить cvc.py (CozmoVoiceCommander.py), а затем сказать, что COZMO запускает ПОГОДУ и компьютер будет распознавать ПОГОДУ и КОЗМО и инициировать main.py, который будет подключаться к обвинителю. код для одной из голосовых команд - танец, представленный здесь:

def dance(self, robot:cozmo.robot.Robot = None, cmd_args = None):

    print("dancing...")
    robot.play_anim("anim_speedtap_wingame_intensity02_01").wait_for_completed()
    return

DEF DANCE вызывает код, который спрашивает, получил ли он голосовую команду, используя код из en_.json (английские голосовые команды), представленного здесь:

{
"name":"English",
"lang":"en",
"lang_ext":"en-US",
"separator":"then",
"instructions":"You can issue voice commands to Cozmo. You can give multiple commands separating them with the word 'THEN'.\nAvailable Commands are:",
"text_wait":"\nPRESS <SHIFT> WHEN YOU ARE READY TO SPEAK...",
"text_say":"\nSay your commands (Tiemout: 5 seconds - ctrl+c to exit)",
"error_one":"Sorry I didn't understand all of your commands, available commands are:",
"error_all":"Sorry I didn't understand any of your commands, available commands are:",
"commands":
[
    {"action":"forward", "words":["forward", "forwards"], "usage":"Cozmo drives forward for X seconds."},
    {"action":"backward", "words":["backward","backwards"], "usage":"Cozmo drives backwards for X seconds."},
    {"action":"right", "words":["right"], "usage":"Cozmo turns right X degrees, or 90 degrees if no argument."},
    {"action":"left", "words":["left"], "usage":"Cozmo turns left X degrees, or 90 degrees if no argument."},
    {"action":"lift", "words":["lift","arm"], "usage":"Cozmo lifts his lift of X (min:0, max:1 - i.e. 'Cozmo, lift your lift of 0.5')."},
    {"action":"head", "words":["head","tilt"], "usage":"Cozmo tilts his head of X (min:0, max:1)."},
    {"action":"look", "words":["look","search"], "usage":"Cozmo looks for a face."},
    {"action":"follow", "words":["follow","stare"], "usage":"Cozmo follows a face."},
    {"action":"picture", "words":["picture","photo"], "usage":"Cozmo takes a picture, then it saves it in the folder where you launched CvC."},
    {"action":"say", "words":["say","talk"], "usage":"Cozmo says X (where X is any text)."},
    {"action":"blocks", "words":["blocks","cubes","play"], "usage":"Cozmo plays with his blocks."},
    {"action":"dance", "words":["dance","jump"], "usage":"Cozmo dances."},
    {"action":"charger", "words":["charger","base"], "usage":"Cozmo tries to park on is charger, in 3 tries."}
]
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...