2018SpringTeam4

From MAE/ECE 148 - Introduction to Autonomous Vehicles
Jump to navigation Jump to search

Team 4 aims to train the car to be able to recognize and react to the traffic signs, such as stop sign and speed limit. To make the speed more controllable, we replace the brushless motor to brush DC motor and the ESC which go with them. We add the second camera and second raspberry pi for processing the images.



Replace the motor

The original Brushless motor is sensitive and moves fast. To ensure the car stop on time, we need more control over the speed. So we changed it to brushed motor, which runs relatively slow and stable.

Problem Solved: The Brushed motor provided by the professors has 3mm D shaft, but the pinion on the car is 5mm. We have to make an adapter to hold the pinion on the shaft. The pinion fills the space between the shaft and the pinion. It also has a hole on the side so the screw for the pinion can go through the hole to hold the three pieces together.


Replace the ESC

Different ESC are used for the motors.


Second Camera Setup

We decide to make the second camera aim a small angle to the right and forward. We make the second camera mount and keep it simple.


Second Raspberry Pi set up

For the second raspberry pi, we installed a number of python packages to enable the detection code. Most notable were opencv, scikit-image, and scipy. These took a long time to pip install, but some were able to be installed using "apt-get install", which was quite a bit faster. We were trying to use tesseract-ocr to identify speed limit digits towards the end of the project, but had trouble installing tesseract-ocr in a reasonable amount of time (<3 hours), so did not move forward.

Overall, the set up was a bit easier, as we did not need many donkey car related steps that were necessary for the first pi. Once the packages were installed and the serial code was written, it was simply a matter of connecting their serial ports and starting the programs on each of them.

Communication between Pis

We used the pyserial package to read and write messages between the pis. One pi was strictly in charge of detection, and the other was strictly in charge of driving, so the connection was needed for the detection pi to tell the driving pi to stop.

PI Serial Sketch.png


Detection Code

In order to detect stop signs, we used a Haar Cascade. This had the dual benefits of not needing to be trained (since stop signs are a commonly classified object) and being fast enough to stop a car in time if it saw one. We were able to quickly find a pretrained XML file, and created a multithreaded program to do the following:

1) Take pictures in a stream

2) Check each picture for the presence of a stop sign.

The Haar filter returns a bounding box which could be used to check the size/closeness of the object, but we did not find it necessary to use that. Instead, we simply tested for whether the list of possible stop sign coordinates was empty or not. This was admittedly slightly less robust.

Throttle Control Code