Touch virtual robots with Pepper's Python SDK

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 the9559` 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 ...

The port on which the virtual robot is 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.

virtualrobot-port.png

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.

Tweaking Pepper's virtual robot with Python SDK

Other ways

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

Touch virtual robots with Pepper's Python SDK
Virtual environment with Python 3.6
Build python virtual environment with virtualenv
Create a virtual environment with Python!
Building a virtual environment with Python 3
[Python] Create a virtual environment with Anaconda
Working with OpenStack using the Python SDK
Register users with Google Admin SDK (python)
Build a python virtual environment with pyenv
Touch AWS with Serverless Framework and Python
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Python (Windows 10) Virtual Environment / Package with VS Code
Twilio with Python
Create a virtual environment with conda in Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Work in a virtual environment with Python virtualenv.
Bingo with python
Zundokokiyoshi with python
From Python environment construction to virtual environment construction with anaconda
Excel with Python
Microcomputer with Python
Cast with python
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Build a python virtual environment with virtualenv and virtualenvwrapper
Fleet provisioning with AWS IoT SDK for Python v2
I tried to touch the CSV file with Python
Build a python virtual environment with virtualenv and virtualenvwrapper
Get in touch with functional programming in JavaScript or Python 3
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Socket communication with Python
Data analysis with python 2
Touch MySQL from Python 3
Try scraping with Python.
Learning Python with ChemTHEATER 03
Sequential search with Python
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Run prepDE.py with python3
1.1 Getting Started with Python
Collecting tweets with Python
Binarization with OpenCV / Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Posting tweets with python