"NUWA Robot SDK" is an application development kit for robots made by NUWA Robotics. It is based on Android P, and it is possible to create apps using Android Studio.
The NUWA Robot SDK supports the following development environments:
The latest information is available on the official website.
In addition to the Android Archive (aar) that includes the NUWA Robot API, sample code, tutorials, etc. are provided.
Download newest from Nuwarobotics Developer Website
Nuwarobotics Github
Nuwarobotics Developer - Available Motion List
This document explains how to use the NUWA Robot SDK easily. For an overview of the NUWA Robot SDK, see the NUWA Robot SDK Manual, and for API details, see the NUWA Robot SDK Javadoc.
Kebbi's apps can be developed on both Windows and Mac. This document is developed on Mac.
Android Studio is required for development. Please prepare the latest version of Android Studio.
First, set Kebbi to developer mode by following the steps below.
From this screen, look for "build settings" in "device information" and hit "build number" repeatedly. "Developer options" is added to "Advanced" of "System".
Connect Kebbi with a USB cable.
In my environment, I did not recognize that it was a USB-C cable I had (USB-C on both ends), so I changed the conversion adapter to the USB-C cable (USB-C and USB-2.0) that came with Kebbi. When I put it on, it was recognized normally.
The password of adb is
!Q@W#E$R
Now let's create a simple app for Kebbi.
Select Start a new Android Studio project to create a new project.
Select "Empty Activity".
This time, I named it "Hello Kebbi".
Set the library to use the NUWA Robot API.
First, select "Project" from the menu on the upper left.
Then copy the latest .aar file of the NUWA SDK to the libs folder inside the app folder.
If the copy is successful, it will look like this.
Add the following description to the very end of "build.gradle" in the app folder.
repositories {
flatDir {
dirs'libs'
}
}
Finally, add the following to the end of the dependencies of "build.gradle".
xxxxxxxxxx
// include Nuwa Robot SDK in / libs
implementation (name:'KiwiSDK_RPC_2019-10-03_v1.0.1.9.54caff0', ext:'aar')
Now let's create a program.
Look for MainActivity.java in the src folder inside the app folder.
Add the following line to AppCompatActivity. (The import for using the NuwaRobot API is automatically added. The same applies below.)
xxxxxxxxxx
private NuwaRobotAPI mRobot;
Describe the initial processing for using the API in onCreate. Also, prepare a function to handle the event. Rewrite onCreate as follows.
x @Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
// init kiwi sdk
String your_app_package_name = getPackageName ();
IClientId id = new IClientId (your_app_package_name);
mRobot = new NuwaRobotAPI (this, id);
// register Nuwa Robot Listener
registerNuwaRobotListener ();
}
void registerNuwaRobotListener () {
}
Next, let's define a listener for events that originate from Kebbi.
Please do not copy and paste the following in the "void register NuwaRobotListener" created earlier.
xxxxxxxxxx
mRobot.registerRobotEventListener (new RobotEventListener)
Then, input assistance will appear like this, so select it.
Because there is an error in the closing parenthesis
Fix it like this.
After fixing it, try adding the following programs as well.
xxxxxxxxxx
mRobot.registerVoiceEventListener (new VoiceEventListener)
Finally, the registerNuwaRobotListener looks like this: If you are having trouble with input assistance, try copying the following sources.
xxxxxxxxxx
void registerNuwaRobotListener () {
mRobot.registerRobotEventListener (new RobotEventListener () {
@Override
public void onWikiServiceStart () {
}
@Override
public void onWikiServiceStop () {
}
@Override
public void onWikiServiceCrash () {
}
@Override
public void onWikiServiceRecovery () {
}
@Override
public void onStartOfMotionPlay (String s) {
}
@Override
public void onPauseOfMotionPlay (String s) {
}
@Override
public void onStopOfMotionPlay (String s) {
}
@Override
public void onCompleteOfMotionPlay (String s) {
}
@Override
public void onPlayBackOfMotionPlay (String s) {
}
@Override
public void onErrorOfMotionPlay (int i) {
}
@Override
public void onPrepareMotion (boolean b, String s, float v) {
}
@Override
public void onCameraOfMotionPlay (String s) {
}
@Override
public void onGetCameraPose (float v, float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9, float v10, float v11) {
}
@Override
public void onTouchEvent (int i, int i1) {
}
@Override
public void onPIREvent (int i) {
}
@Override
public void onTap (int i) {
}
@Override
public void onLongPress (int i) {
}
@Override
public void onWindowSurfaceReady () {
}
@Override
public void onWindowSurfaceDestroy () {
}
@Override
public void onTouchEyes (int i, int i1) {
}
@Override
public void onRawTouch (int i, int i1, int i2) {
}
@Override
public void onFaceSpeaker (float v) {
}
@Override
public void onActionEvent (int i, int i1) {
}
@Override
public void onDropSensorEvent (int i) {
}
@Override
public void onMotorErrorEvent (int i, int i1) {
}
});
mRobot.registerVoiceEventListener (new VoiceEventListener () {
@Override
public void onWakeup (boolean b, String s, float v) {
}
@Override
public void onTTSComplete (boolean b) {
}
@Override
public void onSpeechRecognizeComplete (boolean b, ResultType resultType, String s) {
}
@Override
public void onSpeech2TextComplete (boolean b, String s) {
}
@Override
public void onMixUnderstandComplete (boolean b, ResultType resultType, String s) {
}
@Override
public void onSpeechState (ListenType listenType, SpeechState speechState) {
}
@Override
public void onSpeakState (SpeakType speakType, SpeakState speakState) {
}
@Override
public void onGrammarState (boolean b, String s) {
}
@Override
public void onListenVolumeChanged (ListenType listenType, int i) {
}
@Override
public void onHotwordChange (HotwordState hotwordState, HotwordType hotwordType, String s) {
}
});
}
The program is now ready!
Thank you for waiting! Let Kebbi speak. From the event listeners you added earlier, find onWikiServiceStart and modify it as follows. This event is an event that will be called after the API has been initialized.
xxxxxxxxxx
@Override
public void onWikiServiceStart() {
Log.d("KEBBI", "onWikiServiceStart");
mRobot.startTTS("Hello, I'm Kebbi.");
}
Finally, let's log one more thing to the event listener.
xxxxxxxxxx
@Override
public void onTTSComplete (boolean b) {
Log.d ("KEBBI", "onTTSComplete:" + b);
}
onTTSComplete is an event that is called when Kebbi's utterance is over. This is useful if you want Kebbi to speak and move continuously. This is the first time, so let's check the log.
Now let's run the program. If Kebbi is connected to your computer, Kebbi should be displayed in the upper left corner of the model name. Press the play button and the program will run!
How is it? Did Kebbi talk to you? By the way, let's check the log as well. It is convenient to enter "KEBBI" in the log search because unnecessary logs will not be displayed.
To close the app, press the stop button in Android Studio. Even if you press the button on Kebbi's head, it looks like it's finished, but the app is actually working.
The run app will be automatically added to Kebbi's menu. From the next time onwards, you can also start the app from here.
Just like any other app, you can specify the program name or change the icon to a nice one, and you will have your own original app!
Thank you for your support, this completes the tutorial. I hope you understand the basic flow of creating a Kebbi app. However, there are still many things I would like to try, right?
First of all
[NUWA Robot SDK Manual] NUWA Developer
Let's read. This document is a complete introduction to how to use the API to create Kebby apps. Also, sample programs etc. are published on the official website, so please refer to them.
For example ...
There are some simple example for your reference.
[NUWA SDK Example Github] Sample Code
You will be able to do such things!