Mastering Execute ¶
The robot will say a sentence and by reaching
^execute it will make the baseQiChatbot run a animation
synchronously. Then the speech will resume to where it was stopped.
Before stepping in this tutorial, you should:
- Know how to use Android resources.
- Be familiar with the Action notion. For further details, see: Running Actions on Pepper.
- Know how to use the QiChatbot. For further details, see: QiChatbot.
- Know how to use the Animate action. For further details, see: Mimic an animal — Animate.
Let’s start a new project
- Start a new project, let’s call it ExecutePepper.
- Robotify it and make sure it implements the QiSDK & the Robot Life Cycle.
For further details, see: Creating a robot application.
Creating a topic file¶
Create a new topic file named execute.top for the English (en) language.
Add the following content to this file:
topic: ~execute() concept:(execute) [execute executor] u:(~execute) I've reached the execute ^execute(myExecutor) and now I continue.
For more details about the syntax, see: QiChat - Syntax.
QiChatExecutor class implementation¶
In this section, we will see how to extend the BaseQiChatExecutor class and implement
runWithwill be called when
^executeis reached in the
stopwill be called when the chat that handles the qiChatbot is canceled.
Import raise_both_hands_b001 animation using the Animation Browser. It’s located in Basic movements > Both hands.
Create the following method to perform the animation:
Mapping the QiChatExecutor to a QiChatbot¶
^execute then make a
Add an executor that matches
myExecutor keyword used in the topic. Finally run the chat asynchronously.
If you run the application, Pepper will wait to hear ‘execute’ or ‘executor’ before executing the animation.
Let’s try it¶
The sources for this tutorial are available on GitHub.
Install and run the application.
For further details, see: Running an application.
|Choose “Mastering Execute”.|
|Say “execute” or “executor”.|
|Pepper performs the corresponding animation.|
Pepper continues his sentence after the executor is done (when
You are now able to use BaseQiChatExecutor!