It is a continuation. For the time being, I haven't confirmed the connection to the actual Pepper machine yet, so I tried it. Until now, I tried it with C ++ because of my interest, but this time I tried it with handy Python.
Connect to Pepper with API from your PC and run it.
hello.py
#!/usr/bin/python
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "192.168.3.58", 9559)
tts.say("Hello")
$ ./hello.py
[INFO ] Starting ALNetwork
[INFO ] NAOqi is listening on 127.0.0.1:54010
Traceback (most recent call last):
File "./hello.py", line 5, in <module>
tts = ALProxy("ALTextToSpeech", "192.168.3.58", 9559)
File "/path/to/pynaoqi-python-2.7-naoqi-1.14-mac64/naoqi.py", line 282, in __init__
inaoqi.proxy.__init__(self, args[0], args[1], args[2])
File "/path/to/pynaoqi-python-2.7-naoqi-1.14-mac64/inaoqi.py", line 276, in __init__
this = _inaoqi.new_proxy(*args)
RuntimeError: ALNetwork::getModuleByName
failed to get module ALTextToSpeech http://192.168.3.58:9559
It was an error.
It seems that such a thing appeared in the log on the Pepper side, so I connected, but it is probably "failed to get module ALTextToSpeech".
Pepper102 [0] /var/log/naoqi $ tail -f tail-naoqi.log
[W] 1419836877.127194 3839 qimessaging.transportsocket: Incorrect magic from 192.168.3.4, disconnecting (expected 1118690882, got 1414745936).
Connect to Pepper via SSH from your PC and run the API within Pepper.
$ ssh [email protected]
Password:
Pepper102 [0] ~ $ python
Python 2.7.3 (default, Jun 13 2014, 15:08:05)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import naoqi
>>> from naoqi import ALProxy
First, try executing with localhost specified.
>>> tts = ALProxy("ALTextToSpeech", "localhost", 9559)
[I] 7615 qi.eventloop: Creating event loop while no qi::Application() is running
[I] 7615 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 7615 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:42881
[I] 7615 qimessaging.transportserver: TransportServer will listen on: tcp://198.18.0.1:42881
[I] 7615 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.3.58:42881
>>> tts.say("Hello")
Pepper said "Hello".
Next, try executing by specifying the IP address.
>>> tts = ALProxy("ALTextToSpeech", "192.168.3.58", 9559)
[I] 7994 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 7994 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:43065
[I] 7994 qimessaging.transportserver: TransportServer will listen on: tcp://198.18.0.1:43065
[I] 7994 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.3.58:43065
>>> tts.say("Hello")
Pepper said "Hello".
Recommended Posts