Difference between revisions of "OHMC2019 Software instructions"

From Open Hardware Miniconf
Jump to: navigation, search
(Software installation: Raspberry Pi)
(Driving the car manually)
Line 66: Line 66:
  
 
== Driving the car manually ==
 
== Driving the car manually ==
 +
 +
'''Caution: Put your car "on blocks" (wheels off the ground) the first time you try driving it'''
 +
 +
IP_ADDRESS=xxx.xxx.xxx.xxx  # Found as above
 +
 +
* ssh pi@$IP_ADDRESS
 +
* cd ohmc_car
 +
* python manage.py drive
 +
 +
  loading config file: /home/pi/play/roba_car/config.py
 +
  config loaded
 +
  PiCamera loaded.. .warming camera
 +
  Starting Donkey Server...
 +
  You can now go to http://xxx.xxx.xxx.xxx:8887 to drive your car.
 +
 +
With a desktop web browser, the user interface provides a virtual joystick (right-hand frame) that you can use to drive the car ... altering the steering and throttle values.
 +
 +
The mobile web browser, the user interface allows you to drive by tilting the phone left-right for steering and forwards-backwards for throttle.  For safety, you must press the [Start Vehicle] / [Stop Vehicle] toggle button to enable control.
  
 
== Data acquisition for the Neural Network ==
 
== Data acquisition for the Neural Network ==

Revision as of 22:38, 20 January 2019

Overview

From a software perspective, the DonkeyCar (Raspberry Pi) is self-contained ... driving, data acquisition (for training) and ultimately self-driving are all performed with on-board software. The provided micro-SD card already has all the required software pre-installed, as well as two pre-training A.I / Machine Learning models. The DonkeyCar software includes a web-server that provides a web interface that works on both desktop and mobile web browsers (great for driving).

Your laptop will be required to perform training of the Neural Network ... using the data acquired on the DonkeyCar. This means that Python software will need to be installed, e.g TensorFlow (Machine Learning framework).

Software installation: Laptop / Desktop

  • apt-get install -y virtualenv # Note: You may be using a different software installer
  • mkvirtualenv donkeycar -p python3
  • pip install tensorflow==1.8.0

Software installation: Raspberry Pi

Your DonkeyCar (Raspberry Pi) is already pre-installed. This section is for reference only.

  • sysctl -w net.ipv6.conf.all.disable_ipv6=1 # Reconnect via ssh afterwards
  • sysctl -w net.ipv6.conf.default.disable_ipv6=1
  • apt-get update
  • apt-get upgrade
  • apt-get install -y vim git mosquitto-clients
  • apt-get install -y virtualenv build-essential python3-dev gfortran libhdf5-dev libatlas-base-dev libopenjp2-7-dev libtiff5
  • apt-get install -y i2c-tools
  • i2cdetect -y 1
        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
   00:          -- -- -- -- -- -- -- -- -- -- -- -- --
   10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
   70: 70 -- -- -- -- -- -- --
  • mv env env.donkeycar
  • virtualenv env -p python3
  • pip install tensorflow==1.8.0
  • pip install adafruit-pca9685
  • pip install picamera

Finding your car on the network

Your DonkeyCar (Raspberry Pi) has been pre-configured to connect to the LCA2019 network. But, which IP address ?

Every car has a unique hostname, from ohmc_01 to ohmc_32. The micro-SD card adapter is labeled with your car name.

However, that still isn't enough to find your car.

So, there is a cron job that every minute sends an MQTT message to test.mosquitto.org with your car's name, IP address and a timestamp.

Install an MQTT client, as follows ...

  • apt-get install mosquitto-clients

Use the following command to read the MQTT messages ...

  • mosquitto_sub -h test.mosquitto.org -t 'ohmc/#' -v
 ohmc/ohmc_01 10.193.2.69 Mon 11 Jun 07:08:01 UTC 2018

Driving the car manually

Caution: Put your car "on blocks" (wheels off the ground) the first time you try driving it

IP_ADDRESS=xxx.xxx.xxx.xxx # Found as above

  • ssh pi@$IP_ADDRESS
  • cd ohmc_car
  • python manage.py drive
 loading config file: /home/pi/play/roba_car/config.py
 config loaded
 PiCamera loaded.. .warming camera
 Starting Donkey Server...
 You can now go to http://xxx.xxx.xxx.xxx:8887 to drive your car.

With a desktop web browser, the user interface provides a virtual joystick (right-hand frame) that you can use to drive the car ... altering the steering and throttle values.

The mobile web browser, the user interface allows you to drive by tilting the phone left-right for steering and forwards-backwards for throttle. For safety, you must press the [Start Vehicle] / [Stop Vehicle] toggle button to enable control.

Data acquisition for the Neural Network

Training the Neural Network

Self-driving the car