Please select the corresponding version of your computer to download
Select the file donkeycar-pi-buster-2023-08-01.zip from the server and download it .
Click the last item to select your system, and choose the system you just downloaded to burn.
Wi-Fi connection
We have installed the system, but without a monitor it is troublesome to link Wi-Fi through the graphical interface, so we add a configuration file to link Wi-Fi. donkeyCar stays connected wirelessly, which makes it easier for us to control it from the intranet.
Open the sdcard with DonkeyCar on your computer and copy the wpa_supplicant.conf file to the root directory of the sdcard.
Using a vscode text editor, open the wpa_supplicant.conf file.
Enter the Wi-Fi name in ssid (line 5)
Enter the Wi-Fi password in psk (line 6)
Click save after the modification is done, just put the system sd card into the cart and wait for the system to boot up the OLED screen will show the IP address.
OLED driver
In order to facilitate every time you start the cart does not need to connect to the monitor to check the IP, the IP address is displayed on the OLED, which is convenient for ssh direct connection. Because of the system update, the Docker virtual environment is used, so the driver configuration directory of the file has been changed, and the OLED will display garbled code because of the lack of driver configuration.
First use the cd command to return to the home page
cd
Use the git command to download the required screen driver from GitHub.
git clone https://github.com/Nabaixin/TFOLED.git
After the download is complete, we use ls to view all the files in the current directory.
At this point we will see a TFLOED folder, which is the driver we need.
ls
Now we need to replace the original driver with ours, sudo to extract, cp -p to copy, followed by the directory where we want to paste the files.
Wait 30 seconds, the driver configuration is normal, the OLED screen is no longer splash screen, it has been displayed normally!
Start the cart
Login to the background of the trolley
First of all, we open the browser, according to the IP of the trolley, enter the corresponding IP in the address bar of the browser, and remember to add port8888 after the IP address.
Example: My IP login address is 192.168.0.242:8888.
According to the IP address of your car, change it to the corresponding IP address.
The login password for the background is:
jupyter
After successfully logging in, you will see the dashboard, we need to use the file management and terminal
Create mycar
Open the terminal and perform the following steps
Copy the following command to create mycar
pi@docker-raspberrypi:~$ ls
pi@docker-raspberrypi:~$ donkey createcar
pi@docker-raspberrypi:~$ cd mycar/
Calibrate the car
As the car will be running when calibrating it, it is important to keep it up during the operation.
First perform the calibration and find the PWM range for the steering and throttle values.
The appropriate signal range for the cart is approximately 250-500.
Calibrate the throttle values
After the 373 values have been entered, turn on the motor switch of the cart.
Enter the IP of the cart + port 8887 in your browser to access it.
For example, my access address is 192.168.0.242:8887.
On the right side of the background camera screen is a touchpad to operate the cart, so you can run the cart happily!
If you want the car to run automatically, you need to run at least 10,000 pieces of data.
Data training
We have now completed a series of configuration files, has allowed the car to run, now we want to let the car through the camera to learn the driving route, so that the car through the data learning, to be able to run automatically.
ZIP learning data compression
First we go to the mycar folder
cd ~/mycar/
The learning data is saved in the data directory under the mycar folder, choose the most satisfactory data and delete the rest of the data, so as to ensure the accuracy of the data.
If there is a data.zip file in the past, use the rm command to delete it.
rm data.zip
Use the zip command to compress the data folder.
zip -r data.zip data/
Wait for the compression to complete and there will be a data.zip archive in the mycar folder
Learning through Colab (GPU);
We enter Colab and create a new .ipynb file, add the code list copy the code below and run it
Confirm Colab OS
!cat /etc/os-release
Uninstall existing CUDA
Since we don't know what's installed on the colab instance, it's okay to get an error here.
Install the same version of TensorFlow that is installed on DonkeyCar's RaspberryPi3. The default tensorflow/cuda/pip package version from Google Colab will be updated. Since Tensorflow does not maintain backward compatibility, Colab uses the same version of Tensorflow as the Raspberry Pi version of DonkeyCar's standard TensorFlow 1.13.1. Google Colab no longer supports Tensorflow 1.x, so it can no longer be found using pip. Therefore, we will install Tensorflow 1.13.1 using Miniconda.
Please perform a RESTART RUNTIME. The installed Tensorflow 1.13.1 will remain even after the restart. After the reboot, you can start from the next step.
Set CACHE_IMAGES to False. This is set to reduce memory consumption during learning. Comment out GYM_CONF["guid"]. As of 20200825, this appears to be enabled, as development takes place mostly in virtual tournaments, but is not necessary during learning.
Upload data.zip (learning data collected with DonkeyCar). How to upload data.zip to colab via browser and Upload data.zip to colab via Google Drive There are two ways. If the communication speed is too slow using the browser method, please try using the Google Drive method.
When uploading data.zip through a browser
Upload data.zip (learning data collected with DonkeyCar). When you run the following code, a file upload form will appear. The file is sent to /content/mycar/ and data.zip is being extracted. The directory structure of the dataset is /content/mycar/data/tub_1_xxxx.
Uploading data through your browser is very slow, so use it if you want to do it quickly through Google Drive. By executing the code below and authenticating yourself, you will be able to use the data.zip file uploaded to Google Drive via Google Colab.
from google.colab import drive
drive.mount('/content/drive')
!ls '/content/drive/My Drive' | grep data
Google Drive is installed in /content/drive/MyDrive. Copy the data.zip file to /content/mycar/ and extract it. If you uploaded to any folder in Google Cloud Drive, replace it with "/content/drive/MyDrive/any folder name/data.zip".
DonkeyCar is able to analyze a trained model and output it as a video. Check how well the trained model turned out. Since each model has completely different layers, makemovie can only be used for linear models.
Multiple tubs are not supported, so you must specify a data directory using the --tub=tub_xxxx option.
!ls /content/mycar/data
Select one of the displayed data directories and rewrite it as tub_xxxx. You can easily check if the directory does not have a large number of data items.
Downloads the created analysis video to your PC. You can check the response of the model by playing the downloaded video on your PC. Green line: Human operation. Blue line: AI judgment.
from google.colab import files
files.download('/content/mycar/'+mp4_path)
Migrating Learning Results
Learning results are saved in /content/mycar/models/mypilot.h5. Run the cell below and download the H5 file. Copy the learning results to ~/mycar/models/mypilot.h5 on the RaspberryPi and DonkeyCar will run automatically.
from google.colab import files
files.download('/content/mycar/models/mypilot.h5')
At this point already both files have been downloaded locally by the