Welcome to the wiki page of Team 7! Our autonomous vehicle project consists of 4 parts which are indoor autonomous driving, outdoor autonomous driving, parallel parking and stop sign recognition. In this wiki page we are going to walk you through our autonomous vehicle design process.
Our GitHub repository can be found here: 
(Jerry) Yihui Yang
The 12.4V Lipo battery supplies power to the Electrical Speed Controller (ESC), The relay and the Raspbberry Pi.To power a raspberry Pi, a 12V to 5V step down is needed and the output will be from a USB port so that it can power the Raspberry Pi directly. The battery power goes to a switch and then goes to the RF controlled relay, which serves as an emergency stop switch of the entire system. The COM pin of the relay is connected to the 3.3V pin on the Raspberry Pi which provides the “high logic”. The NO pin stands for the “normally open” which controls logic level for the red LED. The NC pin stands for “normally closed” which controls logic level for the blue LED and it is connected to the output enable “OE” pin on the Pulse Width Modulation (PWM) module which disables the PWM pins on logic high. With this circuit built, we are able to shut down the steering and throttle control using a remote control.
• Battery powers RPi thru a “step-down” converter
• Battery powers ESC, which controls DC motor
• Battery powers RF relay, which is a part of the emergency stop button
• Red LED is on when PWM is disabled, blue LED is on when PWM enabled
• PWM module controls servo motor
• Broken RF Relay
• Partial power failure: since the Raspberry Pi supplies 3.3V (logic high) to the relay module, once the Raspberry loses its power, the relay module will not be able to supply that logic high to the Output Enable pin on the PWM to stop the vehicle while the ESC is still powered
Calibration Values After assembling the vehicle, the circuit and installed Donkey. We were able to calibrate the steering and throttle with PWM values as follow:
Forward Min 370
Forward max 450
Backward min 290
Indoor Autonomous Driving
We were able to build a decent model for our vehicle to drive autonomously on the indoor track for 5 laps after collecting 16k data, a short demo can be found here:
Outdoor Autonomous Driving
The outdoor driving model took us much more effort to build. The first successful model we built was able to ran 3 laps autonomously, however, it only supplied a very limited throttle therefore the vehicle ran out of juice at the sharp uphill turns. This was due to the way we drove the vehicle during the training. We tried driving to slowly in the beginning so that it was able to have enough time to recognize the corners. For the following models, we supplied more constant throttles in fortunately we were able to ran our vehicle autonomously for 6 laps after training it for hundreds of laps!
• Driving with constant throttle helps
• Driving closer to the red lines helps because the cracks on the track are also black and they might confuse the models with the actuall black tapes
• Drive with consistent throttle and turning angles
• The outdoor track needs taller camera mounts with a wider angle because the track is wider than the indoor track
• The best training time is from 10am to 2pm with clear sky
• EBU2 courtyard is really cold, bring gloves;)
Project inspiration and originality:
We chose autonomous parallel parking as a part of our project because most drivers are not very good at parallel parking in the real world. Our parallel parking algorithm was inspired from fall 2018 team 2's parallel parking project. However, we were able to use one Pololu Time of Flight VL53L1X sensor to complete the entire parking procedure instead of two of them.
Spot length detection:
The ToF sensor is placed at the rear part of the vehicle and the vehicle will be driving with a constant throttle. The ToF sensor constantly reads value in a while loop and it will start the timer once there is a positive change in the distance reading (i.e. there is a parking spot). Then the timer the sensor will stop the timer when it detects a negative change in distance (i.e. the second edge of the spot is detected). The length of the spot will be calculated with the time difference and the constant speed the vehicle is driving. If the length is greater than a threshold, the program will break from the while loop and perform the parking procedure. If not, it will keep looking for a suitable spot.
Parking without break
The first parking algorithm we had simply turns off the throttle instead of breaking the vehicle, therefore the vehicle would travel an extra distance before it stops. We were able to fix this error by running a reverse PWM on the motor in order to stop the vehicle, as shown in the second video.
Parking with break
The greatest challenge we encountered was interfacing the Raspberry Pi microcontroller with multiple ToF sensors on multiple I2C buses, which is also the main reason we simplified our parking algorithm with only one sensor. When initializing the program, we were able to turn on the first sensor and change its I2C address and then then on the second sensor so that they will have different addresses on the same I2C bus (the default address for the ToF sensor is 0x29). Unfortunately, all available python libraries for this particular sensor are not suitable for multiple sensors and we did not have enough time to fix the current python library. The way the library defines the variables are static so that when address changes the program gets confused.
If we had more time on this part of the project, we would definitely try improving the current library so that we could interface with multiple sensors at the same time. At the same time, we would like to optimize our current parking algorithm to fit our vehicle into tighter spots.
Stop Sign Recognition
References and Resources Used
Team 7 would like to give special thanks to:
• Parallel parking inspiration from fall 2018 team 2 
• OpenCV tutorial 
• The amazing tutors
for making this project happen!