RoboRacing Software Installation Instructions ROS2

From RoboJackets Wiki
Revision as of 17:01, 17 November 2021 by Cjenkins72 (talk | contribs) (Step 6 - Building the Code)
Jump to navigation Jump to search

Welcome!

This will eventually replace the existing RoboRacing Software Installation Instructions at https://wiki.robojackets.org/RoboRacing_Software_Installation_Instructions. We are currently in the process of migrating our repository to ROS2.

Version Information

We have decided on using ROS2 Galactic due to its drastic stability increase over Foxy. One primary example is rosbag2 having only a 30% message recording rate in Foxy, but 100% in Galactic. Samsung published an article detailing some of the differences here.

Install ROS2 Galactic

This guide will assume that you are running Ubuntu 20.04. If you do not have Ubuntu 20.04, we recommend dual-booting your computer. You can find a guide to dual boot by using your search engine of choice.

Step 1 - ROS2 Galactic Installation

This guide will follow https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html.

sudo apt update && sudo apt install locales

sudo locale-gen en_US en_US.UTF-8

sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

export LANG=en_US.UTF-8

sudo apt install software-properties-common

sudo add-apt-repository universe

sudo apt update && sudo apt install curl gnupg lsb-release

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt install ros-galactic-desktop

Step 2 - Get Terminator

We primarily use terminator instead of the default terminal since it allows for both horizontal and vertical splitting (which obviously increases overall productivity). Start up the default terminal and type:

sudo apt install terminator

Step 3 - Source Environment Variables

For the time being, we do not recommend placing these commands into ~/.bashrc because we will be switching between ROS and ROS2. Instead, you will need to source your environment with each shell instance.

source /opt/ros/galactic/setup.bash

Setup Workspace

Step 4 - Make File Structure

mkdir -p ~/roboracing_ws/src

cd ~/roboracing_ws/src

git clone https://github.com/RoboJackets/roboracing-software.git -b ros2/main --recursive

Step 5 - Install Dependencies

cd ~/roboracing_ws

sudo apt install -y python3-colcon-common-extensions

sudo rosdep init

rosdep update

rosdep install --from-path src --ignore-src -y

Step 6 - Building the Code

colcon build

source ~/roboracing_ws/install/setup.bash

Similar to line 3, you should run source ~/roboracing_ws/install/setup.bash with every new shell instance.