Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

fix build error,test on Jetson xavier NX is ok #8

Open
wants to merge 1 commit into
base: 0.8.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ Any user of this software shall indemnify and hold harmless Rick Lan, dragonpilo
Table of Contents
------

* [What is xnxpilot?](#what-is-xnxpilot)
* [Showcase](#showcase)
* [Checklist](#checklist)
* [Hardware requirement](#hardware-requirement)
* [Software requirement](#software-requirement)
* [Hardware assimbly](#hardware-assembly)
* [Installation](#installation)
* [Credits](#credits)
* [Notes](#notes)
- [Licensing](#licensing)
- [Table of Contents](#table-of-contents)
- [What is xnxpilot?](#what-is-xnxpilot)
- [Showcase](#showcase)
- [Checklist](#checklist)
- [Hardware Requirement](#hardware-requirement)
- [Software Requirement](#software-requirement)
- [Hardware assembly](#hardware-assembly)
- [Installation](#installation)
- [Credits](#credits)
- [Notes](#notes)
- [set\_core\_affinity](#set_core_affinity)

---

Expand All @@ -30,6 +33,7 @@ xnxpilot (Xavier NX Pilot) is an open source driver assistance system based on [


If you would like to run it with minimal changes to openpilot, please see the example in "doc" branch, based on openpilot 0.8.4
-YJ- base on dragon pilot 0.8.9

---

Expand Down
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ else:
elif arch != "Darwin":
qt_libs += ["GL"]

qt_env.Tool('qt')
qt_env.Tool('qt3')
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
qt_flags = [
"-D_REENTRANT",
Expand Down
32 changes: 32 additions & 0 deletions doc/1_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# change jetson power mode, desktop
sudo nvpmodel -m 5
# maximize Jetson Xavier performance by setting static max frequency to CPU, GPU, and EMC clocks
sudo jetson_clocks

#allow sudo without password
IS_SUDO=$(sudo cat /etc/sudoers | grep `whoami` | wc -l)
if [ $IS_SUDO = 0 ]; then
echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" | (sudo su -c 'EDITOR="tee -a" visudo -f /etc/sudoers')
fi

#allow user to access USB
sudo echo "SUBSYSTEM==\"usb\", MODE=\"0666\", GROUP=\"users\"" > $HOME/openpilot.rules
sudo echo "SUBSYSTEM==\"usb_device\", MODE=\"0666\", GROUP=\"users\"" >> $HOME/openpilot.rules
sudo mv $HOME/openpilot.rules /etc/udev/rules.d
sudo chmod 644 /etc/udev/rules.d/openpilot.rules
sudo chown root /etc/udev/rules.d/openpilot.rules
sudo chgrp root /etc/udev/rules.d/openpilot.rules

# remove unused apps
sudo apt update
sudo apt purge -y libreoffice* thunderbird* rhythmbox* transmission* mutter* *visionworks* ubuntu-wallpapers-bionic ubuntu-desktop *theme-ubuntu* remmina branding-ubuntu light-themes lightdm gdm3 pulseaudio packagekit ibus* metacity mate-desktop-common xfwm4 matchbox-window-manager lubuntu*
sudo apt install -y apt-utils openbox
sudo apt purge -y deluge smplayer* onboard* snapd* vpi1* lxmusic* avahi* yelp* gnome-* vlc* nfs* ntfs* docker* python-gi samba*
sudo apt autoremove -y && sudo apt clean -y
sudo apt upgrade -y
sudo apt install gir1.2-notify

#reboot
reboot
88 changes: 88 additions & 0 deletions doc/2_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# change jetson power mode, desktop
sudo nvpmodel -m 5
# maximize Jetson Xavier performance by setting static max frequency to CPU, GPU, and EMC clocks
sudo jetson_clocks

# install packages in ubuntu_setup.sh
# without clang and qt
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
autoconf \
build-essential \
bzip2 \
capnproto \
cppcheck \
libcapnp-dev \
cmake \
curl \
ffmpeg \
git \
libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev \
libarchive-dev \
libbz2-dev \
libcurl4-openssl-dev \
libeigen3-dev \
libffi-dev \
libglew-dev \
libgles2-mesa-dev \
libglfw3-dev \
libglib2.0-0 \
liblzma-dev \
libmysqlclient-dev \
libomp-dev \
libopencv-dev \
libpng16-16 \
libssl-dev \
libstdc++-arm-none-eabi-newlib \
libsqlite3-dev \
libtool \
libusb-1.0-0-dev \
libzmq3-dev \
libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev \
libsystemd-dev \
locales \
ocl-icd-libopencl1 \
ocl-icd-opencl-dev \
opencl-headers \
python-dev \
python3-pip \
screen \
sudo \
vim \
wget \
gcc-arm-none-eabi

# install focal version
sudo sed -i -e 's#bionic#focal#g' /etc/apt/sources.list
sudo apt update
sudo apt install -y --no-install-recommends \
tmux \
clang \
qml-module-qtquick2 \
qt5-default \
qtmultimedia5-dev \
qtwebengine5-dev \
qtdeclarative5-dev \
qtchooser \
libqt5x11extras5-dev \
qtlocation5-dev \
qtpositioning5-dev \
libqt5sql5-sqlite \
libqt5svg5-dev \
ccache \
libreadline-dev \
nvidia-cudnn8 \
nano

sudo apt install -y libpocl2
sudo sed -i -e 's#focal#bionic#g' /etc/apt/sources.list
sudo apt update

sudo apt purge -y whoopsie apport apparmor rpcbind gpsd isc-dhcp-server

wget -O .tmux.conf https://raw.githubusercontent.com/geohot/configuration/master/.tmux.conf
# reboot
reboot

150 changes: 150 additions & 0 deletions doc/3_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#!/bin/bash

# change jetson power mode, desktop
sudo nvpmodel -m 5
# maximize Jetson Xavier performance by setting static max frequency to CPU, GPU, and EMC clocks
sudo jetson_clocks

sudo apt autoremove -y

# install jtop
sudo pip3 install setuptools
# jtop
sudo -H pip3 install -U jetson-stats


cd $HOME
git clone https://github.com/commaai/openpilot.git openpilot

cd $HOME/openpilot

# install git lfs
if ! command -v "git-lfs" > /dev/null 2>&1; then
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
fi

# install pyenv
if ! command -v "pyenv" > /dev/null 2>&1; then
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
fi

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
# install bashrc
source ~/.bashrc
if [ -z "$OPENPILOT_ENV" ]; then
OP_DIR=$(git rev-parse --show-toplevel)
echo "export PYENV_ROOT=\"$HOME/.pyenv\"" >> ~/.bashrc
echo "export PATH=\"$PYENV_ROOT/bin:$PATH\"" >> ~/.bashrc
echo "eval \"$(pyenv init --path)\"" >> ~/.bashrc
echo "source $OP_DIR/tools/openpilot_env.sh" >> ~/.bashrc
source ~/.bashrc
echo "added openpilot_env to bashrc"
fi

# do the rest of the git checkout
git lfs pull
git submodule init
git submodule update

# install python
pyenv install -s 3.8.5
pyenv global 3.8.5
pyenv rehash
eval "$(pyenv init -)"

# **** in python env ****
pip install --upgrade pip==20.2.4
pip install pipenv==2020.8.13

pip install setuptools
pip install wheel
pip install pkgconfig
pip install cython
pip install pycapnp
pip install numpy
pip install pycurl
pip install scons
pip install jinja2
pip install setuptools-cythonize
pip install sympy
pip install cffi
pip install logentries
pip install pyzmq
pip install pyjwt
pip install requests
pip install atomicwrites
pip install setproctitle
pip install psutil
pip install smbus2
pip install libusb1
pip install tqdm
pip install crcmod
pip install raven
pip install pycryptodome
pip install hexdump # for dump.py

cd $HOME
# install opencv4
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.2.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.2.zip
unzip opencv.zip
unzip opencv_contrib.zip
mv opencv-4.5.2 opencv
mv opencv_contrib-4.5.2 opencv_contrib
cd $HOME/opencv/
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D WITH_CUDA=ON \
-D CUDA_ARCH_PTX="" \
-D CUDA_ARCH_BIN="7.2" \
-D WITH_CUDNN=ON \
-D CUDNN_VERSION="8.0" \
-D BUILD_opencv_python3=ON \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_java=OFF \
-D WITH_GSTREAMER=ON \
-D WITH_GTK=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_FFMPEG=ON \
-D OPENCV_DNN_CUDA=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_QT=ON \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D PYTHON_EXECUTABLE=/home/`whoami`/.pyenv/versions/3.8.5/bin/python \
-D PYTHON_DEFAULT_EXECUTABLE=/home/`whoami`/.pyenv/versions/3.8.5/bin/python \
-D PYTHON_PACKAGES_PATH=/home/`whoami`/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ \
-D OPENCV_EXTRA_MODULES_PATH=/home/`whoami`/opencv_contrib/modules ..

make -j $(nproc)
sudo make install

#capnproto
#install with the supplied script instead
cd $HOME/openpilot
sudo cereal/install_capnp.sh

# instrall onnxruntime-gpu
wget https://nvidia.box.com/shared/static/8xgbee5ghhb92i9rrcr04yymg0n3x3t0.whl -O onnxruntime_gpu-1.7.0-cp38-cp38-linux_aarch64.whl
pip install onnxruntime_gpu-1.7.0-cp38-cp38-linux_aarch64.whl
rm -fr onnxruntime_gpu-1.7.0-cp38-cp38-linux_aarch64.whl

#add user to the input device so it can read mouse
sudo usermod -aG input openpilot

sudo apt autoremove -y
reboot
7 changes: 7 additions & 0 deletions doc/4_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# autologin
sudo apt install -y lxdm
sudo sed -i -e 's/#autologin=dgod/autologin=openpilot/g' /etc/lxdm/default.conf
sudo sed -i -e 's/#skip_password/skip_password/g' /etc/lxdm/default.conf
reboot
21 changes: 21 additions & 0 deletions doc/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Rick Lan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading