How to Install ROS1 (Melodic)
It is recommended to install an LTS ROS distribution, which is always to be installed on a certain LTS distribution of Linux Ubuntu. A specific ROS distribution can only be installed on a specific Linux Ubuntu distribution.
ROS can be installed from either source or from binary (Debian installer). It is recommended to install the core ROS packages from binary.
It is recommended to install the complete ROS Desktop-Full (from binary).
Step 1: Install ROS.
- The documentation page for ROS installation: http://wiki.ros.org/ROS/Installation
- The documentation page for ROS Melodic installation on various OS: http://wiki.ros.org/melodic/Installation
- The documentation page for ROS Melodic installation on Linux Ubuntu: http://wiki.ros.org/melodic/Installation/Ubuntu
The installation instruction above already includes sourcing the ROS underlaying workspace in ~/.bashrc:
1 |
gedit ~/.bashrc |
Then on the opened bashrc file, type:
1 |
source /opt/ros/melodic/setup.bash |
and save the file.
To check the ROS installation, open a terminal and type the following to run ROS master:
1 |
roscore |
Gazebo is by default already installed. To launch Gazebo, open a terminal and type the following command:
1 |
gazebo |
Step 2: Create your overlaying catkin workspace, located in your home directory, and build it.
Let’s say you want to create an overlaying catkin workspace called “catkin_ws”:
1 2 3 4 5 |
mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src catkin_init_workspace cd ~/catkin_ws catkin_make |
After the “catkin_init_workspace” command is run, CMakeLists.txt file is generated inside the src folder.
After the “catkin_make” command is run, two folders namely “devel” and “build” are generated inside the catkin workspace.
Step 3: Source your overlaying catkin workspace in ~/.bashrc
From now on, each time we’ll have to start ROS commands that imply using our packages, we’ll have to source the workspace environment in each terminal:
1 |
source ~/catkin_ws/devel/setup.bash |
Alternatively, to make it work automatically:
1 |
gedit ~/.bashrc |
Then on the opened bashrc file, type:
1 |
source ~/catkin_ws/devel/setup.bash |
and save the file.