A pupper robot puzzle-maze game to help the human player learn and retain concepts about a topic by quizzing them on the way!
Because this project uses external Python libraries (like sounddevice and Pillow) that are not standard ROS 2 packages, you must install them and activate your virtual environment before running the nodes.
If you are deploying this to the physical robot (or a fresh Ubuntu install), you must install the underlying C-libraries required by sounddevice for audio playback:
sudo apt-get update
sudo apt-get install libportaudio2 libsndfile1Before you build the workspace or run any nodes, you must activate your Python virtual environment and install the required packages. Run this from the root of your pupper-potter repository:
# Switch to git directory (on Robot)
cd ~/ros2_ws/src
# Create a new virtual environment
python -m venv .venv
# Activate the virtual environment
source .venv/bin/activate
# Install all required Python packages
pip install -r requirements.txt(Note: You must run source .venv/bin/activate in every new terminal before running ros2 run so that the nodes have access to these libraries!)
Build the workspace to ensure all Python scripts, JSON databases, and audio files are copied to the install directory. Run these commands from the root of the ROS 2 workspace ~/ros2_ws:
**First open a new terminal - not the same one where the virtual env was activated**
# Switch to ros2 root directory
cd ~/ros2_ws
# If not already done, first build these open source pacakges
colcon build --packages-up-to mini_pupper_bringup
colcon build --packages-up-to mini_pupper_dance
# Build the custom interfaces package
colcon build --packages-select pupper_interfaces
# Build the main package
colcon build --packages-select triwizard_pupperOpen the following separate terminals - one terminal for running every node
# Switch to ros2 root directory
cd ~/ros2_ws
# Source the newly built files
source install/setup.bash
# Launch the pupper node
ros2 launch mini_pupper_bringup bringup.launch.py# Switch to ros2 root directory
cd ~/ros2_ws
# Source the newly built files
source install/setup.bash
# Activate the virtual environment
source src/.venv/bin/activate
# Launch the game controller node
ros2 run triwizard_pupper game_controller# Switch to ros2 root directory
cd ~/ros2_ws
# Activate the virtual environment
source .venv/bin/activate
# Source the newly built files
source install/setup.bash
# Launch the navigation controller node
ros2 run triwizard_pupper nav_controller# Switch to ros2 root directory
cd ~/ros2_ws
# Activate the virtual environment
source src/.venv/bin/activate
# Source the newly built files
source install/setup.bash
# Launch the touch detector node
ros2 run triwizard_pupper touch_detector# Switch to ros2 root directory
cd ~/ros2_ws
# Activate the virtual environment
source .venv/bin/activate
# Source the newly built files
source install/setup.bash
# Launch the puzzle service node
ros2 run triwizard_pupper puzzle_serviceAfter launching all the nodes above, open another terminal
# Switch to git directory
cd ~/ros2_ws/src
# Pull latest repo
git pull --rebase origin master
# Checkout new testing branch
git checkout -b your-new-test-branch
# Perform testing here
# Make code changes if needed
# Do not push test-time users database changes to git. Run the following before committing
git restore database/users.json
# Commit to git
git add .
git commit -m "Custom message"
git push origin your-new-test-branchTo generate audio files from text scripts, this project uses Piper TTS.
Activate your virtual environment and install Piper TTS (if not already installed via requirements.txt):
source .venv/bin/activate
pip install piper-ttsIf you are running this on an Apple Silicon Mac, you will likely encounter an Error processing file... phontab: No such file or directory error when generating audio. This is due to a hardcoded path in the pre-compiled macOS Python package.
To fix it, run these two commands to create a symlink pointing to the correct data folder inside your virtual environment (you will be prompted for your Mac password):
sudo mkdir -p /Users/runner/work/piper1-gpl/piper1-gpl/_skbuild/macosx-11.0-arm64-3.9/cmake-build/espeak_ng-install/share/
sudo ln -s "$PWD/.venv/lib/python3.14/site-packages/piper/espeak-ng-data" /Users/runner/work/piper1-gpl/piper1-gpl/_skbuild/macosx-11.0-arm64-3.9/cmake-build/espeak_ng-install/share/espeak-ng-data(Make sure to run this from the root of the pupper-potter repository).
Use the provided Python script to generate audio from a text script. The script takes the text file path, the model name, and the output filename as arguments. It automatically expects the model to be located in audios/downloaded_voices/<model_name>.
python scripts/convert_text_to_speech.py \
--text_file config/speech_scripts/puzzle_point_1_welcome_script.txt \
--model_name en_GB-alan-medium \
--output_file puzzle_point_1_welcome_audio_file.wavThis will save the resulting audio file to audios/puzzle_point_1_welcome_audio_file.wav.