There are many different versions of ROS. The latest version long term support(LTS) is currently ROS Noetic Ninjemys. For choosing the distribution or version you should consider your application. you can find useful information about choosing the right version on this page: http://wiki.ros.org/Distributions.
Based on our application which is the autonomous vehicle we opt for ROS Melodic. Most versions of the packages work on this version, so this version is also used in this tutorial. ROS Melodic is primarily designed to run on the Ubuntu 18.04 LTS operating system. ROS can also be run in a separate Docker container. This allows ROS to run on many different operating systems and simplifies the management and development of robot software.
The development of ROS2 is already underway. You can read more about it at the official site: https://index.ros.org/doc/ros2/.
To make ROS easier to install on Ubuntu 18.04, an automated installation script has been created, which will run automatically to install all required packages. To run the installation script, use the following command on the terminal:
$ sudo apt update $ sudo apt upgrade $ wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_melodic.sh $ chmod 755 ./install_ros_melodic.sh $ bash ./install_ros_melodic.sh''
One of the important working elements is the ROS working environment. It defines the context for the current workspace and you can also overlay different environments. Default workspace loaded with:
$ source /opt/ros/melodic/setup.bash
To create a new working environment; Create a folder named catkin_ws. If you used an automatic install script, you can skip creating a folder:
$ mkdir -p ~/catkin_ws/src # Create folders ~/catkin_ws/src
Compile catkin workspace:
$ cd ~/catkin_ws/ # Go to folder ~/catkin_ws/ $ catkin_make # compile the computing environment
command catkin_make is a handy tool for managing catkin workspaces. When you run this command, CMakeLists.txt is created and linked to the src folder. The build and devel folders are also created. Looking at the devel folder, you see that there are some *.sh files (shell script) in the folder:
$ ls -l devel
When extracting these files (source), the workspace variables are used. After that, packages in the workspace can be launched.
From the work environment you created earlier (catkin_ws) run this command:
$ source devel/setup.bash
To make sure that the setup script worked to check that the ROS_PACKAGE_PATH environment variable contains your workspace:
$ echo $ROS_PACKAGE_PATH /home/youruser/catkin_ws/src:/opt/ros/melodic/share
Since multiple terminal windows are usually required to use ROS, and it would be tedious to use the workspace every time we add a .baschrc line that automatically takes our workspace when we open a new terminal window:
$ echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc
Your ROS environment is now configured and will be deployed automatically. Next, explore the ROS file system.
There are a bunch of programming tools and software that really facilitate working with ROS and programming. Here we suggest Terminator as an alternative to the default ubuntu Terminal and Visual Studio Code as a good IDE (Integrated Development Environment).
Terminator is an alternative terminal for Linux that comes with a few additional features and functionality that you won't find in the default terminal application. For instance, in Terminator you can split your terminal screen both horizontally and vertically as you wish. The user can also have multiple terminals in one window and use custom key bindings to switch between them.
for installing the Terminator, run these commands in the terminal.
$ sudo add-apt-repository ppa:gnome-terminator $ sudo apt-get update $ sudo apt-get install terminator
Now you can open a new Terminal by “Ctrl + Alt + T” and for splitting the terminal screen right-click on the terminal and use split.
Visual Studio Code is a freeware source-code editor made by Microsoft for Windows, Linux, and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.
For installing the VSCode you can follow the instruction on the Doc page:
https://code.visualstudio.com/docs/setup/linux