This year, I had the opportunity to work with Pepper, and it was a very interesting experience. Pepper is interesting both in terms of hardware and software, but the number is still small. There are several Pepper-kuns in Aldebaran Atelier Akihabara, but I cannot deny the feeling that they are not enough compared to the number of people who want to experiment. (I think there are many people who can't go there because they aren't in the neighborhood.)
So, I want to do what I can do with a virtual robot as much as possible, so this time I touched Python SDK with a virtual robot. That memo.
Python SDK(NAOqi for Python)
As explained in say hello with Python SDK (Pepper TechFes technical session), for Pepper, Pepper via the ʻALProxyclass. You can operate the API remotely by connecting to the
9559` port of.
I want to do this with a virtual robot, but what should I do?
Here, the service called NAOqi is listening on the 9559
port on Pepper, but I can imagine that the virtual robot is also NAOqi that runs locally. Where are you listening ...
From the conclusion, it seems that NAOqi is running on the virtual robot as well as the actual Pepper machine and listening on a certain port, and Choregraphe connects to the local NAOqi via this port and shows it as a "virtual robot".
To find out more about this port, ** Click Settings on the Edit menu and open the Virtual Robot tab. ** Here ** [NAOqi status] ** shows the information of the virtual robot service. In the following cases, it is operating on the 64695
port.
In this state, if I touched NAOqi on the 64695
port of localhost from the installed Python SDK, I was able to play with the virtual robot via the Python SDK. For example, like this.
C:\>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from naoqi import ALProxy
>>> motion = ALProxy("ALMotion", "localhost", 64695)
[I] 3448 qi.eventloop: Creating event loop while no qi::Application() is running
[I] 3448 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 3448 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:65302
>>> motion.moveTo(1.0, 0.0, 0.0)
In the above example, moveTo (1.0, 0.0, 0.0)
is specified for ʻALMotion.moveTo (X, Y, theta)`, so it moves 1m forward.
It looks like this as a video.
After checking the documentation, it seems that there is also a way to run bin / naoqi-bin.exe
in the folder where Choregraphe is installed. In this case, it seems to listen on the local 9559
port.
Well, there are people who say the same thing in Connect to virtual robot using Python scripts, so the method I wrote this time is also ant. Isn't it?
Well, what you can do with a virtual robot is limited, but it's not a little interesting because you can try out the behavior of the Python SDK moderately. I think.
Recommended Posts