Install Software on Donkey Car

Step 1: Flash Operating system

  1. Download Raspian Lite(Stretch) (352MB).
  2. Follow OS specific guides here.

Step 2: Setup the WiFi for first boot

  1. Host mobile hotspot from your pc.
  2. Make a new notepad file. Open it and paste this code: country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="<your network name>" psk="<your password>" }
  3. Replace <your network name> with the ID of your network. Leave the quotes. I’ve seen problems when the network name contained an apostrophe, like “Joe’s iPhone”. Replace <your password> with your password, leaving it surrounded by quotes. If it bothers you to leave your password unencrypted, you may change the contents later once you’ve gotten the pi to boot and log-in.
  4. Save this file to the root of boot partition with the filename wpa_supplicant.conf. On first boot, this file will be moved to /etc/wpa_supplicant/wpa_supplicant.conf where it may be edited later. If you are using Notepad on Windows, make sure it doesn’t have a .txt at the end.

Step 4: Enable SSH on Boot

    null
  1. Put a file named ssh in the root of your boot partition.

Now your SD card is ready. Eject it from your computer, put it in the Pi and plug in the Pi.

Step 5: Connecting to the Pi

  1. Find your raspberry pi’s IP from connected devices in mobile hotspot setting.
  2. Then run this code in terminal : ssh pi@your.pi's.ip.address
  3. The default password is: raspberry

Step 6: Update and Upgrade

  • Run these codes to update your RP:

sudo apt-get update
sudo apt-get upgrade

sudo reboot

Step 7:Install Dependencies

  1. Run this code : sudo apt-get install build-essential python3 python3-dev python3-pip python3-virtualenv python3-numpy python3-picamera python3-pandas python3-rpi.gpio i2c-tools avahi-utils joystick libopenjp2-7-dev libtiff5-dev gfortran libatlas-base-dev libopenblas-dev libhdf5-serial-dev git
  2. Then this : virtualenv env --python=python3
  3. Activate the environment: source env/bin/activate

Step 8: Car Template

  1. git clone https://github.com/autorope/donkey2.git
  2. cd donkey2
  3. pip install -r drive_requirements.txt

Finally step: Drive your car

  1. Run: python drive.py
  2. This script will start the drive loop in your car which includes a part that is a web server for you to control your car. You can now control your car from a web browser at the URL: <your car's IP's address>:8887

Helpful driving tips:

Driving with Web Controller

On your phone you can now press start to set your phones current tilt to be zero throttle and steering. Now tilting your phone forward will increase throttle and tilting it side to side will turn the steering.

Features

  • Recording – Press record data to start recording images, steering angels and throttle values.
  • Throttle mode – Option to set the throttle as constant. This is used in races if you have a pilot that will steer but doesn’t control throttle.
  • Pilot mode – Choose this if the pilot should control the angle and/or throttle.
  • Max throttle – Select the maximum throttle.

Keyboard shortcuts

  • space : stop car and stop recording
  • r : toggle recording
  • i : increase throttle
  • k : decrease throttle
  • j : turn left
  • l : turn right