I am creating an application on Pepper for the Pepper Innovation Challenge (JP only) this month. The goal is for Pepper to survey people and submit the answers to a server.
Using Google Forms
In order to make it easy to create the survey and check the answers, I chose to use Google Forms. So basically the application will be a new interface to submit survey results to Google Forms: Pepper will be asking the questions.
While Google has Python APIs for many services, they don't seem to cover Google Forms yet. Instead, I went for an easy route: I read the form page and find the questions in the page. Then I submit the results using the same POST request as the webpage would.
I found the idea on Reddit here.
All the stuff about reading and submitting Google Forms is really not specific to Pepper. I am not the first one to ask the question either (the question on Reddit had 50 up-votes). So once I wrote the code, I packaged it into a PyPI library: PyGoogleForm!
It's my first submission on PyPI so I'm pretty proud. If a few people download it and test it, I'd be so happy!
The package only handles the "basic" question types (radio boxes, select, checkboxes, text and paragraph text) for now. It's enough to make basic surveys.
It's Open-Source with permissive MIT License (do whatever you want with it). The code is live on the PyGoogleForm Github project.
Submitting the package to PyPI was a frustrating experience, mostly because I had issues translating the Github README.md file into an rst description. Turns out Pandoc doesn't handle code blocks inside bulleted lists for rst documents...
Also, I find it annoying to always have to bump the version in the setup.py (in 2 places), and add the same tag to the project, then registering and uploading the package to PyPI. I should script the whole thing so that I don't forget a step.
Python Libraries in Pepper Apps
I have already created a simple qiMessaging service to handle the Dialog on the robot. It's not online yet. The final part is to create the tablet interface.
This process for using a web service on Pepper is pretty common.
- the client wants to use a web API for their app (here Google Forms)
- implement a small Python library that allows to use the web API in a simple Pythonic way (like my PyGoogleForm)
This library is reusable for any other Python project.
- implement a wrapper for NaoQI: the wrapper uses qiMessaging to communicate with other robot services, and interacts with the different interfaces of the robot (Dialog, Tablet, motions, ...)
I will go into more details on this process in the tutorials to follow.
To see how I use PyPI in my Pepper app projects, you can check the PepperWiki project on Github.