Using the structure of the Robot Operating System to enable complex functionalities

As you can see, communicating between different aspects of our project can be challenging. In this section, I'm going to introduce you to a special operating system that is designed specifically for use with robotic projects, the Robot Operating System (ROS). This operating system works on top of Linux and provides some interesting functionality.

The operating system is available at www.ros.org. However, the most useful link to the Wiki for the ROS is wiki.ros.org. If you visit this link, you will find a complete set of documentation and downloads. There are also a number of resources that can be useful if you'd like to learn more about the ROS in depth. One of the better resources is the book Learning ROS for Robotics Programming, Martinez and Fernandez, Packt Publishing.

This section will not cover the ROS in detail but will introduce you to some of the basics. Start by going to the www.ros.org website. If you select Install, you'll note that there is a wide range of Linux operating systems and hardware support. You'll also note that there are several different versions or releases of the ROS. Some of the later releases are Hydro, Fuerte, and Groovy. One of the challenges of using an operating system like this is to decide which release to use. The most recent release will have the largest number of features. It may also have a significant number of issues that may cause problems.

I often prefer using a past release that has been used by a larger number of people; that way, I run into fewer problems. I also don't like to build large packages like this myself. It can take a great deal of time, and often, you'll run into cryptic error messages that can take days to resolve. So, for this tutorial, I am going to use an older version that I have been successful with in the past. It is called Groovy, and while it is not the latest version, it is very stable and easy to use.

Note

The ROS brings with it quite a bit of code. If you are going to work with the ROS, I would recommend that you have at least an 8 GB card installed on Raspberry Pi.

I normally follow the installation instructions at http://wiki.ros.org/groovy/Installation/Raspbian. The following are the instructions in a step-by-step form:

  1. Add the repository to your apt sources. This is the place where your apt-get appears when it is trying to find packages to install. The following is the command:
    sudo sh -c 'echo "deb http://64.91.227.57/repos/rospbian wheezy main" > /etc/apt/sources.list.d/rospbian.list'
    
  2. Next, add the following apt key:
    wget http://64.91.227.57/repos/rospbian.key -O - | sudo apt-key add -
    
  3. When you add the command, you should get the following screenshot:
    Using the structure of the Robot Operating System to enable complex functionalities
  4. Now, reload the apt sources so that your Raspberry Pi will know where the files are by typing sudo apt-get update.
  5. Now, install the ROS packages. Installing ros_comm will install all the significant packages you'll need by typing sudo apt-get install ros-groovy-ros-comm. The package is quite large and will take some time.
  6. Before you can use the ROS, you'll need to install and initialize rosdep to let you track dependencies and run some core features. Type sudo rosdep init and then rosdep update.
  7. You'll also want to set up the ROS environment variables so that they are automatically added to your session every time you launch a terminal window. To perform this, type echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc and then source ~/.bashrc.
  8. To add one more tool, python-rosinstall, which can help in installing the ROS packages, type sudo apt-get install python-rosinstall.
  9. As a check to make sure the ROS is set up correctly, type export | grep ROS. You should see the following screenshot:
    Using the structure of the Robot Operating System to enable complex functionalities
  10. Once installed, you should go through the tutorials at wiki.ros.org/ROS/Tutorials; they will introduce you to the features of the ROS and how to use it in our robotic projects. You will learn how it can provide a systematic way of configuring and communicating between multiple features running in different programs. It even comes with some programs that implement some interesting vision and motor control capabilities. The following is the TurtleSim tutorial running on Raspberry Pi:
    Using the structure of the Robot Operating System to enable complex functionalities

One of the really powerful features of the ROS is its ability to show you how your information is flowing between applications. As you follow the tutorial, you will end up with two applications running, teleop_turtle and turtlesim. In this example, you can use an application called rqt_graph to record the flow of information between the two applications, as shown in the output in the following screenshot:

Using the structure of the Robot Operating System to enable complex functionalities

It will be very difficult to illustrate all of the functionalities of the ROS here. It may take a bit of time, but you can learn to use the ROS to give your robot more functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.249.158