How to upgrade to Donkey Car 3.0 from Tawn’s repo
I have always been a fan of Tawn’s repo since I started Donkey Car. Recently Tawn joined the admin team and it looks like he has been committing primarily to the official repo. If you didn’t change anything in the source, you should just directly clone the latest version and follow the official guide to install donkey car on both your PC and Pi. If you are like me, changed some source and don’t want to merge them, read on.
Update the donkey car project source
First, change the working directory to your local donkey directory, e.g.
cd ~/project/donkey
Set autorope as upstream and sync
git remote add upstream https://github.com/autorope/donkey.git
Fetch the change
git fetch upstream
Merge the change
git merge upstream/master
Now if you have made any changes, it might look like this. You need to fix the conflicts first.
Fire up VSCode and the conflict will be shown to you right away. After you fix the conflict, leave it for now and don’t commit the change yet.
Upgrade the d2 directory
Looks like Tawn has also changed the convention from using ~/d2
to ~/mycar
as the path of the car app in 3.0. It’s up to you whether you want to stay with ~/d2
or follow the convention. To save trouble for compatibility later, I will switch to ~/mycar
. As I also did some changes on the ~/d2
directory, I track the change by using git. If you haven’t done that, do it now.
cd ~/d2; git init; git add .; git commit -m "init"
Normally we won’t share this git repo and so just leave it as a local. No need to push it unless you want to.
Next, use the following line to create a car app
donkey createcar --path ~/mycar
Copy the changes from mycar to d2. You may want to skip myconfig but I will just use review changes later on vscode
cp ~/mycar/*.py ~/d2
Fire up vscode again. Merge your change if necessary to the new code. Note that you may need to look for mycar
keyword in the newly generated files if you want to stay using ~/d2
as the car app directory.
# delete ~/mycar by rm -rf ~/mycar
mv ~/d2 ~/mycar
Recreate python environment
Since there are version changes in tensorflow and other library (presumably), we want to recreate the python environment. If you are using ubuntu, you can just follow the instructions below (copied from official doc).
conda env remove -n donkeyconda env remove -n donkey
conda env create -f install/envs/ubuntu.yml
conda activate donkey
pip install -e .[pc]
If you are using other OS, follow the official doc.
If you have a GPU installed, use tensorflow-gpu
conda install tensorflow-gpu==1.13.1
Test the installation on PC
There is a hidden camera class called ImageListCamera
, which is excellent for testing the donkey source code on PC without a real camera. We will use that to test our local PC install.
Open myconfig.py
under ~/mycar
, add this line
CAMERA_TYPE = "IMAGE_LIST" # (PICAM|WEBCAM|CVCAM|MOCK|IMAGE_LIST)
For the ImageListCamera
to work, you also need to provide a path to a tub of images you previously collected like this in myconfig.py
:
PATH_MASK = "~/mycar/data/tub_163_19-05-25/*.jpg"
Should be all good now, test it by runing
python drive manage.py
Fire up http://localhost:8887/drive and you should be seeing this screen
Test Training
python manage.py train --model models/mypilot.h5 --tub data/tub_163_19-05-25
I ran into this error.
tensorflow/stream_executor/cuda/cuda_dnn.cc:334] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
It seems to be a tensorflow issue and doing the following could fix it
export TF_FORCE_GPU_ALLOW_GROWTH=true
Put this into your bash profile so it won’t appear again.
That’s it. If you encounter other error when upgrading to 3.0, let me know by commenting below.