I assume you already completed installing Ubuntu 20.04 from the last chapter. In this part, I will help you install ROS Noetic Ninjemys. Each version of ROS is corresponding to a version of Ubuntu and ROS Noetic (running on Ubuntu 20) is the latest and also the last release of ROS 1.
For those of you who are not familiar with Linux (Ubuntu is one Linux distribution), most of the time you need to use terminals and commands to get what you want in a Linux system. Let's try it out!
Open a terminal by using Ctrl + Alt + T or right-click in Desktop or in a folder and choose Open in Terminal. Type the following command into the terminal:
sudo apt-get update
update command, as the name suggests, is used to update all installed packages that have new available releases. In Linux, when you run a command with
sudo, it means you run as administrator. And don't be surprised if you don't see the password you type because it is invisible. Just press Enter after typing your password and if it's correct, the command will be executed.
ROS Noetic Installation
Step 1: In the same terminal run this command to set up the sources.list so that your computer will accept the software from packages.ros.org. It is a long command so you should just copy and paste it to the terminal. To paste something into a terminal, you can either use right-click and choose Paste or use the shortcut Ctrl + Shift + V (similarly, to copy something from a terminal, just use Ctrl + Shift + C).
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Step 2: Add an authenticated key so your Ubuntu system can connect to the server and clone packages. Install curl if you have not:
sudo apt install curl. Then, run this command:
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
If it prints out OK, the key is successfully added.
Step 3: Install ROS Noetic version Desktop-Full. First, run an update:
sudo apt update Then start the installation by running (this will take about 30 minutes):
sudo apt install ros-noetic-desktop-full
Step 4: After the installation is finished, you should check if you can run the command
roscore or not. In order to run ROS, you first need to call this source command in the terminal you are in.
This needs to be called only once but if you open a new terminal you need to run it again. To avoid this, you can add that command to the
.bashrc file (with the dot) by:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
.bashrc file contains all commands which are automatically sourced (executed) when you open a new terminal. You can even source the whole
.bashrc when you edit it and want to bring the effect to the current terminal without opening a new one by:
Then, just run
roscore, and if you see something like this, congratulation! You have successfully installed ROS!
ROS Dependencies Installation
There are several dependencies you need to install so that you can build your application in ROS. Run the following command in a terminal:
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools python3-osrf-pycommon python3-pip
sudo rosdep init
, and finally:
Up to this point, you're well set to start using ROS. Well done!
Nice-to-have Software (optional)
This part is just my recommendations that I myself use at the moment to make life easier.
- Terminator: The default terminal of Ubuntu has very limited features. For example, you cannot have multiple terminals in one view (the terminals can be arranged in tabs or completely separate). With Terminator, you can. See the picture below, I have 9 terminals in one window.
To install Terminator, run this command:
sudo apt install terminator
I recommend taking a look at this list of Terminator shortcuts, so that you can use it faster with keyboard shortcuts.
- Visual Studio Code: This is one of the most popular code editors. It is free, available in different operating systems, and has a lot of useful plugins for developers. Just download, install and try it by yourself. I'm pretty sure you'll like it. Link to download VS Code
- Cover photo: http://wiki.ros.org/lunar