Pepper-kun remote control environment construction with Docker + IPython Notebook

There have been various encounters and the chances of touching Pepper have increased. To run a program with Pepper, create an application using a visual programming environment called Choregraphe, deploy it to Pepper and execute it, or control Pepper remotely from a computer using NAOqi for Python etc. There is also a method.

The method using Choregraphe is very intuitive, but in the trial and error phase such as calling the API directly, ** NAOqi that can execute functions sequentially in an interpreted manner and can be confirmed in a visual environment such as an image. If you have a for Python environment **, it should come in handy ... So I tried to build a NAOqi for Python environment with IPython Notebook, so that memo.

Things necessary

Environment

NAOqi for Python runs on Python 2.7, so build the image based on the IPython Notebook image https://registry.hub.docker.com/u/unfairbanks/docker-ipython-notebook/ that contains Python 2.7.6. I will try it.

File to prepare

Prepare the following files in an appropriate directory on the Docker environment.

  1. Dockerfile Save the following contents as Dockerfile. The NAOqi docs show examples using PIL, so Pillow also pip install.

    FROM unfairbanks/docker-ipython-notebook
    MAINTAINER yacchin1205 <http://twitter.com/yacchin1205/>
    
    RUN apt-get update
    RUN apt-get install -y libjpeg-dev zlib1g-dev
    RUN pip install Pillow
    
    RUN mkdir /pynaoqi
    ADD ./pynaoqi-python2.7-2.0.5.3-linux64.tar.gz /pynaoqi/
    
    ADD ./run.sh /
    
  2. pynaoqi-python2.7-2.0.5.3-linux64.tar.gz Copy the files in the USB memory distributed by Pepper Tech Fes 2014.

  3. run.sh Prepare run.sh that includes the directory where NAOqi for Python is expanded in PYTHONPATH.

    #! /bin/bash
    export PYTHONPATH=$PYTHONPATH:/pynaoqi/pynaoqi-python2.7-2.0.5.3-linux64
    
    ipython notebook --no-browser --ip=0.0.0.0 --port=8080 --notebook-dir=/tmp/notebook
    

Build

You can build with the following command.

docker@boot2docker:/vagrant/pepper/ipython-pythonsdk$ docker build -t test_dev/docker-ipython-notebook-pynaoqi .

If the build is successful, you will get the image test_dev / docker-ipython-notebook-pynaoqi.

In addition, since archive.ubuntu.com could not be resolved or an error occurred during build in the boot2docker environment, modify resolv.conf by referring to https://github.com/boot2docker/boot2docker-cli/issues/102. And respond.

Try using

Execute container

The created image can be executed with the following command.

docker@boot2docker:/vagrant/pepper/ipython-pythonsdk$ docker run -d -p 8080:8080 -v /vagrant/notebook:/tmp/notebook test_dev/docker-ipython-notebook-pynaoqi

Here, / vagrant / notebook (C: \ test \ boot2docker-vboxsf \ notebook on the Windows host) is made visible as the / tmp / notebook directory inside the container.

Play on the launched IPython Notebook

After execution, you can open the IPython Notebook by accessing http: // Docker environment: 8080 with a browser. Since NAOqi for Python is already installed in this IPython Notebook environment,

from naoqi import ALProxy
IP = "IP address of Pepper"
PORT = 9559
motion = ALProxy("ALMotion", IP, PORT)
motion.angleInterpolation(["HeadYaw", "HeadPitch"], [-0.2, -0.2], [1, 1], False)

Or move your neck

Since it is a Notebook environment, it is possible to examine the script while checking the actually obtained image, such as processing the camera image of Pepper like this.

ipython-notebook.png

Take an image with your head camera, or take an image with a depth camera. If there is any material, I will paste it.

Recommended Posts

Pepper-kun remote control environment construction with Docker + IPython Notebook
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Data analysis environment construction with Python (IPython notebook + Pandas)
Build IPython Notebook environment with boot2docker
Data science environment construction with Docker
Environment construction with VSCode + Remote Container (Go / Application)
Pillow environment construction --For Docker + iPython (and OpenCV)
R environment construction with Jupyter (formerly IPython notebook) (on OS X El Capitan 10.11.3)
[Python] OpenCV environment construction with Docker (cv2.imshow () also works)
From Kafka to KSQL --Easy environment construction with docker
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
Parallel computing with iPython notebook
ML environment construction with Miniconda
Docker + Django + React environment construction
Prepare python3 environment with Docker
Play with Jupyter Notebook (IPython Notebook)
Run Apache-Spark with IPython Notebook
Run IPython Notebook on Docker
Graph drawing with IPython Notebook
Use Bokeh with IPython Notebook
From environment construction to deployment for flask + Heroku with Docker
R & D life with iPython notebook
Get started with Python! ~ ① Environment construction ~
ruby environment construction with aws EC2
Easy Jupyter environment construction with Cloud9
How to use jupyter notebook without polluting your environment with Docker
Build PyPy execution environment with Docker
[MEMO] [Development environment construction] Jupyter Notebook
[Linux] Docker environment construction on Redhat
Automate environment construction with Shell Script
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Postgres environment construction with Docker I struggled a little, so note
Using Chainer with CentOS7 [Environment construction]
pytorch @ python3.8 environment construction with pipenv
Rebuild Django's development environment with Docker! !! !! !!
[docker] python3.5 + numpy + matplotlib environment construction
Environment construction with pyenv and pyenv-virtualenv
I wanted to use jupyter notebook with docker in pip environment (opticspy)
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Easy construction]
Realize environment construction for "Deep Learning from scratch" with docker and Vagrant
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Access the Docker Remote API with Requests
Build Jupyter Lab (Python) environment with Docker
Use apache Spark with jupyter notebook (IPython notebook)
Vue.js + Flask environment construction memorandum ~ with Anaconda3 ~
Get a local DynamoDB environment with Docker
Create Python + uWSGI + Nginx environment with Docker
"LIVE" HTML presentation with IPython 3.0.0-dev, IPython Notebook
[Linux] Build a jenkins environment with Docker
Launch environment with LineBot + Heroku + Docker + Python
Infrared remote control reception with Intel Edison
A memo packed with RADEX environment construction
[ev3dev × Python] SSH Control (remote control with keyboard)
Let's get along with Python # 0 (Environment construction)
Rich cell output with Jupyter Notebook (IPython)
Build NGINX + NGINX Unit + MySQL environment with Docker
[Linux] Build a Docker environment with Amazon Linux 2
Python local development environment construction template [Flask / Django / Jupyter with Docker + VS Code]
Easy Python data analysis environment construction with Windows10 Pro x VS Code x Docker
Collecting information from Twitter with Python (Environment construction)