Twirre Meulenbelt c634e4b516 chore: replace print with logging and make robot conditional
All print statements in the main program, and components used by the main program, have been replaced with appropriate logging statements. The connection to the robot now only gets made when it's possible, otherwise only the microphone will be run.

ref: N25B-119
2025-10-02 16:13:39 +02:00
2025-10-01 13:41:53 +02:00
2025-10-01 10:50:53 +02:00

Development environment

Linux (or WSL)

Start off by installing Pyenv and walk through the steps outlined there (be sure to also add it to PATH). Also install the Python build requirements. Afterwards, install Python 2.7 and activate it for your current shell:

pyenv install 2.7
pyenv shell 2.7

You can check that this worked by typing

python -V

Which should return Python 2.7.18.

Next, cd into this repository and create (and activate) a virtual environment:

cd <path to project>/
python -m pip install virtualenv
python -m virtualenv .venv
source .venv/bin/activate

To be able to install the PyAudio Python package, you'll need to have the portaudio system package installed. On Debian or Ubuntu:

sudo apt install portaudio19-dev

Then you can install the required packages with

pip install -r requirements.txt

Now we need to install the NaoQi SDK into our virtual environment, which we need to do manually. Begin by downloading the SDK:

wget https://community-static.aldebaran.com/resources/2.5.10/Python%20SDK/pynaoqi-python2.7-2.5.7.1-linux64.tar.gz

Next, move into the site-packages directory and extract the file you just downloaded:

cd .venv/lib/python2.7/site-packages/
tar xvfz <path to SDK>/pynaoqi-python2.7-2.5.7.1-linux64.tar.gz
rm <path to SDK>/pynaoqi-python2.7-2.5.7.1-linux64.tar.gz

Lastly, we need to inform our virtual environment where to find our newly installed package:

echo <path to project>/.venv/lib/python2.7/site-packages/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages/ > pynaoqi-python2.7.pth

That's it! Verify that it works with

python -c "import qi; print(qi)"

You should now be able to run this project.

MacOS

On ARM CPU's, pyenv doesn't want to install Python 2. You can download and install it from the Python website.

Create a virtual environment as described in the Linux section.

Then build portaudio for x86_64 CPU's.

Then follow the remaining installation instructions in the Linux section.

Running

Assuming you have the virtual environment activated (source .venv/bin/activate on Linux) and that you have a virtual robot running on localhost you should be able to run this project by typing

python main.py --qi-url tcp://localhost:<port>

where <port> is the port on which your robot is running.

Description
No description provided
Readme 240 KiB
Languages
Python 94.8%
Shell 5.2%