Lets start our journey of programming robots by using the Robot Operating System (ROS) . In order to get started with ROS, there are some prerequisites to be satisfied. The prerequisites are to have a good understanding of Linux, especially Ubuntu; a good understanding of Linux shell commands; and Python and C++programming knowledge.
This book discusses all the prerequisite technologies required for robot programming using ROS. This first chapter introduces the Ubuntu operating system, installation, important shell commands, and the important tools for programming robots. If you already work with Ubuntu, you should still go through this chapter. It will refresh your existing understanding of Ubuntu Linux.
Getting Started with GNU/Linux
Linux is an operating system like Windows 10 or Mac OS. Similar to other operating systems, it has capabilities such as communicating and receiving instructions from users, reading/writing data to the disk drive and executing software applications. The important part of any operating system is the kernel . In GNU/Linux system, Linux ( www.linux.org ) is the kernel component. The rest of the components are applications developed by the GNU Project ( www.gnu.org/home.en.html ).
The Linux based OS are inspired from the Unix operating system. The Linux kernel is capable of multitasking in multiuser systems. The good thing is that GNU/Linux is free to use and open source. Users have full control on the operating system, which makes Linux ideal for computer hackers and geeks. Linux is vastly used in servers. The popular Android operating system runs in a Linux kernel . There are many distributions, or flavors, of Linux, which basically uses the Linux kernel as the core component; there are differences in the graphical interface. Some of the most popular Linux distributions are Ubuntu, Debian, and Fedora (see Figure ). The Linux-based operating systems are among the most popular in the world.
Figure 1-1
Logos of various popular Linux distributions
What Is Ubuntu?
Ubuntu ( www.ubuntu.com ) is a popular Linux distribution based on the Debian architecture ( https://en.wikipedia.org/wiki/Debian ). It is freely available for use, and it is open source, so it can be modified according to your application. Ubuntu comes with more than 1,000 pieces of software, including the Linux kernel , a GNOME/KDE desktop environment, and standard desktop applications (word processing, a web browser, spreadsheets, a web server, programming languages, integrated development environment (IDE) , and several PC games). Ubuntu can run on desktops and servers. It supports architectures such as Intel x86, AMD-64, ARMv7, and ARMv8 (ARM64). Ubuntu is backed by Canonical Ltd. ( www.canonical.com ), a UK-based company.
Why Ubuntu for Robotics ?
The software is the heart of any robot. A robot application can be run on an operating system that provide functionalities to communicate with robot actuators and sensors. A Linux-based operating system can provide great flexibility to interact with low-level hardware and provide provision to customize the operating system according to the robot application. The advantages of Ubuntu in this context are its responsiveness, lightweight nature, and high degree of security. Beyond these factors, Ubuntu has great community support and there are frequent releases, which makes Ubuntu an updated operating system. Ubuntu also has long-term support (LTS) releases, which provides user support for up to five years. These factors have led the ROS developers to stick to Ubuntu, and it is the only operating that is fully supported by ROS.
The Ubuntu-ROS combination is an ideal choice for programming robots.
Installing Ubuntu
This section discusses how to install Ubuntu 16.04 LTS. The procedure for installing any Ubuntu version is almost the same. Like any other operating system, a PC should have the recommended system requirements to install Ubuntu. Here are the recommended requirements needed for your PC. After that you can see the detailed procedure of Ubuntu installation.
Recommended PC Requirements
2GHz dual core processor or better
2GB system memory
25GB of free hard drive space
a DVD drive or a USB port for the installer media
Internet access is helpful
Downloading Ubuntu
The first step is to download the DVD/CD ISO image. To download an Ubuntu image, go to www.ubuntu.com/download/desktop .
You can take a look at all Ubuntu releases at http://releases.ubuntu.com .
The DVD image is less than 1GB. It is named ubuntu-16.04.X-desktop-amd64.iso. By default, the ISO image is 64-bit architecture; if your PC RAM size is less than 4GB, you can use 32-bit architecture.
After downloading the desired Ubuntu image, there are two options for installing Ubuntu.
Install on a real PC. This can be done using one of two methods. You can burn the image to a DVD or to a USB drive.
Install in VirtualBox ( www.virtualbox.org ) or VMWare Workstation ( https://my.vmware.com/web/vmware/downloads ). With this method, you have to first install VirtualBox software, and then install Ubuntu on top of it. In this book, we prefer this method because it is safe to work with VirtualBox. Installing on a real PC may cause data loss if you dont do it properly. As a beginner, you can experiment with Ubuntu inside VirtualBox.
Installing VirtualBox
VirtualBox ( www.virtualbox.org ) is a virtualization software that allows an unmodified operating system (with all of its installed software) to run in a special environment on top of your existing operating system. This environment, called a virtual machine , is created by the virtualization software by intercepting access to certain hardware components and certain features. The physical computer is called the host , and the virtual machine is called the guest . The guest can run on the host computer, which thinks that its running on a real machine.
You can install VirtualBox on a host PC running Windows, Linux, OS X, or Solaris ( ). The installation of VirtualBox is easy; you may not have any confusing issues. During installation, you are asked to install virtual drivers. You can accept the driver installation.
Figure 1-2
Downloading the virtual box for Windows host
If you are working in OS X or Linux, choose the platform accordingly. The installation instructions can be found at www.virtualbox.org/manual/ch02.html .
Creating a VirtualBox Machine
The first step in installing Ubuntu in VirtualBox is to create a new virtual machine. If you already installed VirtualBox on your system, you can create the virtual machine by going through the following steps.
Step 1: Adding a New Virtual Machine
After installing VirtualBox on your PC, open it. You see the window shown in Figure .