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

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.

Throttle Control Code