2021WinterTeam7
Team
Ardel Alegre - CSE, Senior
Jesus Fausto - ECE, Senior
Jesi Miranda - ECE, Senior
Jacob Plata - MAE, Senior
Objective
In previous years, the cars used by groups in this class controlled the motor by sending throttle information only in the form of voltage. This is fine if the battery levels stay the same. However, an issue arises as battery levels increase or decrease. The power being sent by the battery varies and subsequently the speed of the motor varies as well. Our goal is to implement the TritonAI framework as well as their low level hardware and software to train based on velocity rather than throttle. Our hypothesis was that the issue of the throttle varying with the charge of the battery would be solved with a velocity based approach.
Hardware
Jetson Nano: to do high level controls
Teensy 4.0: to do low level controls
Motor: EZRUN 3660SL G2, Brushless sensored DC motor
Chassis:
Circuitry:
3D Designs
Base Plate: Designed to hold the Jetson Nano, camera, and other components and was mounted to the chassis of the car.
Camera Mount: The camera is mounted directly to this with the lens sticking through the hole. The curved end was designed to allow the most adjustability in terms of camera angle.
Camera Base: The camera mount attached to one of the three sets of holes at the top of this piece allowing for multiple camera heights if necessary.
Software
Our project is the first time the TritonAI framework has been implemented on actual hardware. Their work can be found at https://github.com/Triton-AI/Triton-Racer-Sim
This framework is designed to work with the existing donkey gym framework (https://github.com/tawnkramer/gym-donkeycar).
Teensy
For the teensy code, make sure to have these Arduino libraries installed before uploading code. The following are all the libraries that are stated in the Arduino code for speed control but also for those that are not well documented in the code.
1. SafeString Library: https://github.com/PowerBroker2/SafeString
2. PWM Library: https://github.com/xkam1x/Arduino-PWM-Reader
3. PID_v1.h Library: https://github.com/br3ttb/Arduino-PID-Library
4. Watchdog_t4.h Library: https://github.com/tonton81/WDT_T4/
Also, make sure to download the Arduino-Teensy Extension (we are using Teensy 4.0)
5. https://www.pjrc.com/teensy/td_download.html
Additional Documentation
Instructions to get Triton-Racer-Sim to work with UCSD GPU cluster
Step 1:
Install miniconda --> reference: https://dev.to/waylonwalker/installing-miniconda-on-linux-from-the-command-line-4ad7
Step 2:
conda create -n tritonracer python=3.8
Step 3:
conda activate tritonracer
Step 4:
pip install docopt pyserial tensorflow==2.3.0 pillow keras==2.3.0 opencv-python opencv-contrib-python pygame==2.0.0.dev10 Shapely simple-pid
Step 5:
conda install scikit-learn
Step 6: Copy car program (FROM the jetson nano terminal for now):
cd ~/projects scp -r car_templates <ucsd username>.dsmlp-login.ucsd.edu:~/projects
Step 7: Copy helper files:
cd ~/tritonracer scp -r Triton-Racer-Sim <ucsd username>.dsmlp-login.ucsd.edu:~
When in the Virtual environment:
Step 8: Install helper packages:
conda install -c anaconda cudatoolkit=10.1 conda install cudnn=7.6.0 conda install tensorflow-gpu
Step 9: Get the proper path for ~/projects/manage.py :
pwd (in the terminal of virtual machine) Ex: /datasets/home/28/528/<user_name>/
Step 10: Edit manage.py :
Edit the path in manage.py with the path from Step 9
Step 11: Launch GPU cluster:
launch-148-gpu.sh
Step 12: Have fun!
Activate environment:
conda activate tritonracer
Start Training: (In the ~/projects/car_templates folder)
python manage.py train --tub data/<data_tub_name> --model ./models/<model_name>.h5