AI Robot Chat

Have you wanted to chat with your robot using artificial intelligence and speech recognition? This tutorial example will show you how! You can use either an existing robot project or start from a blank project. In this tutorial, we will use the Bing Speech Recognition and PandoraBot robot skills. The Bing Speech Recognition skill will listen to spoken phrases and translate them into text. The text will then be sent to the PandoraBot robot skill via the ControlCommand(). The PandoraBot will receive the text that you had spoken, and respond. This will allow you to have a conversation with the robot.


Requirements


Robot Skills Used

The following robot skills are used in this tutorial. Click any of these to further read the manuals for the robot skills.


Programming Concepts Used

The following programming concepts in ARC are used. Click on any of these to further read the manuals.


Steps

  1. Add the Bing Speech Recognition robot skill. In ARC, click the top menu.
    (Project -> Add Robot Skill -> Speech Recognition -> Bing Speech Recognition)


  2. Add the PandoraBot robot skill. In ARC, click the top menu.
    (Project -> Add Robot Skill -> Artificial Intelligence -> PandoraBots)


  3. We will now instruct the Bing Speech Recognition to send a translated text to the PandoraBot robot skill. Press the Config button in the menu bar of the Bing Speech Recognition to open the config menu


  4. Press the All Recognized Scripts button. This is the script that will execute for all speech that is translated. Also, notice the Variable because we will be referencing that in the next step.


  5. As mentioned previously, we will use JavaScript for this tutorial. When the code editor window opens, press the JavaScript Tab.


  6. Right-click in the text area and select PandoraBot and select the SetPhrase option.


  7. With the code now inserted into the code editor, highlight the "[phrase]" text. We will be replacing this text with the variable from the Bing Speech Recognition robot skill in the next step.


  8. Navigate to the Global Variables tab. Locate the $BingSpeech variable and click it. The text will be inserted into the cursor location where the "[phrase]" once was.


  9. The code will now read the following. This will instruct the ControlCommand to send the $BingSpeech variable contents to the PandoraBot.

    ControlCommand("PandoraBot", "SetPhrase", getVar("$BingSpeech"));

  10. Press SAVE to save these code changes.


  11. Place a check-mark next to the Auto Record using VAD. Optionally, place your cursor over the blue question mark to read what that option does. It will use an algorithm to detect human speech and automatically begin recording.


  12. Press SAVE to save the changes to this robot skill config menu.


  13. *Optional setting: If you are using an EZB with supported audio (i.e. EZ-Robot EZ-B v4, IoTiny), you can enable the PandoraBot to speak out of the EZB speaker. To do this, visit the PandoraBot config menu by clicking on the three dots in the title bar of the PandoraBot robot skill. In the config menu, place a checkbox next to the Use EZ-B v4 Speaker setting and press save.


  14. Congratulations, you are now able to have conversations with your robot using artificial intelligence!