How to Build Your First Humanoid Robot App Using Pepper SDK

Written by

in

To build your first humanoid robot app using the Pepper SDK, you must configure a standard Android Studio project, integrate the QiSDK plugin, and program the robot’s lifecycle to execute physical behaviors like speaking or moving. Because Pepper’s integrated chest tablet runs on the Android operating system, programming the robot relies heavily on standard Android development practices combined with SoftBank Robotics’ proprietary robotic API. 💻 Environment Setup

Before writing code, you need to prepare your development environment inside Android Studio:

Install the Plugin: Open Android Studio, navigate to your plugin settings, and install the official Pepper SDK plugin.

Download the Robot SDK: Click the Robot SDK Manager icon that appears on your main toolbar to download the required QiSDK platforms and emulator tools.

Create a Base Project: Start a standard Android Studio project choosing an Empty Views Activity template.

Target API Level: Set your Minimum SDK to API 23 (Android 6.0 Marshmallow), which matches the core architecture of Pepper’s tablet.

Robotify Your Project: Navigate to Tools > Pepper SDK > Create Robot Application. This automatically injects the QiSDK dependencies into your build.gradle file, configures a uses-feature tag in your AndroidManifest.xml, and adds the necessary robotsdk.xml asset. ⚙️ Understanding the Robot Lifecycle

Unlike a standard mobile application, a Pepper app must handle a distinct physical lifecycle managed via the RobotLifecycleCallbacks interface. Your main activity must register and implement these specific events: onRobotFocusGained(QiContext qiContext)

This triggers when your app gains control of the physical robot.

You receive a QiContext object, which is required to build all robotic actions (such as speech, animations, or navigation). onRobotFocusLost() This triggers when the app loses control of the robot.

Use this event to release resources and cancel any ongoing physical movements. onRobotFocusRefused(String reason)

This triggers if the robot’s core operating system denies your application the focus (e.g., if another high-priority safety behavior is running). 🗣️ Writing Your First “Hello Human” App

To make Pepper execute an action when focus is gained, you use the Say builder to handle speech generation:

public class MainActivity extends AppCompatActivity implements RobotLifecycleCallbacks { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Register the robot lifecycle to your activity QiSDK.register(this, this); } @Override public void onRobotFocusGained(QiContext qiContext) { // Create the Say action using the builder pattern Say say = SayBuilder.with(qiContext) .withText(“Hello human!”) .build(); // Execute the action asynchronously say.run(); } @Override public void onRobotFocusLost() { // Handle cleanup here } @Override public void onRobotFocusRefused(String reason) { // Handle rejection here } @Override protected void onDestroy() { // Unregister the lifecycle when the activity dies QiSDK.unregister(this, this); super.onDestroy(); } } Use code with caution. 🚀 Testing and Deployment

Once your code is ready, you have two primary methods to test and deploy your application: Hello Pepper: Program Robots on Android

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts