PepperWizard is a Python-based application for teleoperating the Pepper robot. It provides a command-line interface to enable teleoperation via a DualShock controller, as well as to trigger speech, animations, and other actions.
- Modern Bridge Architecture: Integrates with
PepperBoxto wrap the legacy Python 2.7 / NAOqi SDK in a Docker container, allowing you to write modern Python 3 code. - Fully Dockerised: Zero-configuration setup suitable for rapid deployment and reproducibility in HRI labs.
- Joystick Teleoperation: Control the robot's movement in real-time using a DualShock controller via Dualshock-ZMQ.
- Intelligent Talk Mode: A unified interface for speech and animation, featuring slash-command autocomplete, spellcheck, and emoticon animation triggers.
- Experimental Logging: Timestamped JSONL logging of all interactions.
- Interactive TUI: A minimal menu-driven terminal interface using
prompt_toolkit. - Social State Control: Toggle the robot's autonomous social behaviors.
- Battery Status: Check the robot's current battery level.
The PepperWizard system is composed of three main services orchestrated by docker-compose.yml:
pepper-robot-env: This service runs a Python 2.7 environment and a "shim server" to act as a bridge to the Pepper robot's native NAOqi OS. This is necessary because the robot's core libraries use Python 2.7.dualshock-publisher: This service reads input from a connected DualShock controller (/dev/input) and publishes the data to a ZeroMQ message queue.pepper-wizard: This is the main application, written in Python 3. It subscribes to thedualshock-publisher's ZeroMQ messages for teleoperation and provides the interactive CLI for the user. It communicates with thepepper-robot-envservice to send commands to the robot.
The pepper-wizard application itself is structured as follows:
main.py: The main application entry point.robot_client.py: A client class that handles all direct communication with the robot.teleop.py: Manages the teleoperation (joystick) logic in a separate thread.command_handler.py: Maps user commands to specific actions.cli.py: Handles all command-line interface (UI) elements.config.py: Loads configuration files.
- Docker
- Docker Compose
- A DualShock controller connected to the host machine.
OS Compatibility: This project currently requires Linux. It utilises
network_mode: hostand direct device access (/dev/input) for the controller, which are not natively supported by Docker Desktop on Windows or macOS.
Note: This project depends on the
jwgcurrie/pepper-boxDocker image for the Naoqi bridge. Docker Compose will automatically pull this publicly available image. The source code for the bridge environment will be released separately.
The connection to the robot (or simulator) is configured via the robot.env file. This file interacts with the pepper-robot-env service, which acts as a bridge.
-
Create or edit
robot.envin the root directory:NAOQI_IP=127.0.0.1 NAOQI_PORT=39961
-
Configuration Scenarios:
- Simulated Robot (Choregraphe):
- Ensure your simulator is running.
- Set
NAOQI_IP=127.0.0.1. - Set
NAOQI_PORTto your simulator's port (e.g.,39961).
- Physical Robot:
- Set
NAOQI_IPto the robot's IP address (e.g.,192.168.1.101). - Set
NAOQI_PORT=9559(default NAOqi port).
- Set
- Simulated Robot (Choregraphe):
-
Clone this repository.
-
Build and run the services using Docker Compose:
docker compose up -d --build
This starts the background services (
pepper-robot-envanddualshock-publisher).Development & Dependencies: (for now) this project mounts external SDKs via Docker volumes to share code between services.
../PepperBox/py3-naoqi-bridge->/usr/src/PepperBox/py3-naoqi-bridge../PepperPerception->/usr/src/PepperPerception
These paths are added to
PYTHONPATH, allowingpepper-wizardto import modules likeclients.vision_clientdirectly fromPepperBox. Ensure your directory structure matches this layout (i.e., sibling directories). -
Run the Wizard: Launch the interactive CLI:
docker compose run --rm -it pepper-wizard
Once the application is running, you can enter commands into the terminal.
The application uses an interactive selection menu.
- Arrow Keys (
↑/↓): Navigate selection. - Enter: Confirm selection.
Select Action:
> Unified Talk Mode
Joystick Teleop
Toggle Social State
Set Tracking Mode
Wake Up Robot
Rest Robot
Gaze at Marker
Check Battery
Exit Application
When in Unified Talk Mode, you can speak sentences and trigger animations:
As you type, the system checks your grammar. If a correction is found:
- Interactive UI: You will see a prompt like
Pepper (Suggestion) [tag]:. - Tab-Toggle: Press
[Tab]to switch between the Suggestion (Cyan) and your Raw Input (White). - Confirm: Press
[Enter]to confirm the selected text.
Type / at any time to see a menu of available commands and animations.
- Context Aware: Works at the start of a line or mid-sentence (e.g.,
Hello /). - Tags: Includes full animation tags (e.g.,
/happy,/bow). - Safety: Only triggers when you explicitly type
/, preventing accidental activations.
-
Plain Speech: Enter any text.
-
Emoticon-Triggered Animation: Include a recognized emoticon (e.g.,
:),XD). -
Hotkey-Triggered Blocking Animation: Include a hotkey (e.g.,
/N,/Y). -
Tag-Triggered Animation: Use the autocomplete menu to select a tag (e.g.,
/happy). -
/help- Show contextual help for the talk mode. -
/q- Quit talk mode and return to the main menu.
You can customise some of the robot's behaviors by editing the JSON files:
animations.json: Maps animation names to single-character keys. These tags are used internally and byemoticon_map.json.emoticon_map.json: Maps emoticons (e.g.,:),:() to animation names (e.g.,happy,sad). This allows for dynamic animation triggering in Unified Talk Mode.quick_responses.json: Defines phrases and animations that can be triggered by hotkeys (e.g.,/N) in the Unified Talk Mode. Theanimationfield in each entry is used to determine which animation to play.
PepperWizard includes a logging system that captures robot interactions, user commands, and application events.
Logs are automatically saved to the logs/ directory in JSON Lines (JSONL) format.
- Default Naming: Log files are automatically timestamped:
logs/session_YYYY-MM-DD_HH-MM-SS.jsonl - Custom Session ID: You can specify a custom session ID to create a specific filename (e.g.,
logs/session_P01.jsonl):docker compose run --rm -it pepper-wizard python3 -m pepper_wizard.main --proxy-ip host.docker.internal --proxy-port 5000 --session-id P01
By default, the console output is minimal, only showing critical warnings or errors.
- Verbose Mode: To see all logs (INFO/DEBUG) in the console in real-time, use the
--verboseflag:docker compose run --rm -it pepper-wizard python3 -m pepper_wizard.main --proxy-ip host.docker.internal --proxy-port 5000 --verbose
To verify PepperWizard end-to-end, run the automated integration test. This simulates a full user session (connecting to the robot, speaking, moving, etc.) and verifies the log output. It is recommended to run this in simulation in case your robot accidentally runs into a wall.
docker compose run --rm pepper-wizard python3 tests/integration_test.pyThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
