liyuan128 / 1092_YZU_Machine_Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1092_YZU_Machine_Learning

Steps of donkey car

In this part we will start from how to install packages to training neural network as well as how to utilize this tool.

The following tutorial is based on Linux Ubuntu system

The official website of donkey car: https://docs.donkeycar.com/

Install Software On Donkeycar

First, open derminal and install miniconda as well as clone the donkey project

$ mkdir project
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ bash ./Miniconda3-latest-Linux-x86_64.sh
$ cd project
$ mkdir donkeycar

Get the latest donkeycar from Github

$ git clone https://github.com/autorope/donkeycar
$ cd donkeycar
$ git checkout master

If this is not your first install, update Conda and remove old donkey

$ conda update -n base -c defaults conda
$ conda env remove -n donkey

Create the Python anaconda environment

$ conda env create -f install/envs/ubuntu.yml
$ conda activate donkey
$ pip install -e .[pc]

Optional Install Tensorflow GPU - only for NVidia Graphics cards!!!

$ conda install tensorflow-gpu==2.2.0

Install donkey car simulator

https://docs.donkeycar.com/guide/simulator/

Install

$ cd
$ cd project
$ git clone https://github.com/tawnkramer/gym-donkeycar
$ cd gym-donkeycar
$ conda activate donkey
$ pip install -e .[gym-donkeycar]

You may use an existing ~/mycar donkey application, or begin a new one. Here we will start fresh:

$ donkey createcar --path ~/mysim
$ cd ~/mysim

Edit your myconfig.py to enable donkey gym simulator wrapper, replace and the other parts of the path:

$ DONKEY_GYM = True
$ DONKEY_SIM_PATH = "/home/<user-name>/projects/DonkeySimLinux/donkey_sim.x86_64"
$ DONKEY_GYM_ENV_NAME = "donkey-generated-track-v0"

Start driving to collect training data

xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Train Neural network

xxxxxxxxxxxxxxxxxxxxxxxxxxxx

How to use pre-trained model to simulate the donkey car

Please first go to the directory of mysim and use the virtue environment

$ python manage.py drive --model= /home/xxxxxbase on your the directory of your model

It will pop up the screen of the simulator.

Open your browser( Here I use is Google Chrome), and type

$ <IP address of host PC>:8887

Below is the screen of the browser

Please choose Local Pilot in Mode and Pilot. It will start to run automatically.

About