4 boxes that might be useful for the Pepper hackathon

We have released four Choregraphe boxes that may be useful for hackathons using Pepper. We look forward to helping you.

The box is available at https://github.com/takujikawata/webapiboxlibrary.

(2017/4/30 Some box libraries have been changed to work with NAOqi2.5.5)

Bring the box library into Choregraphe

Here, the sample box is published in the form of a box library. Please refer to the following for how to load the box library.

http://qiita.com/Atelier-Akihabara/items/db907ed319b8af0984db#%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%81%BF

Sample box description

I will give an overview of the four sample boxes

Simple HTTP request box

A box that issues an HTTP request. The result is output in the box output onStopped. Request URL set in properties

Connection example: Access http://mysrv.com/ and Pepper speaks the contents 変数をSimple_HTTP_requestに設定_と_Untitled_-_Choregraphe.jpg

Upload file box

A box that issues an HTTP request and sends the file specified in the properties to the request URL. The response from the server is output to the output output of the box.

Connection example: Send the file image.jpg in the project to http: // srv / image. Pepper speaks response from server 変数をUpload_fileに設定_と_Untitled_-_Choregraphe.jpg

Download File Box

A box that issues an HTTP request and saves the response from the server in the file specified in the properties. The path of the saved file is printed in the box's onStopped output.

Connection example: Access http: // mysrv / voice. Save the result in a file called voice.wav. Play in the Play Sound File box

変数をDownload_Fileに設定_と_Untitled_-_Choregraphe.jpg

WebSocket box

A box for making WebSocket connections. Set the property Server URI to the URI to connect to in the format ws: //. The onStart input call establishes a connection with the server. Send a message to the server by sending a string to the sendMessage input, the onMessage output will output the message from the server.

Connection example: WebSocket connection to ws: // wssev / ws. The Speech Reco box sends the voice-recognized content to the server and utters a message from the server.

変数をWebSocketに設定_と_Untitled_-_Choregraphe2.jpg

Preparatory work to use the box in your own project

The Simple HTTP request, Upload file, and Download File boxes each use the requests module. The requests module is installed on Pepper itself, but not on the virtual robot. To make these boxes available to virtual robots, go to the directory of your Choregraphe project under development and run the following recommendations:

virtualenv env
./env/bin/pip install requests --target lib --no-compile

The WebSocket box uses the websocket-client module. The app that handles the WebSocket box will go to the Choregraphe project directory, run the following recommendations, and load the required modules into the project.

virtualenv env
./env/bin/pip install websocket-client --target lib --no-compile

** After completing the above work, you should have created a folder called env and a folder called lib. Of these, the env folder is a file that is not needed for the project, so delete it after completing the above preparation work. (Since the file under this is large, if you open Choregraphe with this folder left, Choregraphe will freeze when reading the file,) **

Example:

rm -r env

Finally

I introduced a box that seems to be useful for development in hackathons. I hope it will be useful for prototyping development.

Recommended Posts

4 boxes that might be useful for the Pepper hackathon
The story of Django creating a library that might be a little more useful
[Python] It might be useful to list the data frames
About the matter that the re.compiled object can be used for the re.match pattern
A collection of resources that may be useful for creating and expanding dotfiles
Functions that can be used in for statements
A program that searches for the same image
The problem that the ifconfig command cannot be used
Overview and useful features of scikit-learn that can also be used for deep learning
Workaround for the problem that UTF-8 Japanese mail cannot be sent with Flask-Mail (Python3)