ROS is an open-source, meta-operating robot framework, which means that it assumes there is an underlying operating system that will assist it in carrying out its tasks. ROS offers all the features that you would expect from an operating system, including hardware abstraction, low-level device control, commonly used software implementation, process-passing messages, and packet management. ROS has everything you need for your next robotics project, from drivers to state-of-the-art algorithms, all with powerful developer tools. This ROS tutorial will help you get started.
In very simple words ROS is a middleware between your Operating System (OS) and your robot codes/packages.
Running on Linux ROS doesn’t provide support with the real-time tasks, while real-time tasks are an integrated part of many robot applications such as robot motion control. A solution to this problem is combining ROS with real-time code. ROS supports simulation software like Gazebo, and visualizer like Rviz for analyzing sensor data from your robot, it also supports MoveIt, a motion planner which will help you with planning motion of your robot.
The gazebo is a 3D multi-robot indoor and outdoor simulator with dynamic and kinematic physics and a plug-in physics engine. Integration between ROS and Gazebo is supported by a collection of Gazebo plugins that support several robots and sensors already in place.
Why Should I Use ROS?
ROS can be used for many reasons; in the end, it all depends on your project which you want to build. However, whatever your project may be, we can say one thing for sure, that ROS removes the complexity of the integration of robots. It can be tricky sometimes and very tough to implement and wire up the robot with other methods, but ROS makes it simple and easy.
ROS provides various functionalities for communication between machines, including the possibility of making nodes written in different languages (Python, C++) communicate with each other. The best part is that the same base code and the knowledge you have used in one project can be used in various other projects you will be building.
ROS is reliable for hardware abstraction, visualization, device drivers, and many more.
More than one ROS distributions are available and supported at a time. There are older releases with long-term support, making them more stable, along with some newer ones with shorter lifetime support, but with binaries for newer platforms, and more modern versions of the ROS packages that make them up. A ROS distribution is a versioned set of ROS packages. Download ROS distribution from here.
ROS currently runs only on platforms which are based on Unix. ROS software is mainly tested on Ubuntu and Mac OS X systems, while support for Fedora, Gentoo, Arch Linux, and other Linux platforms has been contributed by the ROS community.
While a port for ROS to Microsoft Windows is possible, it has still not been fully explored.
So far so good. Let us now begin with the ROS tutorial starting with the installation.
Installation on Ubuntu (16.04)
Configure your Ubuntu repositories
Configure your Ubuntu repositories to allow “restricted,” “universe,” and “multiverse.
Setup sources.list file:
Setup your computer to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
If you experience issues connecting to the keyserver, you can try substituting hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 in the previous command.
Alternatively, you can use curl instead of the apt-key command, which can be helpful if you are behind a proxy server:
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
First, make sure your Debian package index is up-to-date:
sudo apt update
Now pick how much of ROS you would like to install.
Desktop-Full Install: (Recommended) : Everything in Desktop plus 2D/3D simulators and 2D/3D perception packages
sudo apt install ros-noetic-desktop-full sudo apt install ros-noetic-desktop
We will need to initialize rosdep before we can use the ROS. Rosdep allows us to easily install source system dependencies, we want to compile and some core components need to be run in ROS.
sudo rosdep init rosdep update
Hope you were complete the installation process as that can be tricky. You may take external help if you can any unknown errors while setting up.
Let us now continue our ROS tutorial by getting started with the environment setup.
It’s convenient to automatically add the ROS environment variables to your bash session each time a new shell is started.
Note: If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.
Bash: echo “source /opt/ros/noetic/setup.bash” >> ~/.bashrcsource ~/.bashrc
zsh: echo “source /opt/ros/noetic/setup.zsh” >> ~/.zshrcsource ~/.zshrc
Dependencies for building packages
So far you have installed what the main ROS packages need to run. There are various resources and specifications which are distributed separately to build and maintain your own ROS workspaces.
To install this tool and other ROS package building dependencies execute:
Sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
we have completed the whole installation process and now we will go to the configuration part.
Catkin controls ROS workspaces
For all packages, we host we need to identify a directory. We create an src folder within the directory and call the form inside the catkin init workspace. This will build specific symbolic connections to the ROS version currently being supplied. The next step is also to add workspace to the variables of the environment.
To perform this whole workspace configuration, choose an empty directory and execute the following commands
mkdir src cd src catkin_init_workspace cd .. catkin_make echo “source $(pwd)/devel/setup.bash”>>~/.bashrc
We have now created a workspace where you can build your own ROS packages.
It was a very simple ROS tutorial for introducing the Robot operating system, but the expectation is that you are more interested in working with this flexible system.
Hope you enjoyed this tutorial and am looking forward to sharing more of this with you. Join Towards Robotics to for similar content if you are interested in robotics and automation.