2021SummerTeam1

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

Team Members

  • Gabriel Gekas - Aerospace Engineering (Senior)
  • Sunny Chu - Electrical Engineering (Senior)

Project Overview

Different than other groups, our project is dedicated to "dockerized" donkey car AI 3.x.x(I believe the same concept can be applied to donkey car AI 4.x.x) so the future students/groups won't be struggling with downloading/installing all the dependencies.

Robot & Mechanical Design

Robocar

Bodyy.jpg Frontt.jpg

Chassis Mount

Chassis mount.png

Camera Mount

Body.png Head.png


Donkey Car AI autonomous laps demo

Refer to [1] for 3 autonomous laps with training on ~60 laps.

NOTES & TIP!

Since we are collecting data using an RGB camera, the model would only work in a certain condition(For our model, the autonomous lap only works when there's sunlight around the starting mark. (between 3 - 5 pm, late August)

OpenCV/ROS autonomous laps demo

Refer to [2] for 3 autonomous laps with ROS/OpenCV lane detection.

NOTES & TIP!

OpenCV is color sensitive! We have spent a lot of time just calibrating the color on the track so the Robocar can follow the yellow tapes. Since there exist both dark and light yellow tapes on the track(which is for the lane detection), it's really hard for us to calibrate correctly, along with all other colors(white for the edge of the track, orange for the cone). Also, day and night would have different effects so make sure you calibrate them carefully and only work either at night or day!!!!!

Final Project

After countless hours of debugging, We have sadly not been able to finish “Docker-izing” the Donkey Car AI. We started on 4 days before the end of the summer session II, and have been tweaking our Dockerfile since Thursday with sleepless nights and hard-working days. Most of the issues… actually, all of the issues are due to dependency problems. First, we tried the latest version of Python, then 3.6.9, then 3.7.7. The latter two seem to work the best and clear through the “docker build” with the fewest errors. We’ve also had to change around some of the packages to pull from source instead of pip3 installs, and we completely removed the virtual environment because it’s redundant to run inside of a container, and it’s not recommended. These changes all seem to work well; however, our latest problem seems to be with Torchvision. We get an error such as: Cloning into ‘torchvision’...

 File “setup.py”, line 361
  print(f’ffmpeg {ffmpeg version} not supported yet, please use ffmpeg 4.2.’)
                                                                                                                                  ^

SyntaxError: invalid_syntax

We’ve tried installing ffmpeg 4.2.4, ffmpeg 4.2.2, ffmpeg-python, and the newest version of ffmpeg, but none of them seem to resolve the issue. We’ve tried both Python 3.6.9 and 3.7.7 with no better results. We’ve tried looking into deleting line 361 in setup.py, but we can’t seem to find the file path of setup.py.

Our Dockerfile builds off of the Nvidia L4T base image and runs through installs listed in: [3]

The L4T base images come with TensorRT, Cuda, and cuDNN pre-packaged which is convenient, but this could be our problem as it’s all updated to the newest versions. Maybe, going back and installing older versions may help in troubleshooting.

Here's the dockerfile we've come up with:

dockerfile

FROM nvcr.io/nvidia/l4t-base:r32.6.1

# commands run in order from:
# https://docs.google.com/document/d/1Gy4CEKjqXZub0rz-YmxFOakj9O_ZjMmlUYe7NLdM4FY/edit
# starting at "DonkeyCar AI Framework"

RUN apt-get update -y && apt-get upgrade -y

RUN apt-get install -y build-essential \
    python3-dev python3-pip libhdf5-serial-dev hdf5-tools \
    libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev \
    libblas-dev gfortran libxslt1-dev libxml2-dev \
    libffi-dev libcurl4-openssl-dev libssl-dev libpng-dev \
    libopenblas-dev openmpi-doc openmpi-bin libopenmpi-dev \
    libopenblas-dev git nano && \
    wget https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz --no-check-certificate && \
    tar -xf Python-3.7.7.tgz && cd Python-3.7.7 && \
    ./configure && make build_all && make altinstall && cd

RUN pip3 install Jetson.GPIO

# omitting user modifications

RUN cd ~ && mkdir projects

#    && \
#    mkdir envs && cd envs && pip3 install virtualenv

# no need for virtual environment

# RUN python3 -m virtualenv -p python3 ~/projects/envs/donkey \
#    --system-site-packages

# RUN echo "source ~/projects/envs/donkey/bin/activate" >> ~/.bashrc

# RUN . ~/.bashrc

RUN apt-get update && \
    pip3 install pip testresources setuptools && \
    pip3 install futures==3.1.1 protobuf==3.12.2 pybind11==2.5.0 && \
    pip3 install cython==0.29.21 pyserial && \
    pip3 install future==0.18.2 mock==4.0.2 h5py==2.10.0 \
    keras_preprocessing==1.1.2 keras_applications==1.0.8 gast==0.3.3 && \
    pip3 install absl-py==0.9.0 py-cpuinfo==7.0.0 psutil==5.7.2 \
    portpicker==1.3.1 six requests==2.24.0 astor==0.8.1 \
    termcolor==1.1.0 wrapt==1.12.1 google-pasta==0.2.0 && \
    pip3 install gdown

# RUN pip3 install --pre --extra-index-url \
#     https://developer.download.nvidia.com/compute/redist/jp/v45 \
#     tensorflow==2.3.1 && \
#     apt-get update && apt-get install -y tensorrt

RUN pip3 install --upgrade setuptools && pip3 install pycuda

RUN wget https://www.ffmpeg.org/releases/ffmpeg-4.4.tar.gz \
   --no-check-certificate && tar -xf ffmpeg-4.4.tar.gz && \
   cd ffmpeg-4.4 && ./configure && make install

RUN cd ~/projects && apt-get install -y python3-distutils && \
    wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl && \
    cp p57jwntv436lfrd78inwl7iml6p13fzh.whl torch-1.8.0-cp36-cp36m-linux_aarch64.whl && \
    pip3 install torch-1.8.0-cp36-cp36m-linux_aarch64.whl && \
    apt-get install -y libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev && \
    git clone https://github.com/pytorch/vision torchvision && \
    cd torchvision && \
    python setup.py install && \
    cd ../

RUN cd ~/projects && git clone https://github.com/autorope/donkeycar && \
    cd donkeycar && \
    git checkout master

RUN cd ~/projects/donkeycar && donkey createcar --path ~/projects/d3

RUN apt-get install -y python3-dev python3-numpy \
    python-dev libsdl-dev libsdl1.2-dev \
    libsdl-image1.2-dev libsdl-mixer1.2-dev \
    libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev \
    python-numpy subversion libportmidi-dev ffmpeg \
    libswscale-dev libavformat-dev libavcodec-dev \
    libfreetype6-dev libswscale-dev libjpeg-dev libfreetype6-dev



We hope someone in a future class has enough time to figure it all out. We’ve definitely learned a lot about docker in the process, so it was still a great learning experience, and I’m glad we tried to figure it out! It doesn’t really seem to be so much of an issue with Docker, but rather an issue with software compatibility between all of the necessary applications to run Donkey Car AI.

Once the docker image is built, we believe that the students won't struggle with downloading all the dependencies anymore. Instead, they will have more time to test their Robocar and complete any tasks/projects, which we don't have during the summer session due to shorting in people!