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.
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.
Prepare the following files in an appropriate directory on the Docker environment.
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 /
pynaoqi-python2.7-2.0.5.3-linux64.tar.gz Copy the files in the USB memory distributed by Pepper Tech Fes 2014.
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
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.
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.
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.
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