Skip to content

Instantly share code, notes, and snippets.

@enobufs
Last active October 28, 2018 03:13
Show Gist options
  • Save enobufs/111ee06d3ed31e61446b6b09edc6a5ef to your computer and use it in GitHub Desktop.
Save enobufs/111ee06d3ed31e61446b6b09edc6a5ef to your computer and use it in GitHub Desktop.
Donkey Car: Operation notes

WiFi connection

Adding WiFi access point

  1. Hook monitor and keyboard via HDMI and USB cables.
  2. Login with username, "pi", and its password.
  3. sudo vi /etc/wpa_supplicant/wpa_supplicant.conf, then add network={} with your SSID and password (you can have more than one network section).
  4. sudo wpa_cli -i wlan0 reconfigure
  5. Note the MAC address for wlan0. (Later used to identify IP address from your laptop)

Find the IP address from your laptop

  1. Use ifconfig to learn your subnet broadcast address (e.g. 10.0.0.255)
  2. Run ping <subnet-broadcast-address>, e.g, ping 10.0.0.255. (Note: this will update your ARP table, used next)
  3. Run arp -r, which will show you a list of IP address - MAC address mapping.
  4. Find the IP address associated with its MAC address from the list.

NOTE: Above may not work in some environment.

Assign hostname to RPi

Install mDNS

sudo apt-get update
sudo apt-get install avahi-daemon

Modify its host name

sudo vim /etc/hostname
<a-unique-name-in-your-local-network>.local

Then, save it. Now, your RPi can be accessed from other hosts in the same local network by the host name. Try:

ping <a-unique-name-in-your-local-network>.local

from your laptop or PC.

Installing donkeycar

Since donkeycar v2.5.1, it can be installed from PyPi as shown below:

pip install tensorflow==1.8.0
pip install donkeycar==2.5.1
donkey createcar --template donkey2 ./mycar
 :

How to enable GPU for training (Tested only with Linux with CUDA installed)

Install tensorflow-gpu

pip install tensorflow-gpu==1.8.0

Install donkeycar

pip install donkeycar[tf_gpu]==2.5.1

Create "mycar"

donkey createcar --template donkey2 ./mycar

Finally, copy data, then train the model

cd mycar
# Copy your input data into "./data/<my_data_folder>/."
python ./manage.py train --tub data/<my_data_folder_name>/ --model ./models/<my_data_folder_name>

Joystic (PS3) Controller

Operation

  • Left sitck: steering
  • Right stick: throttle
  • Circle: Enable/disable recording (When cfg.AUTO_RECORD_ON_THROTTLE is False)
  • Triangle: Increase max throttle setting by 0.01
  • Cross: Decreease max throttle settting by -0.01
  • Base: Increase thrrotle scale by 0.05
  • Top2: Decrease thrrotle scale by 0.05
  • DPad up => increase throttle scale
  • DPad right => decrease throttle scale
  • DPad left => increase steering scale
  • DPad right => decrease steering scale
  • Select => switch modes
  • Start => toggle constant throttle
  • base5 = PS3 left trigger 1
  • base3 = PS3 left trigger 2
  • base6 = PS3 right trigger 1
  • base4 = PS3 right trigger 2
  • thumb2 = PS3 right thumb
  • thumb = PS3 left thumb

Other

You can pip install tensorflow version 0.11.0, 1.8.0, 1.9.0 and later on RPi

It's not just with 1.9.0!

$ pip install tensorflow==
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tensorflow==
  Could not find a version that satisfies the requirement tensorflow== (from versions: 0.11.0, 1.8.0, 1.9.0)
No matching distribution found for tensorflow==

Issue with timestamp

With v2.5.1, timestamps in those json file stored under tub is null. I have added the following code to manage.py as a quick fix:

import datetime
  :
    #clock = Timestamp()
    #V.add(clock, outputs='timestamp')

    def get_timestamp():
        return str(datetime.datetime.utcnow())

    clock = Lambda(get_timestamp)
    V.add(clock, outputs=['timestamp'])

Make sure you have datetime model. pip install datetime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment