From MAE/ECE 148 - Introduction to Autonomous Vehicles
Revision as of 21:18, 11 December 2019 by Fall2019Team1 (talk | contribs)
Jump to navigation Jump to search

Team Members

  • Harou Xue - Electrical Engineering
  • Yuhan Zhang - Electrical Engineering
  • Cheyenne Herrera - Math/Engineering

Project Objectives

The goal of our project is to create a miniature version of a Tesla. We wanted to increase the safety of the self-driving car by implementing rear-end collision prevention as well as apply the lane change safety. The Donkey RoboCar will stop itself when approaching an object in the front using a TOF sensor mounted to it. Additionally, the car will speed up if a vehicle/object is approaching it from behind. Furthermore, the RoboCar will implement lane change on command.

Mechanical Design


Camera Mount.png

Adjustable Camera Holder.png

Electronic Design


  • Jetson Nano with fan and wirless card installed
  • PCA9685 PWM (control servo and ESC)
  • Steering Servo (control steering)
  • Electronic speed controller (ESC) (control throttle)
  • Relay (provide emergency stop)
  • LED (show emergency stop status)
  • power
  • USB camera
  • Arduino (for connecting ToF sensor)
  • Time-of-flight sensor (ToF)
  • Lidar and USB controller


Electronic Schematic.png


Donkey and parts

We use the Donkey Car framework for car control. With the framework, we can easily train deep learning autonomous driving models by recording manual driving. The frameworks use modularized "parts" to manage all the components in a car. When the car runs, it loops through all parts that have been added to it. Not only sensors can be Donkey parts, controllers and actuators are also Donkey parts.

Our project involves new sensors, ToF and Lidar, that have not been included in Donkey. They should be added to Donkey in the form of parts.

We connect the Lidar and ToF(Arduino) using serial ports. We need to add our user to a group that has access to serial ports.

   sudo usermod -a -G dialout jetson

We are using YD Lidar X4. There is a python library PyLidar3 that supports this model.

To use the PyLidar3 library

Create an instance and connect

   lidar = YdLidarX4("/dev/ttyUSB0")


   scans = self.lidar.StartScanning()
   for scan in scans:
       for i in range(360):
           self.scan[i] = scan[i]

Stop Lidar and disconnect


We use Adruino to connect to the ToF sensor.

   myArduino = serial.Serial('/dev/ttyACM0', 115200)

Get sensor reads

   ser_bytes = myArduino.readline()
       distance = float(ser_bytes[0:len(ser_bytes) - 2].decode("utf-8"))

Donkey uses a dictionary to save data that flow through each part. The data used as input or output of parts should be defined when adding parts.

Example: adding Lidar to Vehicle in manage.py V.add(lidar, outputs=['lidar/scan', 'lidar/time'], threaded=True)

Rear Collision Prevention

Our first goal is to provide rear collision prevention. When another car is going to crash into the back of our car and there is no obstacle in front of our car. We can move forward to prevent a collision.

Useful Knowledge

Donkey Parts


How Donkey works




Future Work