First commit

This commit is contained in:
orion1 2022-12-16 16:48:02 -04:00
commit a42f5e79c3
1 changed files with 237 additions and 0 deletions

237
fresh_mu_install_v2.sh Normal file
View File

@ -0,0 +1,237 @@
################################################################################
# _____ ______ _____ ______ _____ #
# / ___| | ___ \ |_ _| | ___ \ |_ _| #
# \ \__ | |_/ / | | | |_/ / | | #
# \___ \ | __/ | | | _ | | | #
# ____/ / | | _| |_ | | \ \ _| |_ #
# \____/ \_| \___/ \_| \_| \___/ #
# #
######################## Installer ########################
# Maintainer: webmaster@spirirobotics.com
# Last Modified:
# Copyright: Spiri Holdings, Inc.
# License:
# Prerequisites:
# - TX2 is flashed with current Spiri kernel
# - TX2 is installed with JetPack packages CUDA, cuDNN, TensorRT, TensorFlow
# _ TX2 is on a network connected to Internet
# This function updates the terminal title.
PS1=$
PROMPT_COMMAND=
setTitle() {
echo -en "\033]0;$1\a"
}
# Initial Setup
setTitle "Initial Setup"
cd
sudo apt update
sudo apt install -y bash-completion command-not-found g++ git htop locate nano screen
sudo apt install -y ntp
git config --global credential.helper store
sudo usermod -a -G dialout $USER
sudo usermod -a -G video $USER
sudo usermod -a -G tty $USER
sudo chmod 666 /dev/ttyTHS2
# Gstreamer
setTitle "Installing Gstreamer"
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
# Libraries
setTitle "Installing Libraries"
cd
sudo apt install -y --only-upgrade g++-7 cpp-7 gcc-7
sudo apt install -y build-essential cmake cmake-curses-gui ffmpeg gfortran \
liblapack-dev liblapacke-dev libatlas-base-dev libavcodec-dev \
libavdevice-dev libavformat-dev libavutil-dev libdc1394-22-dev libglew-dev \
libgtk-3-dev libjpeg8-dev libjpeg-turbo8-dev libopenblas-dev \
libopenexr-dev libswscale-dev libtiff5-dev libpng-dev libv4l-dev \
libx264-dev libxine2-dev libxml2-dev libxslt1-dev libxvidcore-dev \
libfreetype6-dev make qt5-default libdc1394-22 v4l-utils libtbb-dev \
libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev \
libgphoto2-dev libhdf5-dev doxygen yasm checkinstall unzip libjpeg-dev \
libpng-dev libtiff-dev libavresample-dev x264 libfaac-dev libmp3lame-dev \
libtheora-dev libvorbis-dev libopencore-amrnb-dev libopencore-amrwb-dev
# Python
setTitle "Installing Pythons"
# Python 2.7
sudo apt install -y python-dev python-numpy python-pip python-py \
python-pytest python-tk
# Python 3.6
sudo apt install -y python3-dev python3-numpy python3-pip python3-py \
python3-pytest python3-tk
sudo -H pip install future matplotlib
sudo apt install -y python-wxgtk3.0 python3-cairocffi
# Eigen
setTitle "Installing Eigen"
cd
sudo apt install -y libeigen3-dev
setTitle "Building OpenCV with CUDA"
cd ~/Downloads/
git clone https://git.spirirobotics.com/Spiri/cuda-Tx2.git
cd cuda-Tx2/
sudo ./install.sh
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd
sudo apt update
sudo apt install -y build-essential cmake gfortran libavutil-dev libeigen3-dev \
libatlas-base-dev libavcodec-dev libavformat-dev libavresample-dev \
libcanberra-gtk3-module libgtk2.0-dev libdc1394-22-dev libglew-dev libgtk-3-dev \
libjpeg-dev libjpeg8-dev libjpeg-turbo8-dev liblapack-dev liblapacke-dev \
libopenblas-dev libpng-dev libpostproc-dev libswscale-dev libtbb-dev libtbb2 \
libtesseract-dev libtiff-dev libv4l-dev libxine2-dev libxvidcore-dev libx264-dev \
pkg-config qtbase5-dev qv4l2 v4l-utils v4l2ucp zlib1g-dev
cd ~/Downloads/
git clone https://git.spirirobotics.com/Spiri/OpenCV3.4_TX2_Prebuilt.git
cd OpenCV3.4_TX2_Prebuilt
sudo ./install.sh
#=======================================================
# Install ROS Melodic
setTitle "Installing ROS Melodic"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install -y curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install -y ros-melodic-desktop-full
source /opt/ros/melodic/setup.bash
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# Install ROS packages that require OpenCV
sudo apt install -y libgtk2.0-dev
mkdir -p ~/catkin-ws/src
sudo -H pip install empy
sudo -H pip3 install empy
sudo -H pip install rospkg
sudo -H pip3 install rospkg
sudo apt install -y python-catkin-tools # Must for catkin build
sudo apt install -y python3-pyqt5
#export PKG_CONFIG_PATH=/usr/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
#==========================================================
# Set up Spiri catkin workspace and install camera launch files
setTitle "Creating Spiri catkin workspace and installing launch files"
sudo apt-get -y install v4l-utils
cd ~/catkin-ws/src
#catkin_init_workspace
git clone https://git.spirirobotics.com/Spiri/jetson_csi_cam.git
cd jetson_csi_cam
git checkout gscam_nodelet # checkout nodulet branch
sudo ./camera_override.sh # copies the ISP file
cd ..
sudo apt install -y gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev
sudo apt install -y ros-melodic-gscam
sudo apt install -y ros-melodic-mavros ros-melodic-mavros-extras
git clone https://git.spirirobotics.com/Spiri/gpu_stereo_image_proc.git
git clone https://git.spirirobotics.com/Spiri/apriltag.git
git clone https://git.spirirobotics.com/Spiri/apriltag_ros.git
git clone https://git.spirirobotics.com/Spiri/ros_rtsp.git
sudo apt install -y libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev libgstrtspserver-1.0-dev
git clone https://git.spirirobotics.com/Spiri/mavros_fly.git
setTitle "Building Catkin workspace"
cd ~/catkin-ws
catkin config --extend /opt/ros/melodic
catkin build apriltag
catkin build apriltag_ros
catkin build
echo "source ~/catkin-ws/devel/setup.bash" >> ~/.bashrc
# TODO Set up VNC
# Get requirements for mavros
setTitle "Setting up geographic libraries"
cd
sudo geographiclib-get-geoids egm96-5
sudo geographiclib-get-geoids egm2008-2_5
sudo geographiclib-get-gravity egm2008
sudo geographiclib-get-magnetic emm2017
# Ensure prerequisites are still installed (when/where/how are these being removed?)
sudo apt install -y libglew-dev
sudo apt install -y ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
# Background services
setTitle "Setting up Background Services"
cd Downloads/
git clone https://git.spirirobotics.com/safy/spiri-services.git
cd spiri-services
#sudo ./install.sh
#git clone https://git.spirirobotics.com/Spiri/spiri-services.git
#sudo cp -r ~/Downloads/spiri-services/sbin/. /usr/sbin/
#cd /usr/sbin/
#sudo chmod +x apriltaglaunch
#sudo chmod +x camlaunch
#sudo chmod +x roslaunch
#sudo chmod +x ros_radio_listener
#sudo cp -r ~/Downloads/spiri-services/service/. /etc/systemd/system/
#mkdir -p /etc/ros/
#sudo cp ~/Downloads/spiri-services/env.sh /etc/ros/
#cd /etc/ros/
#sudo chmod +x env.sh
#sudo systemctl enable --now roslaunch
#sudo systemctl enable --now ros_radio_listener
#sudo systemctl enable --now roscore
#sudo systemctl enable --now apriltag
#sudo systemctl enable --now camlaunch
cd sbin
sudo cp * /usr/sbin/
cd ..
cd service
sudo cp * /etc/systemd/system/
cd ..
mkdir -p /etc/ros/
cp env.sh /etc/ros/
cd /etc/ros/
sudo chmod +x env.sh
cd /usr/sbin/
sudo chmod +x mavroslaunch
sudo chmod +x ros_radio_listener
sudo chmod +x apriltaglaunch
sudo chmod +x camlaunch
sudo chmod +x gpudisplaunch
sudo systemctl enable --now mavroslaunch
sudo systemctl enable --now ros_radio_listener
sudo systemctl enable --now roscore
sudo systemctl enable --now apriltag
sudo systemctl enable --now camlaunch
sudo systemctl enable --now gpudisplaunch
setTitle "installing mavros"
cd ~/Downloads
git clone https://git.spirirobotics.com/Spiri/mavros.git
roscd mavros/launch
sudo cp ~/Downloads/mavros/mavros/launch/* .
# Disable Auto Updates
#sudo sed 's/APT::Periodic::Update-Package-Lists "1";/APT::Periodic::Update-Package-Lists "0";/1' /etc/apt/apt.conf.d/10periodic
# Perform Cleanup Operation(s)
setTitle "Performing Cleanup"
sudo apt-get -y autoremove
# Installation Complete
setTitle "Installation Complete"