Skip to content

Setup (ROS)

manx52 edited this page Oct 2, 2024 · 6 revisions

Install ROS and related Software

Install useful development tools

# Code dependencies
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
  • Part 1
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 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 ros-noetic-desktop-full -y
  • Part 2
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y
sudo rosdep init
rosdep update
sudo sh \
    -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" \
        > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y python3-catkin-tools

Setting up source code

Create a catkin workspace, download the meta repo and its submodules:

mkdir -p ~/catkin_ws/src && cd ~/catkin_ws
catkin init
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Debug # For Debug builds
cd src
git clone --recurse-submodules [email protected]:utra-robosoccer/soccerbot.git

To update and sync the submodules to the latest version of the branch, run this inside the soccerbot folder

git pull
git checkout <desired_branch>
git submodule sync
git submodule update --init --recursive
git-lfs pull
git submodule foreach git-lfs pull

Installation

Installing dependencies

# Pip dependencies and precommit
cd ~/catkin_ws/src/soccerbot/
pip3 install --upgrade pip
pip3 install -U setuptools[core]
pip3 install -r tools/setup/requirements.txt -f https://download.pytorch.org/whl/torch/ -f https://download.pytorch.org/whl/torchvision/

# if you have a gpu run the following line
pip3 install -r tools/setup/requirements-gpu.txt

pre-commit install # Will setup your pre-commit, will format and check all files on commit

# Rosdep dependencies
sudo rosdep init # Only need to do this once
rosdep update
cd ~/catkin_ws/src/soccerbot/
rosdep install --from-paths . --ignore-src -r -y 

Go Back

Look at Setup (Local)