Robot Operating System

Content by:- Asiri Sirithunga | Written by:- Yohan Abeysinghe

Since the first digital robot, “Unimate” by George Devol, in 1954, robotics has been making a steep improvement over the past decades. From six-axis robot arms from the ’80s to complex AI-powered humanoid robots, robotics has come a long way. The industry is at a point where the developers need to focus on delivering the value and invention upon the already available designs rather than re-inventing the same thing repeatedly. That’s where Robot Operating Systems (ROS) come into play.

ROS is an open-source software development kit for robotics applications. It offers a standard software development platform to developers throughout the industry to bring their prototypes to the development and production stage in the shortest possible time. ROS is something between an operating system and a middleware. It provides a range of standard OS features like headwear abstraction, contention management, process management, and some high-level functionality like asynchronous calls, synchronous calls, centralized database, and robot configuration.

  • Why ROS?

Building a robot from the ground up requires a considerable amount of time designing the embedded software within a robot and the hardware. This requires a wide range of skills from mechanical engineering, electronics, and embedded programming, which is typically beyond the scope of a single individual. ROS lowers this technical requirement by creating a general ecosystem applicable to any robot, just as an OS does to a device.

ROS also utilizes an effective Pub/Sub Bus communication model, making it easy to use third-party modules designed for different parts of the same robot in different languages and integrate them without minimum barrier.

  • History of ROS?

The first software, the most stripped-down version of the current ROS, was invented in 2007 at Stanford University. After its success, the second version of ROS was developed by Willow Garage, a technology incubator working on an autonomous SUV. In 2013 OSRF became the primary maintainer for ROS. Ever since that year, ROS started to release a new version every year. In 2017 OSRF changed its name to Open Robotics, and up until now, Open Robotics has been doing all the ROS-related developments.

ROS Architecture & Philosophy

ROS’s main reason for becoming open-source while still allowing the user to choose the libraries and tools to fit their robot and application is its architecture and design. ROS has a philosophy that will enable different developers from different backgrounds to combine their work.

  • Peer to Peer

A complex robot has on-board and off-board computers, and these modules need to communicate. This is achieved synchronously or asynchronously using peer-to-peer communication and a buffering system. ROS has an efficient contention management system called “ROS Computation Graph” that relies on Nodes, Masters, Topics, and Bags to run a more significant number of executables in parallel.

  • ROS Nodes

A node is an instance of an executable in the robot. For example, a node can be a sensor, motor, or processing, or monitoring algorithm. Since each resource acts as an independent Node, these resources can be independently developed using different platforms and architectures.

  • ROS Masters

A ROS Master is a node declaration service that allows nodes to find each other and exchange data. Rather than haphazardly integrating data, this allows the robot’s modules to be more systematic. Each Master has a centralized database that stores data and shares them with the subscribed nodes. If a Node wants data from a particular master, that node should subscribe to the respective master.

  • ROS Topics

According to the subscribe and publish system, data is transferred using topics. A node can publish data to a topic, and the nodes should subscribe to that topic to access the data.

ROS Workspace Environment

  • Default path for catkin build system is
> source /opt/ros/kinetic/share
  • To check the workspace path for the catkin, use
> echo $ROS.PACKAGE_PATH
  • To manage ROS Master communication between nodes and node registers at startup, use this with raster.
> roscore

 

Catking Build System

  • Catking is the ROS build system to generate executables, libraries, and interfaces.
  • Use catkin build instead of catkin_mace.
  • Wherever you build, use >catkin build package name and then update the environment by sourcing.
  • If you want to clean the build, use
> catkin clean
  • Check workspace
> catkin config

 

Installing ROS Kinetic Kame

You must have an ubuntu 16.04 xenial installed machine to follow this tutorial. But if you are having another version of Ubuntu, you can use the respective version of ROS for that version.

  1. Open a new terminal.
  2. Next the machine is setup 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'  
  1. Setup keys by using the following commands.
> sudo apt install curl 
> curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add –
  1. Update Debian indexes
> sudo apt-get update 
  1. Now, your machine is ready to install the full ROS kinetic package. Then install desktop full by using the following command. It will take some time.
> sudo apt-get install ros-kinetic-desktop-full 
  1. Next, we need to set up our workspace environment variables.
> echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc 
> source ~/.bashrc 
  1. By now, you will have successfully installed the ROS into your machine. Try running the roscore command in a new BASH terminal to confirm the successful installation. You will get a terminal as shown below.
> roscore

  1. Next, we need to install dependencies.
> sudo apt install python-rosdep python-reinstall python-reinstall-generator python-wstool build-essential 
  1. Next, rosdep should be installed.
> sudo apt install python-rosdep 
> sudo rosdep init 
> rosdep update 
  1. Since we have done a complete desktop installation of ROS, we already have standalone Gazebo software running. Check it by running the gazebo in a new shell. The GUI might take a while to load up.
> gazebo

2

  1. Now, we should finally install the catkin workspace management.
> sudo apt-get install ros-kinetic-catkin python-catkin-tools

Moveit Pick & Place Demo Tutorial

  1. Moveit should be installed using the prebuild libraries as follows.
> sudo apt install ros-kinetic-moveit
  1. Then, we can create a catkin workspace.
> mkdir -p ~/ws_moveit/src
  1. This is the format of a workspace. In the next step, we must download the required packages into the src directory.
>  cd ~/ws_moveit/src 
>  git clone -b kinetic-devel https://github.com/ros-planning/moveit_tutorials.git
>  git clone -b kinetic-devel https://github.com/ros-planning/panda_moveit_config.git
  1. Then, we should build the packages and install the dependencies
>  cd ~/ws_moveit/src
>  rosdep install -y --from-paths. --ignore-src --rosdistro kinetic
  1. The following commands can configure the catkin workspace.
>  cd ~/ws_moveit
>  catkin config --extend /opt/ros/kinetic
  1. Then, Build your workspace. You will see some directories inside the ws_moveit, like shown below. Please be aware that the src is the only directory we are working with.
>  catkin build

  1. Source the workspace.
> source devel/setup.bash
  1. Now your demo is ready.
> roslaunch panda_moveit_config demo.launch
  1. Open another terminal and source the workspace.
> source devel/setup.bash
> rosrun moveit_tutorials pick_place_tutorial
  1. Your output will look like this.

So, all and all ROS is more than 10 years old now and it has grown to become the biggest robotics developer community on the planet. Due to its open-source nature, everyone can have access and it is easy to find tutorials and guidelines free of charge on the internet. For those who want to continue the journey, here is the ROS wiki page where you can find everything about ROS. Documentation – ROS Wiki.