I'm using android studio and I need to emulate a conversation with Pepper emulator by using its dialog view. I'm using the following code to connect to pepper emulator and to talk with him:
import qi
import argparse
import sys
import time
import os
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--pip", type=str, default=os.environ['PEPPER_IP'],
help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
parser.add_argument("--pport", type=int, default=9559,
help="Naoqi port number")
parser.add_argument("--sentence", type=str, default="hello",
help="Sentence to say")
parser.add_argument("--language", type=str, default="English",
help="language")
parser.add_argument("--speed", type=int, default=100,
help="speed")
args = parser.parse_args()
pip = args.pip
pport = args.pport
strsay = args.sentence
language = args.language
speed = args.speed
#Starting application
try:
connection_url = "tcp://" + pip + ":" + str(pport)
app = qi.Application(["Say", "--qi-url=" + connection_url ])
except RuntimeError:
print ("Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) +".\n"
"Please check your script arguments. Run with -h option for help.")
sys.exit(1)
app.start()
session = app.session
tts_service = session.service("ALTextToSpeech")
tts_service.setLanguage(language)
tts_service.setVolume(1.0)
tts_service.setParameter("speed", speed)
tts_service.say(strsay)
print " -- Say: "+strsay
tts_service.say("what's your name?")
print " --Say: "+ "what's your name?"
person = raw_input('name: ') #get input from the keyboard using terminal, but I need to take input from dialog view of pepper emulator
tts_service.say("Hi: "+person)
print " --Say: "+ "Hi "+ person
if __name__ == "__main__":
main()
In the code there is tts_service.say("Hi: "+person)
that it is used to show the conversation on the dialog view. Is there something similar to get information form the dialog view? In the conversation I used the function raw_input
but this takes input from the terminal and not from the dialog view.