diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bb1f26ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,100 @@ +FROM ubuntu:20.04 + +ENV PYTHONUNBUFFERED 1 +ENV DEBIAN_FRONTEND="noninteractive" + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + sudo \ + ssh \ + tzdata \ + locales \ + git \ + nano \ + clang \ + libzmq3-dev \ + libjson11-1 \ + libjson11-1-dev \ + liblmdb-dev \ + libusb-1.0-0-dev \ + gcc-arm-none-eabi \ + libcurl4-openssl-dev \ + libssl-dev \ + ffmpeg \ + libeigen3-dev \ + software-properties-common \ + openjdk-11-jdk \ + python3.9 \ + python3.9-dev \ + python3.9-distutils \ + python3-pip \ + wget \ + unzip \ + make \ + libssl-dev \ + gcc \ + autoconf \ + automake \ + libtool \ + g++ \ + tmux \ + scons + +RUN yes | sudo add-apt-repository ppa:ubuntu-toolchain-r/test +RUN apt upgrade libstdc++6 -y + +RUN apt remove locales -y +RUN wget http://launchpadlibrarian.net/560614488/libc6_2.34-0ubuntu3_amd64.deb +RUN dpkg -i libc6_2.34-0ubuntu3_amd64.deb +RUN rm -rf libc6_2.34-0ubuntu3_amd64.deb + +RUN mkdir -p /Android/Sdk/cmdline-tools/latest +RUN wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip +RUN unzip commandlinetools-linux-8092744_latest.zip +RUN mv cmdline-tools/* /Android/Sdk/cmdline-tools/latest/ +RUN rm -rf cmdline-tools commandlinetools-linux-8092744_latest.zip +RUN echo 'export ANDROID_SDK_ROOT=/Android/Sdk' +RUN echo 'export PATH=$PATH:/Android/Sdk/cmdline-tools/latest/bin' +RUN alias sdkmanager=/Android/Sdk/cmdline-tools/latest/bin/sdkmanager +RUN yes | /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses +RUN /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools" +RUN /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "build-tools;32.0.0" +RUN yes | sudo add-apt-repository ppa:deadsnakes/ppa + +WORKDIR /tmp +RUN git clone https://github.com/capnproto/capnproto.git +WORKDIR /tmp/capnproto +RUN git checkout tags/v0.8.0 +WORKDIR /tmp/capnproto/c++ +RUN autoreconf -i +RUN ./configure +RUN make -j6 check +RUN sudo make install + +RUN python3.9 -m pip install \ + pipenv \ + numpy \ + pycryptodome +RUN pipenv --python 3.9 + +COPY . /flowpilot + +WORKDIR /flowpilot/libs/capnpc-java +RUN \ + if [ ! -d capnproto-java/ ]; \ + then \ + git clone https://github.com/capnproto/capnproto-java.git $DIR/capnproto-java; \ + fi +WORKDIR /flowpilot/libs/capnpc-java/capnproto-java +RUN git checkout 81d18463a8f3c98f6d21d4eae27caaca6bace4f7 +RUN make +RUN sudo make install + +WORKDIR /flowpilot +RUN pipenv run pip install pkgconfig==1.5.5 Cython==0.29.32 +RUN pipenv run pip install pycapnp==1.0.0 +RUN pipenv run pip install -r requirements.txt +RUN touch .deb_update +RUN pipenv run scons +ENV ANDROID_SDK_ROOT=/Android/Sdk +RUN ./gradlew desktop:assemble \ No newline at end of file diff --git a/SConscript b/SConscript index 02263609..e26ebeff 100644 --- a/SConscript +++ b/SConscript @@ -11,5 +11,5 @@ gen_setup_files = [ env.Command(['.env'], ['flowpilot_env.sh'], './flowpilot_env.sh') env.Command([gen_setup_files], ['setup.py'], 'pip install -e .') -env.Command('.dep_update', ['get_dependencies.sh'], './get_dependencies.sh') -env.Command('.pip_update', ['requirements.txt'], 'pip install -r requirements.txt && touch .pip_update') +# env.Command('.dep_update', ['get_dependencies.sh'], './get_dependencies.sh') +# env.Command('.pip_update', ['requirements.txt'], 'pip install -r requirements.txt && touch .pip_update') diff --git a/launch_flowpilot.sh b/launch_flowpilot.sh index 8b9673c5..ff096740 100755 --- a/launch_flowpilot.sh +++ b/launch_flowpilot.sh @@ -1,5 +1,5 @@ set -e -source ./.env +. ./.env export WIDE_ROAD_CAMERA_SOURCE="selfdrive/assets/fcam.avi" # no affect on android export ROAD_CAMERA_SOURCE="selfdrive/assets/tmp" # no affect on android @@ -12,13 +12,12 @@ export ZMQ_MESSAGING_PROTOCOL="TCP" # TCP, INTER_PROCESS, SHARED_MEMORY #export DISCOVERABLE_PUBLISHERS="1" # if enabled, other devices on same network can access sup/pub data. #export DEVICE_ADDR="127.0.0.1" # connect to external device running flowpilot over same network. useful for livestreaming. -export SIMULATION="1" -#export FINGERPRINT="HONDA CIVIC 2016" +export SIMULATION="0" +export FINGERPRINT="HONDA CIVIC 2016" ## android specific ## export USE_SNPE="0" # only works for snapdragon devices. - if ! command -v tmux &> /dev/null then echo "tmux could not be found, installing.." @@ -38,4 +37,5 @@ if pgrep -x "flowinit" > /dev/null tmux attach -t flowpilot fi -while true; do sleep 1; done +# while true; do sleep 1; done +scons && flowinit \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bd10e9ae..7099fe88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,9 +28,9 @@ smbus2==0.4.2 pycurl==7.45.1 tenacity==8.0.1 atomicwrites==1.4.0 -sentry-sdk==1.10.1 +sentry-sdk==1.19.1 sympy==1.11.1 certifi==2022.12.7 hatanaka==2.8.0 boto3==1.26.113 -inputs==0.5 +inputs==0.5 \ No newline at end of file diff --git a/run_docker.sh b/run_docker.sh new file mode 100755 index 00000000..bbc04668 --- /dev/null +++ b/run_docker.sh @@ -0,0 +1,7 @@ +xhost + > /dev/null +docker run -it --rm \ + -e DISPLAY:$DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + --device=/dev/dri:/dev/dri \ + --mount type=volume,src=flowdrive,target=/root/.flowdrive \ + raghav66/flowpilot:latest \ No newline at end of file diff --git a/scripts/install-flowpilot-desktop b/scripts/install-flowpilot-desktop index 4281a2bc..99f93a5f 100755 --- a/scripts/install-flowpilot-desktop +++ b/scripts/install-flowpilot-desktop @@ -26,15 +26,28 @@ fail() { # install android and java sdk sudo apt update sudo apt install -y openjdk-11-jdk git -wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip -unzip commandlinetools-linux-8092744_latest.zip -mkdir -p ~/Android/Sdk/cmdline-tools/latest -mv cmdline-tools/* ~/Android/Sdk/cmdline-tools/latest/ -rm -rf cmdline-tools + +if ! [ -e ./commandlinetools-linux-8092744_latest.zip ]; then + wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip + unzip commandlinetools-linux-8092744_latest.zip +else + info "Skipping Command Line tools download as it is already downloaded." +fi + +if ! [ -e ~/Android ]; then + mkdir -p ~/Android/Sdk/cmdline-tools/latest + mv cmdline-tools/* ~/Android/Sdk/cmdline-tools/latest/ + rm -rf cmdline-tools +else + info "Skipping Android SDK installation, ~/Android already exists" +fi + echo 'export ANDROID_SDK_ROOT=$HOME/Android/Sdk' >> ~/.bashrc echo 'export PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin' >> ~/.bashrc + export ANDROID_SDK_ROOT=$HOME/Android/Sdk export PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin + yes | sdkmanager --licenses sdkmanager --install "platform-tools" sdkmanager --install "build-tools;32.0.0" @@ -46,11 +59,19 @@ yes | sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install -y python3.9 python3.9-dev python3.9-distutils python3-pip scons # get flowpilot -cd ~/ && git clone https://github.com/flowdriveai/flowpilot.git -cd flowpilot && git submodule update --init -pip install pipenv numpy pycryptodome +if ! [ -e ~/flowpilot ]; then + cd ~/ && git clone https://github.com/flowdriveai/flowpilot.git + cd flowpilot && git submodule update --init + python3.9 -m pip install pipenv + python3.9 -m pipenv shell + ./get_dependencies.sh + ./flowpilot_env.sh -source ~/.bashrc +else + cd ~/flowpilot && git pull origin master && git submodule update --init + ./get_dependencies.sh + ./flowpilot_env.sh +fi -success "Flowpilot successfully installed." +success "Flowpilot successfully installed." \ No newline at end of file