This guide provides instructions to set up the development environment for the Robotdog Movement project using Raspberrypi 5.
Before proceeding, ensure you have the following installed on your Raspberrypi 5:
- Python (suggest version: 3.12.7) ( Some packages don't work on python 3.13 or later version )
- Git
Note: Note: If not using Raspberry Pi 5, some hardware-related functions may not work properly, such as the Servo, Camera Module, and Gyroscope Module. In this case, only the .ipynb
files in the calculation/
folder can be used to demonstrate the computation process, while other hardware-related functionalities may not function as expected.
( A Linux OS is recommended )
sudo apt update && sudo apt upgrade -y
sudo apt install libcamera-dev python3-picamera2
sudo raspi-config
Find i2c-interface and choose 'Enable', then restart to apply setting
sudo reboot
Clone the project from the Git repository to your local machine:
git clone https://github.com/tjjd4/robotdog-movement.git
cd robotdog-movement
Need system site packages for camera modules ( picamera2 )
python -m venv --system-site-packages .venv
Once activated, your terminal prompt should display the virtual environment name, e.g., (.venv)
.
Modify the venv/bin/activate
file to include the project root in PYTHONPATH
. Add the following lines after export PATH
:
...
export PATH
# Add the commands bellow
PYTHONPATH="$VIRTUAL_ENV:$PYTHONPATH"
export PYTHONPATH
...
Install the required Python packages using the requirements.txt
file:
source .venv/bin/activate
pip install -r requirements.txt
To verify everything is working:
-
Activate the virtual environment:
source .venv/bin/activate
-
Run a script (e.g.,
test_kinematics.py
) to ensure no errors occur:python test/test_kinematics.py
If everything is configured correctly, the script should execute without issues.
- Ensure you activate the virtual environment in every new terminal session before running the scripts.
- If additional dependencies are added to
requirements.txt
, re-runpip install -r requirements.txt
to install them. - If
PYTHONPATH
not set which lead toModuleNotFoundError
, enterexport PYTHONPATH=$(pwd)
to set thePYTHONPATH
toproject_root
(Need tocd
to repo).