Setting up ROS on Linux Mint 20 (Ulyana)
What is ROS?
ROS is an open-source, meta-operating system for your robot. It provides the services you would expect from an operating system, including hardware abstraction, low-level device control, implementation of commonly-used functionality, message-passing between processes, and package management. It also provides tools and libraries for obtaining, building, writing, and running code across multiple computers
ROS will run on your existing OS and can be easily install as per instructions provided on ROS wiki. As per the documentation, ROS is supported on Debian and Ubuntu and has ready repos for the same.
Luckiy Mint 20 is based on Ubuntu 2-0.04 (focal) so we can directly use most of the commands for the installation.
Though the repos can be added via the GUI, it is faster from the command line.
Let us see what steps should we take to go through the installation:
- First we need to add the ROS repo to our Linux distro.
- Command given for Ubuntu is: sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- Here if you are using ubuntu the lsb_release -sc is replaced with 'focal' if you use this directly on Linux Mint it will be replace by 'Ulayana' in this case and our repo will not work.
- So instead of the above command directly use the following:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list'
- Since this is an external repo we need setup the keys for the same
- curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
- If curl is not installed install it normally (sudo apt install curl).
- Update the repo list now:
- sudo apt update
- Next install the ROS desktop. There are a lot of options, best would be to just install the full if you are just starting. This will aviod any missing packages.
- Keep in mind the full download will be around 500MB and will take up around 2GB of space, so be prepared for the same. The download and package setup can take up some time.
- sudo apt install ros-noetic-desktop-full
- Once the installation is successful, we need to make sure ROS env is properly setup, we need to source the ROS setup.bash script form /opt/ros/noetic
- This can be done simply using the following command:
- source /opt/ros/noetic/setup.bash
- But since we are going to use this frequently, we will add this to our .bashrc, to do the same either you can edit the .bashrc file or append a line to the above command to the file.
- echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
- This will add the above line to our .bashrc and it will make sure the env is setup every time we use the terminal.
- Now either close the termainal and ropen it or run the following command (The following command need not be run every time)
- source .bashrc
- ROS Dependencies for building packages
- There are some python packages that will be needed later for building packages etc, let us install those also:
- sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
- This will take another 40MB of space
- rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
- To install the same run: (If you ran the previous install rosdep was already installed, so no need to re-install it again, jump to initalize part)
- sudo apt install python3-rosdep
- Initalize rosdep via:
- sudo rosdep init
- rosdep update
So now your ROS enviornment is ready!!!