Skip to content

Commit

Permalink
hopefully fixed setup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
manx52 committed Oct 1, 2024
1 parent 89afc1e commit 3745f0e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 19 deletions.
64 changes: 46 additions & 18 deletions tools/setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ ask_question() {
setup_cuda(){
if (( has_sudo )); then
export OS=ubuntu2004
export ARCHITECTURE=x86_64 # sbsa for ARM
wget https://developer.download.nvidia.com/compute/cuda/repos/$OS/$ARCHITECTURE/cuda-$OS.pin
sudo mv cuda-$OS.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/${OS}/$ARCHITECTURE/3bf863cc.pub
Expand All @@ -41,12 +40,14 @@ setup_ros(){
sudo apt-get install -y python3-pip vim git git-lfs python-is-python3
pip3 install pre-commit
echo "export PATH=/home/$USER/.local/bin:$PATH" >> ~/.bashrc && source ~/.bashrc
export PATH=/home/$USER/.local/bin:$PATH

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-noetic-desktop-full
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && source ~/.bashrc
source /opt/ros/noetic/setup.bash
sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo rosdep init
rosdep update
Expand All @@ -72,6 +73,7 @@ setup_repo(){
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Debug # For Debug builds
cd src
git clone --recurse-submodules [email protected]:utra-robosoccer/soccerbot.git
cd soccerbot
git pull
git submodule sync
git submodule update --init --recursive
Expand All @@ -80,24 +82,26 @@ setup_repo(){

cd ~/catkin_ws/src/soccerbot/
sudo apt-get install -y $(cat tools/setup/rosdep.txt)
pip install --upgrade pip
pip install -U setuptools[core]
pip install -r /tools/setup/requirements.txt
pip3 install --upgrade pip
pip3 install -U setuptools[core]
pip3 install -r tools/setup/requirements.txt
if (( wants_cuda )) ; then
pip install -r /tools/setup/requirements-gpu.txt
pip3 install -r tools/setup/requirements-gpu.txt
fi
pre-commit install
rosdep update && rosdep install --from-paths . --ignore-src -r -y

# Building the webots controllers
cd ~/catkin_ws/src/soccerbot/external/hlvs_webots
pip install -r controllers/referee/requirements.txt
sudo apt-get install protobuf-compiler libprotobuf-dev ant
make
if (( wants_webots )) ; then
# Building the webots controllers
cd ~/catkin_ws/src/soccerbot/external/hlvs_webots
pip install -r controllers/referee/requirements.txt
sudo apt-get install protobuf-compiler libprotobuf-dev ant
make

# Building GameController
cd ~/catkin_ws/src/soccerbot/external/GameController
ant
# Building GameController # TODO add to /usr/local/webots/lib/controller/python38 (added by user) pycharm
cd ~/catkin_ws/src/soccerbot/external/GameController
ant
fi

mkdir -p /home/$USER/.ros/config && cd /home/$USER/.ros/config
ln -s /opt/ros/noetic/etc/ros/python_logging.conf
Expand All @@ -116,22 +120,46 @@ setup_repo(){

has_sudo=0
wants_cuda=0
wants_webots=0
if ask_question "Do you have sudo rights?"; then
has_sudo=1
sudo apt update
fi
if ask_question "Do you have a nvidia graphics card and want to install cuda"; then
if ask_question "Do you have a nvidia graphics card and want to install cuda?"; then
wants_cuda=1
fi
if ask_question "Do you to install webots? Warning requires heavy specs."; then
wants_webots=1
fi

if (( ! has_sudo )); then
echo "Because, you don't have sudo rights, ensure all necessary ROS packages are installed."
if ask_question "Do you have arm architecture?"; then
export ARCHITECTURE=sbsa # sbsa for ARM
else
export ARCHITECTURE=x86_64
fi


check_internet_connection

if (( wants_cuda )) ; then
setup_cuda
fi

setup_ros
setup_repo

if (( wants_webots )) ; then
sudo apt install -y curl
curl -fsSL https://raw.githubusercontent.com/utra-robosoccer/soccerbot/refs/heads/master/tools/setup/setup_webots.sh > /tmp/setup_webots.sh
bash /tmp/setup_webots.sh
fi

if ask_question "Install ROS?"; then
setup_ros
fi

if ask_question "Setup Repo?"; then
if ask_question "Is ssh key setup correctly?"; then # TODO Maybe do a check
setup_repo
else
echo "Please install Repo manually!"
fi
fi
3 changes: 2 additions & 1 deletion tools/setup/setup_webots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ else
# Install the webots simulator
sudo apt-get install "/tmp/webots_${WEBOTS_VERSION}.deb" -y

echo "export WEBOTS_HOME=/usr/local/webots" >> ~/.bashrc && source ~/.bashrc
echo "export WEBOTS_HOME=/usr/local/webots" >> ~/.bashrc
export WEBOTS_HOME=/usr/local/webots
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/noetic/lib/:$WEBOTS_HOME/lib/controller" >> ~/.bashrc
echo "export PYTHONPATH=$PYTHONPATH:$WEBOTS_HOME/lib/controller/python38" >> ~/.bashrc && source ~/.bashrc

Expand Down

0 comments on commit 3745f0e

Please sign in to comment.