Backend for Pepper robot
Project description
cltl-backend-naoqi
NaoQI Backend for the Pepper Robot.
Functionality
This repository provides a Docker container that runs an web server that supports connections of the client sources
provided in the cltl.backend.source.client_source
module of the
Leolani Backend.
The docker image provides endpoints for Audio, Images and connects to the robot through TCP to retrieve and send signals.
Audio
The container exposes an endpoint at /audio
(GET) that provides an audio stream. The format of the stream is indicated
by the mine type indicated in the response. Currently, this will be chunked audio data with mime type audio/L16
, i.e.
raw 16bit audio. In the mime type header, additional parameters for rate
, channels
and frame_size
are provided.
Images
The container exposes an endpoint at /image
(GET) that provides an image captured at invocation time. The endpoint
returns a JSON object corresponding to
cltl.backend.api.camera.Image
that contains the raw image data, the image dimensions and depth information. Image dimensions are also inlcude in the
mime type header of the response.
Build the backend Docker container
To build the docker image run
make build
This will create a docker image with tag cltl-backend-naoqi
. To verify the build was successful run
make test
Run the backend on the robot
WIP
To run the backend directly on the robot we need to install the cltl.backend-naoqi
package with its dependencies on the robot, make sure the ports of the web server are
open and ensure the backend is started when the robot starts.
Package installation
On pepper a rather old Python version is installed, which causes issues with pip. Also,
root access of the nao
user
is restricted. pip
can still be upgraded for the user using (run in a separate directory)
wget https://files.pythonhosted.org/packages/ca/1e/d91d7aae44d00cd5001957a1473e4e4b7d1d0f072d1af7c34b5899c9ccdf/pip-20.3.3.tar.gz
pip install --user pip-20.3.3.tar.gz
Since we do not want to interfere with the Python environment on pepper we
install the package in a virutal environment. For the installation the scripts/install_libs.sh
is provided. Copy it to the robot and execute it. This will create a virtual environment,
download the necessary packages and install them.
Running the backend
To run the backend we need to find an unused port that can be used by the web server and make sure the firewall on Pepper allows access it.
Once the package is installed it can be run with
source venv/bin/activate
python -m cltl.naoqi --naoqi-ip 127.0.0.1
This is also provided in the scripts/run_backend_naoqi.sh
script.
Run at startup
NaoQi startup is described here. We need to figure out a way run the backend at startup.
Run the backend Docker container
At the current moment the instructions below only work on LINUX, as the --network host
option for Docker is only available on LINUX and some services registered with the qi framework
are not visible to the ALAudioDevice Module when we run inside the Docker container with
a bridge network.
To run the docker image use:
docker run --rm -it -e CLTL_NAOQI_IP="192.0.0.1" --network host cltl/cltl-backend-naoqi
It is mandatory to provide the IP of the Pepper robot in the CLTL_NAOQI_IP
environment variable. Further
configurations can be set through environment variables, for a list run
docker run --rm -it cltl/cltl-backend-naoqi python -m cltl.naoqi --help
Test if the backend is working
WIP
To test if the backend is working we can curl the REST API of the backend
curl <backend ip>/video
curl <backend ip>/audio
curl --data "Hallo Stranger!" <backend ip>/text
Unit test
The unit tests in this repository require the NAOqi SDK and Python 2.7 to be installed. They are, however, included in the Docker image provided by this repository and can be run with:
make build
docker run --rm -it cltl/cltl-backend-naoqi python -m unittest discover
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more
information.
Authors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for cltl.backend-naoqi-0.0.dev6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e0b7226d3a6fc6faf1acb2aa438b15c072eca21dddb284e7447a05bbc6f1bf7 |
|
MD5 | 499062f54b4ee29d280dbe2d40b7508c |
|
BLAKE2b-256 | 3b442223212f769c93275fab5e923b11d8c324831457b964dfffc915c30f8e65 |