diff --git a/auto_script_wolf b/auto_script_wolf new file mode 100644 index 0000000000000000000000000000000000000000..a3c5bf8b8f387a2726f695e1f0c3bda8c8085e2a --- /dev/null +++ b/auto_script_wolf @@ -0,0 +1,56 @@ +#!/usr/bin/expect + +set timeout -1 + +spawn ./script_install_wolf.sh -e + +expect "Enter path for dependencies (either /global/path or relative/path):\r" + +send -- ".\r" + +expect "Enter path for wolf folder (either /global/path or relative/path):\r" + +send -- ".\r" + +expect "Do you want to download and install plugin imu? (y/n)\r" + +send -- "y\r" + +expect "Do you want to download and install plugin gnss? (y/n)\r" + +send -- "y\r" + +expect "Do you want to download and install plugin laser? (y/n)\r" + +send -- "y\r" + +expect "Do you want to install CSM to enable ICP processors? (y/n)\r" + +send -- "y\r" + +expect "Do you want to install FALKO to enable Falko loop closure processors? (y/n)\r" + +send -- "y\r" + +expect "Do you want to download and install plugin vision (requires to install opencv 3.3.0)? (y/n)\r" + +send -- "y\r" + +expect "Do you want to download and install plugin apriltag? (y/n)\r" + +send -- "y\r" + +expect "Do you want to download and install plugin bodydynamics? (y/n)\r" + +send -- "y\r" + + + + + + + + + + +expect eof diff --git a/install_wolf.sh b/install_wolf.sh new file mode 100644 index 0000000000000000000000000000000000000000..2c6cc344ad5e7e680039fe2b9178311a768a977f --- /dev/null +++ b/install_wolf.sh @@ -0,0 +1,481 @@ +#!/bin/bash + +# verbose +VERBOSE="true" +while getopts "he" option; do + case $option in + e) # disable verbose + VERBOSE="false" + ;; + esac +done + +CORES=$(nproc) +if [ $VERBOSE == "true" ]; then + echo "The number of available cores on this machine is $CORES" +fi + +RUN_PATH=$PWD + +# UBUNTU +UBUNTU_DISTRO=$(lsb_release -rs); +if [ $UBUNTU_DISTRO == "16.04" ]; then + if [ $VERBOSE == "true" ]; then + echo "Ubuntu 16.04 - OK" + fi +elif [ $UBUNTU_DISTRO == "18.04" ]; then + if [ $VERBOSE == "true" ]; then + echo "Ubuntu 18.04 - OK" + fi +elif [ $UBUNTU_DISTRO == "20.04" ]; then + if [ $VERBOSE == "true" ]; then + echo "Ubuntu 20.04 - OK" + fi +else + echo "Non-supported Ubuntu version: $UBUNTU_DISTRO" + exit 1 +fi + + +# WOLF DEPENDENCIES ##################################################### +if [ $VERBOSE == "true" ]; then + echo "You are in folder $PWD" +fi +echo "Enter path for dependencies (either /global/path or relative/path):" +read DEPS_PATH +cd $DEPS_PATH +DEPS_PATH=$PWD +if [ $VERBOSE == "true" ]; then + echo "path dependencies: $DEPS_PATH" +fi + +if [ $VERBOSE == "true" ]; then + echo "Installing dependencies via apt install..." +fi +sudo apt install -y dh-autoreconf cmake build-essential libgoogle-glog-dev libgflags-dev libatlas-base-dev libsuitesparse-dev git libboost-all-dev libyaml-cpp-dev wget unzip + + +# Eigen +# Ubuntu 16.04 - Eigen 3.3.7 required +if [ $UBUNTU_DISTRO == "16.04" ]; then + if [ $VERBOSE == "true" ]; then + echo "Installing Eigen 3.3.7 via source..." + fi + # todo check if installed, check version, check + wget https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip + unzip eigen-3.3.7.zip + rm eigen-3.3.7.zip + cd eigen-3.3.7 + mkdir build + cd build + cmake .. + sudo make install +else + if [ $VERBOSE == "true" ]; then + echo "Installing Eigen 3 via apt install" + fi + sudo apt install -y libeigen3-dev +fi + +# ceres +if [ $VERBOSE == "true" ]; then + echo "Installing ceres 2.0 via source..." +fi +cd $DEPS_PATH +git clone https://ceres-solver.googlesource.com/ceres-solver +cd ceres-solver +git checkout 2.0 +git pull +mkdir -p build && cd build +cmake -DCMAKE_BUILD_TYPE=Release .. +make -j$CORES +make test +sudo make install + +# spdlog +if [ $VERBOSE == "true" ]; then + echo "Installing spdlog 0.17 via source..." +fi +cd $DEPS_PATH +git clone https://github.com/gabime/spdlog.git +cd spdlog +git checkout v0.17.0 +git pull +mkdir -p build && cd build +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fPIC" .. +make -j$CORES +sudo make install + + +# WOLF ##################################################### +cd $RUN_PATH +if [ $VERBOSE == "true" ]; then + echo "You are in folder $PWD" +fi +echo "Enter path for wolf folder (either /global/path or relative/path):" +read WOLF_PATH +cd $WOLF_PATH +mkdir wolf +cd wolf +WOLF_PATH=$PWD +if [ $VERBOSE == "true" ]; then + echo "wolf folder path: $PWD/wolf" +fi + + +# CORE ----------------------------------------------------- +if [ $VERBOSE == "true" ]; then + echo "Cloning wolf core..." +fi +cd $WOLF_PATH +git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/wolf.git +cd wolf +git pull + +if [ $VERBOSE == "true" ]; then + echo "Compiling wolf core..." +fi +mkdir -p build && cd build +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. +cd build +make -j$CORES + +if [ $VERBOSE == "true" ]; then + echo "Installing wolf core..." +fi +sudo make install + +if [ $VERBOSE == "true" ]; then + echo "Testing wolf core..." +fi +ctest -j$CORES + + +# IMU -------------------------------------------------- +echo "Do you want to download and install plugin imu? (y/n)" +read INSTALL_IMU +if [ $INSTALL_IMU == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin imu..." + fi + cd $WOLF_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/imu.git + cd imu + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin imu..." + fi + mkdir -p build && cd build + cmake .. -DCMAKE_BUILD_TYPW=Release + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin imu..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin imu..." + fi + ctest -j$CORES +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin imu." + fi +fi + +# GNSS -------------------------------------------------- +echo "Do you want to download and install plugin gnss? (y/n)" +read INSTALL_GNSS +if [ $INSTALL_GNSS == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin gnss dependencies..." + fi + cd $DEPS_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/gauss_project/gnss_utils.git + cd gnss_utils + git submodule update --init + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. + make -j$CORES + ctest -j$CORES + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin gnss..." + fi + cd $WOLF_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/gnss.git + cd gnss + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin gnss..." + fi + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin gnss..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin gnss..." + fi + ctest -j$CORES +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin gnss." + fi +fi + + +# LASER -------------------------------------------------- +echo "Do you want to download and install plugin laser? (y/n)" +read INSTALL_LASER +if [ $INSTALL_LASER == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin laser dependencies..." + fi + + # CSM + echo "Do you want to install CSM to enable ICP processors? (y/n)" + read INSTALL_CSM + if [ $INSTALL_CSM == "y" ]; then + cd $DEPS_PATH + git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/csm.git + cd csm + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$CORES + sudo make install + else + if [ $VERBOSE == "true" ]; then + echo "Skipping CSM." + fi + fi + + # FALKO + echo "Do you want to install FALKO to enable Falko loop closure processors? (y/n)" + read INSTALL_FALKO + if [ $INSTALL_FALKO == "y" ]; then + cd $DEPS_PATH + git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/falkolib.git + cd falkolib + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$CORES + sudo make install + else + if [ $VERBOSE == "true" ]; then + echo "Skipping Falko." + fi + fi + + # LASER_SCAN_UTILS + if [ $VERBOSE == "true" ]; then + echo "Installing laser_scan_utils (required)..." + fi + cd $DEPS_PATH + sudo ldconfig + git clone ssh://git@gitlab.iri.upc.edu:2202/labrobotica/algorithms/laser_scan_utils.git + cd laser_scan_utils + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$CORES + ctest -j$CORES + sudo make install + + # PLUGIN + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin laser..." + fi + cd $WOLF_PATH + sudo ldconfig + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/laser.git + cd laser + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin laser..." + fi + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin laser..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin laser..." + fi + sudo ldconfig + ctest -j$CORES +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin laser." + fi +fi + +# VISION -------------------------------------------------- +echo "Do you want to download and install plugin vision (requires to install opencv 3.3.0)? (y/n)" +read INSTALL_VISION +if [ $INSTALL_VISION == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin vision dependencies..." + fi + cd $DEPS_PATH + + #install opencv + wget https://github.com/opencv/opencv/archive/3.3.0.zip -O temp.zip + unzip temp.zip + rm temp.zip + cd opencv-3.3.0 + git clone https://github.com/opencv/opencv_contrib.git + cd opencv_contrib + git checkout 3.3.0 + cd .. + mkdir build + cd build + cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_CXX_FLAGS="-fPIC -std=c++14" -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules .. + make -j8 + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin vision..." + fi + cd $WOLF_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/vision.git + cd vision + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin vision..." + fi + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin vision..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin vision..." + fi + ctest -j$CORES +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin vision." + fi +fi + +# APRILTAG -------------------------------------------------- +if [ $INSTALL_VISION == "y" ]; then + echo "Do you want to download and install plugin apriltag? (y/n)" + read INSTALL_APRILTAG + if [ $INSTALL_APRILTAG == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin apriltag dependencies..." + fi + cd $DEPS_PATH + git clone https://github.com/AprilRobotics/apriltag apriltaglib + cd apriltaglib + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$CORES + ctest -j$CORES + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin apriltag..." + fi + cd $WOLF_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/apriltag.git + cd apriltag + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin apriltag..." + fi + mkdir -p build && cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin apriltag..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin apriltag..." + fi + ctest -j$CORES + else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin apriltag." + fi + fi +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin apriltag since plugin vision was not installed." + fi +fi + +# BODYDYNAMICS -------------------------------------------------- +if [ $INSTALL_IMU == "y" ]; then + echo "Do you want to download and install plugin bodydynamics? (y/n)" + read INSTALL_BD + if [ $INSTALL_BD == "y" ]; then + + if [ $VERBOSE == "true" ]; then + echo "Cloning plugin bodydynamics..." + fi + cd $WOLF_PATH + git clone ssh://git@gitlab.iri.upc.edu:2202/mobile_robotics/wolf_projects/wolf_lib/plugins/bodydynamics.git + cd bodydynamics + git pull + + if [ $VERBOSE == "true" ]; then + echo "Compiling plugin bodydynamics..." + fi + mkdir -p build && cd build + cmake .. -DCMAKE_BUILD_TYPW=Release + cd build + make -j$CORES + + if [ $VERBOSE == "true" ]; then + echo "Installing plugin bodydynamics..." + fi + sudo make install + + if [ $VERBOSE == "true" ]; then + echo "Testing plugin bodydynamics..." + fi + ctest -j$CORES + else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin bodydynamics." + fi + fi +else + if [ $VERBOSE == "true" ]; then + echo "Skipping plugin bodydynamics since plugin imu was not installed." + fi +fi