Victor
Victor

Reputation: 122

Can I use NAOqi 2.5 (C++/Python SDK) features on a NAOqi 2.9 (QiSDK) robot (Pepper)?

I have the Pepper robot running NAOqi 2.9, which is meant to use the QiSDK for its Android tablet. Things have been going well, but the photo capture rate is surprisingly slow (at most 2 fps), so I've got to use the C++ (or Python) SDKs available for NAOqi 2.5 for this particular task.

I've been trying to get it to work for a few days with no success. I have setup both the C++ and Python SDKs up and running, but the problem I'm facing is connection to the robot.

I've run the simple following code (using the robot's IP) found on the official website here

from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "<IP of your robot>", 9559)
tts.say("Hello, world!")

and I'm getting the following output stream after the second line

The connection problem occurs running either C++ on Ubuntu, or Python on Windows.

I can connect to the robot via SSH, FTP, QiSDK in Android Studio, but not in any way through the NAOqi 2.5 SDKs for C++ or Python. Since QiSDK was most probably build on top of the C++ SDK, there surely has to be a way to make this to work.

Any information will help immeasurably.

Upvotes: 2

Views: 1616

Answers (2)

Victor
Victor

Reputation: 122

Edit

There's another way, you can use the qi Python library inside Pepper's head, in order to use services, such as ALTextToSpeech or ALMotion, with a simple example here. One could also only use SSH to start a Python server, which would give access to these functionalities through endpoints.

import qi

app = qi.Application()
app.start()
session = app.session
tts = session.service("ALTextToSpeech")
tts.say("Hello Word")

If you run the above snippet inside Pepper's head it produces the expected output(saying Hello world). There are almost all the services that are documented here. You can also list them all by calling .services() on the session object

End of Edit

I finally found a way to hack into it. If you connect to the robot via SSH you can use the qicli binary. Its documentation is here

qicli info lists all services available, for example ALVideoDevice or ALMotion

qicli info ALMotion displays the available methods of that service

qicli info ALMotion.setAngles displays info about that method's parameters

qicli call ALMotion.setAngles HeadYaw 0.7 0.3 calls the function in the module with given parameters

So one could write a wrapper to this binary and call it programmatically via SSH, it seems like a lot of work for this kind of task but I haven't found anything else.

I've got Python's Paramiko library to work:

import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='ip-of-robot', username='nao', password='your-pass')

stdin, stdout, stderr = client.exec_command('pwd')
print(stdout.read())

client.exec_command('qicli call ALMotion.setAngles HeadYaw -0.7 0.2')

client.close()    

I've also tried .NET's SSH.NET library, with little to no success.

Upvotes: 3

Tanikai
Tanikai

Reputation: 86

As far as I know, in NAOqi 2.5, the tablet (JavaScript) and the "brain" (Choregraphe i.e. Python / C++) of the robot were two independent devices and had to communicate and cooperate with each other. In NAOqi 2.9, the "brain" was moved to the tablet and the only way to program Pepper is by using Android Studio.

On the download page for Pepper NAOqi 2.9 (https://www.softbankrobotics.com/emea/en/support/pepper-naoqi-2-9/downloads-softwares), there is a comment regarding the Python SDK:

This is for old NAOqi 2.5.10 and NAOqi 2.5.5.

And the following is stated for NAOqi 2.9 / Pepper SDK Plugin [for Android Studio]:

This is all you need for Pepper NAOqi 2.9.

Therefore, according to Softbank Robotics' documentation, using Python / C++ to program a NAOqi 2.9 Pepper is not possible.

I hope this information answers your question.

Upvotes: 2

Related Questions