Приложение Pepper для Android никогда не запускало функцию onRobotFocusGained() на настоящем перце ⇐ Android
Приложение Pepper для Android никогда не запускало функцию onRobotFocusGained() на настоящем перце
I have a problem with some simple kotlin code on a pepper robot. I followed the "get started" tutorial from softbanks (https://qisdk.softbankrobotics.com/sdk/ ... orial.html) and it works fine, except to start the function onRobotFocusGained. I have implemented some logs to see, that the program starts the functions "onCreate", "onStart" and "onResume" but never the "onRobotFocusGained". If I start the code from the tutorial on GitHub (https://github.com/aldebaran/qisdk-tutorials), it works fine. But this program is too heavy for any complete beginners. My goal is to implement a minimal example for my colleagues to start with programming on pepper.
So, how pepper starts the function "onRobotFocusGained" (https://qisdk.softbankrobotics.com/sdk/ ... -lifecycle)?
Here is my short program for pepper to say once "hello humans" if i start the program but pepper never says it.
package com.example.hello_pepper_2 import android.os.Bundle import android.util.Log import android.com.aldebaran.qi.sdk.QiContext import android.com.aldebaran.qi.sdk.QiSDK import android.com.aldebaran.qi.sdk.RobotLifecycleCallbacks import android.com.aldebaran.qi.sdk.`object`.conversation.Say import android.com.aldebaran.qi.sdk.builder.SayBuilder import android.com.aldebaran.qi.sdk.design.activity.RobotActivity class MainActivity : RobotActivity(), RobotLifecycleCallbacks { var robotContext: QiContext? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Register the RobotLifecycleCallbacks to this Activity. QiSDK.register(this, this) setContentView(R.layout.activity_main) Log.e("MSG", "onCreate") Log.e("Context", "robot.Context.toString()") } override fun onStart() { super.onStart() Log.e("MSG", "onStart") Log.e("Context", "robot.Context.toString()") } override fun onResume() { super.onResume() Log.e("MSG", "onResume") Log.e("Context", "robot.Context.toString()") } override fun onRestart() { super.onRestart() Log.e("MSG", "onRestart") Log.e("Context", "robot.Context.toString()") } override fun onPause() { super.onPause() Log.e("MSG", "onPause") Log.e("Context", "robot.Context.toString()") } override fun onStop() { super.onStop() Log.e("MSG", "onStop") Log.e("Context", "robot.Context.toString()") } override fun onDestroy() { // Unregister the RobotLifecycleCallbacks for this Activity. QiSDK.unregister(this, this) super.onDestroy() robotContext = null Log.e("MSG", "onDestroy") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusGained(qiContext: QiContext) { // The robot focus is gained. robotContext = qiContext saySomething("Hello Humans") Log.e("MSG", "onRobotFocusGained") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusLost() { // The robot focus is lost. Log.e("MSG", "onRobotFocusLost") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusRefused(reason: String) { // The robot focus is refused. Log.e("MSG", "onRobotFocusRefused") Log.e("Context", "robot.Context.toString()") } fun saySomething(phrase: String) { Log.e("MSG", "saySomething") Log.e("Context", "robot.Context.toString()") val say: Say = SayBuilder .with(robotContext) .withText(phrase) .build() say.run() } }
Источник: https://stackoverflow.com/questions/702 ... eal-pepper
I have a problem with some simple kotlin code on a pepper robot. I followed the "get started" tutorial from softbanks (https://qisdk.softbankrobotics.com/sdk/ ... orial.html) and it works fine, except to start the function onRobotFocusGained. I have implemented some logs to see, that the program starts the functions "onCreate", "onStart" and "onResume" but never the "onRobotFocusGained". If I start the code from the tutorial on GitHub (https://github.com/aldebaran/qisdk-tutorials), it works fine. But this program is too heavy for any complete beginners. My goal is to implement a minimal example for my colleagues to start with programming on pepper.
So, how pepper starts the function "onRobotFocusGained" (https://qisdk.softbankrobotics.com/sdk/ ... -lifecycle)?
Here is my short program for pepper to say once "hello humans" if i start the program but pepper never says it.
package com.example.hello_pepper_2 import android.os.Bundle import android.util.Log import android.com.aldebaran.qi.sdk.QiContext import android.com.aldebaran.qi.sdk.QiSDK import android.com.aldebaran.qi.sdk.RobotLifecycleCallbacks import android.com.aldebaran.qi.sdk.`object`.conversation.Say import android.com.aldebaran.qi.sdk.builder.SayBuilder import android.com.aldebaran.qi.sdk.design.activity.RobotActivity class MainActivity : RobotActivity(), RobotLifecycleCallbacks { var robotContext: QiContext? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Register the RobotLifecycleCallbacks to this Activity. QiSDK.register(this, this) setContentView(R.layout.activity_main) Log.e("MSG", "onCreate") Log.e("Context", "robot.Context.toString()") } override fun onStart() { super.onStart() Log.e("MSG", "onStart") Log.e("Context", "robot.Context.toString()") } override fun onResume() { super.onResume() Log.e("MSG", "onResume") Log.e("Context", "robot.Context.toString()") } override fun onRestart() { super.onRestart() Log.e("MSG", "onRestart") Log.e("Context", "robot.Context.toString()") } override fun onPause() { super.onPause() Log.e("MSG", "onPause") Log.e("Context", "robot.Context.toString()") } override fun onStop() { super.onStop() Log.e("MSG", "onStop") Log.e("Context", "robot.Context.toString()") } override fun onDestroy() { // Unregister the RobotLifecycleCallbacks for this Activity. QiSDK.unregister(this, this) super.onDestroy() robotContext = null Log.e("MSG", "onDestroy") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusGained(qiContext: QiContext) { // The robot focus is gained. robotContext = qiContext saySomething("Hello Humans") Log.e("MSG", "onRobotFocusGained") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusLost() { // The robot focus is lost. Log.e("MSG", "onRobotFocusLost") Log.e("Context", "robot.Context.toString()") } override fun onRobotFocusRefused(reason: String) { // The robot focus is refused. Log.e("MSG", "onRobotFocusRefused") Log.e("Context", "robot.Context.toString()") } fun saySomething(phrase: String) { Log.e("MSG", "saySomething") Log.e("Context", "robot.Context.toString()") val say: Say = SayBuilder .with(robotContext) .withText(phrase) .build() say.run() } }
Источник: https://stackoverflow.com/questions/702 ... eal-pepper
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Pepper Robot, проблемы при получении данных с помощью php-запроса из Altervista
Anonymous » » в форуме Android - 0 Ответы
- 43 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Linux Установка Python SDK для роботов Pepper, но нет модуля с именем naoqi
Anonymous » » в форуме Linux - 0 Ответы
- 86 Просмотры
-
Последнее сообщение Anonymous
-