Book Image

ROS Robotics By Example, Second Edition - Second Edition

By : Carol Fairchild, Lentin Joseph, Dr. Thomas L. Harman
Book Image

ROS Robotics By Example, Second Edition - Second Edition

By: Carol Fairchild, Lentin Joseph, Dr. Thomas L. Harman

Overview of this book

ROS is a robust robotics framework that works regardless of hardware architecture or hardware origin. It standardizes most layers of robotics functionality from device drivers to process control and message passing to software package management. But apart from just plain functionality, ROS is a great platform to learn about robotics itself and to simulate, as well as actually build, your first robots. This does not mean that ROS is a platform for students and other beginners; on the contrary, ROS is used all over the robotics industry to implement flying, walking and diving robots, yet implementation is always straightforward, and never dependent on the hardware itself. ROS Robotics has been the standard introduction to ROS for potential professionals and hobbyists alike since the original edition came out; the second edition adds a gradual introduction to all the goodness available with the Kinetic Kame release. By providing you with step-by-step examples including manipulator arms and flying robots, the authors introduce you to the new features. The book is intensely practical, with space given to theory only when absolutely necessary. By the end of this book, you will have hands-on experience on controlling robots with the best possible framework.
Table of Contents (18 chapters)
ROS Robotics By Example Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Creating a catkin workspace


The next step is to create a catkin workspace. A catkin workspace is a directory (folder) in which you can create or modify existing catkin packages. The catkin structure simplifies the build and installation process for your ROS packages. The ROS wiki website is http://wiki.ros.org/catkin/Tutorials/create_a_workspace.

A catkin workspace can contain up to three or more different subdirectories (/build, /devel, and /src), each of which serve a different role in the software development process.

We will label our catkin workspace catkin_ws. To create the catkin workspace, type the following commands:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace

Even though the workspace is empty (there are no packages in the src folder, just a single CMakeLists.txt link), you can still build the workspace by typing the following commands:

$ cd ~/catkin_ws/
$ catkin_make

The catkin_make command creates the catkin workspace. If you view your current directory contents, you should now have the build and devel folders. Inside the devel folder there are now several setup.*sh files. We will source the setup.bash file to overlay this workspace on top of your ROS environment:

$ source ~/catkin_ws/devel/setup.bash

Remember to add this source command to your .bashrc file by typing the following command:

$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

To make sure your workspace is properly overlaid by the setup script, make sure the ROS_PACKAGE_PATH environment variable includes the directory you're in by typing the following command:

$ echo $ROS_PACKAGE_PATH

The output of the preceding command should be as follows:

/home/<username>/catkin_ws/src:/opt/ros/kinetic/share

Here, <username> is the name you chose for the user when Ubuntu was installed.