Goal
In this tutorial, we will create a minimal application, making Pepper say “Hello human!”.
Prerequisites
Make sure you have installed Android Studio, the Pepper SDK plugin, the Robot SDK and the related tools.
For further details, see: Installing the Pepper SDK plug-in.
Let’s start a new project
For further details, see: Creating a robot application.
To make Pepper talk, we will use the Say interface. This class represents one of the several actions Pepper can perform.
To use the Say interface:
Step | Action |
---|---|
Build the Say. Create a new instance of Say with a // Create a new say action.
val say: Say = SayBuilder.with(qiContext) // Create the builder with the context.
.withText("Hello human!") // Set the text to say.
.build() // Build the say action.
// Create a new say action.
Say say = SayBuilder.with(qiContext) // Create the builder with the context.
.withText("Hello human!") // Set the text to say.
.build(); // Build the say action.
|
|
Run the Say. Call the // Execute the action.
say.run()
// Execute the action.
say.run();
The complete code should look like this: override fun onRobotFocusGained(qiContext: QiContext) {
// Create a new say action.
val say: Say = SayBuilder.with(qiContext) // Create the builder with the context.
.withText("Hello human!") // Set the text to say.
.build() // Build the say action.
// Execute the action.
say.run()
}
override fun onRobotFocusLost() {
// Nothing here.
}
@Override
public void onRobotFocusGained(QiContext qiContext) {
// Create a new say action.
Say say = SayBuilder.with(qiContext) // Create the builder with the context.
.withText("Hello human!") // Set the text to say.
.build(); // Build the say action.
// Execute the action.
say.run();
}
@Override
public void onRobotFocusLost() {
// Nothing here.
}
That’s all you need to make Pepper talk! |
The sources for this tutorial are available on GitHub.
Step | Action |
---|---|
Install and run the application. For further details, see: Running an application. |
|
Choose “Hello Human”. Congrats! You now have a talking Pepper! |