DonkeyCar for JetRacer ROS Tutorial II: Setup Linux PC

From Waveshare Wiki
Jump to: navigation, search

DonkeyCar for JetRacer ROS Tutorial

Note: DonkeyCar is already installed by default if you use our configured image, no need to install it again, just skip this tutorial.

Install Miniconda

  • Install Ubuntu 18.04 LTS by default, and it can be installed on a virtual machine.
  • Open a terminal and install miniconda Python 3.7 64 bit.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh

  • Note: During the installation process, you will be prompted to initialize the conda environment. As the default setting is No, you need to change it to Yes, otherwise there is no conda environment when you open the terminal.
  • Note: After the installation is complete, you need to open a new terminal to enter the conda environment and then perform the following operations, otherwise it will prompt that the conda command was not found.

Install Donkeycar

  • Create project
mkdir projects
cd projects
  • Get the latest stable version of DonkeyCar source installation from Github
git clone https://github.com/autorope/donkeycar
cd donkeycar
git fetch --all --tags
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latestTag
  • If you are not the first time to install, you must update Conda and delete the old donkey. If you are the first time installing, you can skip this step.
conda update -n base -c defaults conda
conda env remove -n donkey
  • Create Python anaconda environment.

It is recommended to install in the following way, the installation time is faster.

conda install mamba -n base -c conda-forge
mamba env create -f install/envs/ubuntu.yml
conda activate donkey
pip install -e .[pc]

If the above method fails to install, you can use the following method to install, and the installation time is slower.

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

Create Donkey Examples

  • Create a local working directory
donkey createcar --path ~/mycar

After the program runs, a series of files to control donkeycar will be automatically generated in the ~/mycar directory.

Virtual Environment

*Note: The newly opened terminal enters the conda base environment by default. Running the ROS program in this environment will cause an error. You need to run the following command to set the base environment not to start by default.

conda config --set auto_activate_base false

*Note: After that, all donkeycar operations need to be performed in the donkey virtual environment. After opening a new terminal, you need to run the following command to re-enter the donkey virtual environment before operating.

conda activate /home/jetson/miniconda3/envs/donkey