NUWA Robot SDK

ver 1.1.5

How to start

Feature list:

System Requirement

Kebbi-air is based on Android P. You can use Android Studio or other IDE for android developing. Please refer to Android Studio for more information.

How to use

Get Nuwa SDK aar and import into your android studio project / or unity IDE.

Nuwa Robot SDK supports the following development environment.

Developer could refer to Nuwarobotics official developer website or GitHub to understand the API usage.

NOTICE : Content Editor only for Business Partner, please contact nuwarobotics for more information.

Nuwa Developer MODE

How to enable developer mode

How to hide developer option

Change your adb password

Allow Developer change adb password to prevent other user access android system.

developer_adb_change_password

How to install APK

User can use ADB(android debug bridge) directly to install apk. (in Kebbi-Air)

After adb connected, developer can use adb install command to install apk.

 

Initiation

Before using Robot SDK, App needs to to create a single instance of Nuwa Robot API and do initiation once first.

Register callback

Due to all functions of Nuwa Robot SDK are async(Based on AIDL) design, App needs to register a callback to receive all kinds of notifications and results from Robot.

You could also use helper class to overwrite events that App needs only.

Check Nuwa Robot SDK engine is ready before app calling any Robot SDK API

Once mRobot is created, you will receive a callback of onWikiServiceStart()

NOTICE : please call api after onWikiServiceStart.

Nuwa Motion player

Nuwa motion file is nuwa's private Robot motion control format. Which is composed of "MP4(Face)", "Motor control", "Timeline control", "LED control", etc. You can just play a motion, and Robot will do a serials of pre-defined actions. PS: Some motions only include "body movements" without "MP4(Face)"

Kebbi Motion list

Overlap window control

While playing a motion, there is a overlap window on the top of screen, you can do show or hide function with the window.

Voice wakeup

You can say "Hello Kebbi" to get a wakeup event callback in your Appication context ONCE, and robot system behavior NOT response on this time.

Local TTS

Robot can speak out a sentance by a giving string

TTS Capability (Only support on Kebbi Air)

Local ASR

ASR engine use SimpleGrammarData to describe the list of keyword, App needs to create Grammar first. (Command table)

Example

VoiceEventListener Callback

Cloud Speech To Text and Local ASR mix operation

While doing ASR Mix mode, engine will receive results from local and cloud, engine will only return one of both. Rules are:

  1. if engine get local result, it will only return local result
  2. if engine get no local result, it will return ASR result if Internet is available

PS: Cloud ASR and local ASR result are json format string.

Example

VoiceEventListener Callback

Sensor event

Robot provides Touch and PIR and Dropsensor events. While you need it, you can request it. While you don't need it, you can stop requesting it.

LED control

There are 4 parts of LED on Robot. API can contorl each them. (Head, Chest, Right hand, Left hand) Each LED part has 2 types of modles - "Breath mode" and "Light on mode" Before using it, you need to use API to turn on it first, and turn off it while unneeded. LED default controled by System. If the App wants to have different behavior, it can be disabled by disableSystemLED()
If your App needs to control Robot LED, App needs to call disableSystemLED() once,and App call enableSystemLED() while App is in onPause state.

NOTICE : Kebbi-air not support FACE and Chest LED Breath mode.

Motor control

Mibo Robot has 10 motors, use the API, you can control each of them

robot_motor_map

Motor angle range table

ID12345678910
Max204057010005701000
Min-20-40-85-200-3-80-85-200-3-80

Movement control

To control Robot to forward, backwards, turns, stop

Face control

IMPORTANT NOTICE :

The Robot Face is a Activity, so the controller must be SERVICE on background.

Example

Custom Behavior

System behavior allows developer to customize response behavior of a NLP result. Developer need to setup Chatbot Q&A from NUWA Trainingkit website which allow developer setup Custom Intention for a sentence. Following sample code will present how to register receive this CustomIntentation notify and implement customize response.

class BaseBehaviorService

Developer should implement a class to determine how to react when receiving a customized NLP response from NUWA Trainingkit.

This could be achieved by extending from class BaseBehaviorService.

BaseBehaviorService declared three important functions which onInitialize(), createCustomBehavior() and notifyBehaviorFinished().

There are two functions need to be implemented which onInitialize() and createCustomBehavior().

class ISystemBehaviorManager

This class has been encapsulated in BaseBehaviorService. Developer can get this instance which is created by BaseBehaviorService.

class CustomBehavior

The Object which let developer define how to to deal with customized NLP response.

Sample code

Safe mode

Make Robot could stand in place at any case. Robot will auto enable "lock wheel mode" while AC is plugged. App could call "unlockWheel()" to disable the safe mode.

Handle Robot Drop event

When Robot drop happening, it will deliver error message and App could receive the error message via RobotEventListener callback

Handle Robot Service Recovery

When Robot service(Robot SDK) happens unexpected exception, it will restart automaticaly. App could handle the scenario by following callback of RobotEventListener.

How to shown entrypoint on Robot Menu

For Robot Generation 2 (Kebbi-Air) Robot-air menu base on Launcher, please implement standard launcher icon. AndroidManifest.xml

Android Developer reference link https://developer.android.com/guide/topics/manifest/manifest-intro#iconlabel

For Robot Generation 1 (Danny小丹\Kebbi凱比)

Launch Developer App via Voice command

In Original Android design, App is launched by tapping icon in Launcher. In NUWA Robot we allow use "Voice command" to launch an activity or broadcast an intent to a registered receiver.

*Developer can setup several "Voice Command" separate by ",".

NOTICE: "Voice Command" have to be 100% matched.

Disable Support Always Wakeup

Kebbi-air support "Always wakeup" anywhere. (Kebbi and Danny only support wakeup on Face) We allow App declare on Application or Activity scope.

Application Scope Example

Activity Scope Example

How to call nuwa ui to add face recognition

App could call nuwa Face Recognition APP to add a face to system. Developer could lunch App by Intent and receive face-id and name from onActivityResult.

Setup 3rd App as Launcher app to replace Nuwa Face Activity

Nuwa Face Activity is a Unity Activity to present kebbi face. We setup it as default HOME APP to make sure HOME Key can back to Nuwa Face Activity.

We allow Developer totally replace kebbi face by following implementation.

Step1 : declare 3rd App as a HOME APP.

Step 2 : Setup 3rd App as default HOME App.

setting

setting_default_app setting_default_launcher

NOTICE : This setting will cause "Nuwa Face Activity" not always shown after HOME KEY pressed. You have to call Face Control API to trigger shown.

Prevent HOME KEY to suspend device

Some business environment request not allow user suspend device by press HOME KEY.

How to Auto Launch 3rd Activity when bootup

3rd App can declare following intent on Androidmanifest.xml.

Full Example:

Q & A

Q1: Why it dodn't work while App calls "mRobot.motionPlay("001_J1_Good", true/false)"?
Ans:

  1. check the callback of "public void onErrorOfMotionPlay(int errorcode) to know the error info"
  2. make sure the motion name is valid
  3. check the motion list to get the correct motion name

[Kebbi Motion list] https://dss.nuwarobotics.com/documents/listMotionFile


Q2: Why App can not control LED?
Ans:

  1. App needs to call disableSystemLED() once first. Ex: Do it in onCreate() state.
  2. App needs to call enableSystemLED() while App closed. Ex: Do it in onPause() state.

Q3: Why App GUI widget(Ex: Button) can not receive any touch event?
Ans:

  1. There is an overlap window on your app, App call "hideWindow(false)" to close the window.

Q4: Why App GUI widget(Ex: button) can not receive any touch event after playing a motion?
Ans:

  1. There is an overlap window on your app, App call "hideWindow(false)" to close the window in the callback of onCompleteOfMotionPlay().

Q5: Does local ASR and cloud ASR support English?
Ans:

  1. Support "Japanese" and "English".

Q6: Does local TTS support English?
Ans:

  1. TTS supports "Japanese" and "English"

Q7: Why App can not receive Robot touch event?
Ans:

  1. App calls "mRobot.requestSensor(SENSOR_TOUCH)" once.
  2. Handle the following callback
  1. App calls "mRobot.stopSensor(NuwaRobotAPI.SENSOR_NONE)" while App doesn't want to receive the touch events anymore.