DonkeyCar for Pi-Setup Raspberry Pi
From Waveshare Wiki
Guide of DonkeyCar
- Setup Raspberry Pi
- Setup Linux PC
- WEB Control
- Calibrate DonkeyCar
- Teleoperation
- Data Collection
- Train Data
- Auto-Driving
- WiKi of PiRacer Pro | WiKi of PiRacer
Step 1. Update System
- Flash the Bookworm version image.
Assuming your Raspberry Pi is already installed with the image and has started up. And the WiFi is connected, SSH is enabled, the I2C interface is started, and the file system is expanded.
- Update the system
sudo apt-get -y update sudo apt-get -y upgrade
Step 2. Setup Virtual Environment
python3 -m virtualenv -p python3 env --system-site-packages echo "source env/bin/activate" >> ~/.bashrc source ~/.bashrc
Modifying the .bashrc in this way will automatically enable this virtual environment each time you log in. To return to the system Python, you can enter deactivate.
Step 3. Install Dependency Libraries
sudo apt install libcap-dev libhdf5-dev libhdf5-serial-dev
Step 4. Install Donkeycar Python Code
- Create a project directory
mkdir projects cd ~/projects
- Get the latest donkeycar program from GitHub
git clone https://github.com/waveshareteam/donkeycar cd donkeycar git checkout master pip install -e .[pi]
Step 5. Install OLED Display Service
Run the following command to install the OLED display service. OLED will display information such as the current IP address, battery voltage, charging current, etc.
cd ~ git clone https://github.com/waveshare/pi-display cd pi-display sudo ./install.sh
Step 6. Create Donkeycar from Template
- Use the following command to create a donkeycar instance
cd ~/projects/donkeycar donkey createcar --path ~/mycar
After the program runs, a series of files to control donkeycar will be automatically generated in the ~/mycar directory.