Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ROS Robotics By Example, Second Edition

You're reading from   ROS Robotics By Example, Second Edition Learning to control wheeled, limbed, and flying robots using ROS Kinetic Kame

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781788479592
Length 484 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Authors (3):
Arrow left icon
Dr. Thomas L. Harman Dr. Thomas L. Harman
Author Profile Icon Dr. Thomas L. Harman
Dr. Thomas L. Harman
Lentin Joseph Lentin Joseph
Author Profile Icon Lentin Joseph
Lentin Joseph
Carol Fairchild Carol Fairchild
Author Profile Icon Carol Fairchild
Carol Fairchild
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with ROS 2. Creating Your First Two-Wheeled ROS Robot (in Simulation) FREE CHAPTER 3. Driving Around with TurtleBot 4. Navigating the World with TurtleBot 5. Creating Your First Robot Arm (in Simulation) 6. Wobbling Robot Arms Using Joint Control 7. Making a Robot Fly 8. Controlling Your Robots with External Devices 9. Flying a Mission with Crazyflie 10. Controlling Baxter with MATLAB© Index

ROS packages and manifest

The ROS software is divided into packages that can contain various types of programs, images, data, and even tutorials. The specific contents depend on the application for the package. The site http://wiki.ros.org/Packages discusses ROS packages.

A package can contain programs written in Python or C++ to control a robot or another device. For the turtlesim simulator package, for example, the package contains the executable code used to change the background color or move a turtle around on the screen. This package also contains images of a turtle for display and files used to create the simulator.

There is another class of packages in ROS called metapackages that are specialized packages that only contain a package.xml manifest. Their purpose is to reference one or more related packages, which are loosely grouped together.

ROS manifest

Each package contains a manifest named package.xml that describes the package in the Extensible Markup Language (XML) format. In addition to providing a minimal specification describing the package, the manifest defines properties about the package such as the package name, version numbers, authors, maintainers, and any dependencies on other packages.

Exploring the ROS packages

Occasionally, we would like to find packages that we wish to use and display the files involved. This section introduces several useful ROS commands:

  • rospack used for information about a package
  • roscd used to navigate the ROS directories
  • rosls used to list directories and files in a package directory

The rospack command can be used to list ROS packages, locate packages by name, and determine if a package depends on another package, among other uses. For more information use the following command with the help or -h option in the form:

$ rospack help | less

We will use the turtlesim package for the examples here. To change directories to the location of turtlesim, use the following command:

$ roscd turtlesim

This changes the location on one of the author's workstations as follows:

linux@D158-45929:/opt/ros/kinetic/share/turtlesim$

On your computer, the $ command prompt will be preceded by the information about your computer. Generally, that information for our computers will be deleted in our examples using ROS commands. Once you are in the turtlesim directory, the standard Linux commands can be used with the subdirectories or files, or the ROS commands can be used. To determine the directories and files in the turtlesim directory but without changing to the turtlesim directory, use the following command:

$ rosls turtlesim

Here is the result from the home directory of the author's workstation with ROS installed:

cmake images  msg package.xml srv

To see the filenames of the images loaded with turtlesim, specify the images directory in the package as follows:

$ rosls turtlesim/images

The output of the preceding command is as follows:

box-turtle.png   groovy.png  indigo.svg   palette.png
diamondback.png  hydro.png   jade.png     robot-turtle.png
electric.png     hydro.svg   kinetic.png  sea-turtle.png
fuerte.png       indigo.png  kinetic.svg  turtle.png

There are various turtle images that can be used. The rosls turtlesim command will also work to show the contents of the turtlesim subdirectories: /msg for messages and /srv for services. These files will be discussed later. To see the manifest, type the following commands:

$ roscd turtlesim
$ cat package.xml

This will also show the dependencies, such as roscpp for C++ programs.

rospack find packages

The rospack find <package name> command returns the path to the package named <package name>. For example, type the following command:

$ rospack find turtlesim

The preceding command displays the path to the turtlesim directory.

rospack list

Execute the following command:

$ rospack list

This lists the ROS package names and their directories on the computer. In the case of the workstation mentioned earlier, there are 195 ROS packages listed!

Tip

If you really want to see all the ROS packages and their locations, use the following command form:

$ rospack list | less

This form allows paging of the long list of names and directories for the packages. Press Q to quit.

Alternatively, this is the form of the rospack command:

$ rospack list-names

This lists only the names of the packages without the directories. After such a long list, it is a good idea to open a new terminal window or clear the window with the clear command.

This is the form of the rospack command:

$ rospack list-names | grep turtle

This lists the packages with turtle in the name.

More information on commands that are useful to navigate the ROS filesystem is available at the ROS website http://wiki.ros.org/ROS/Tutorials/NavigatingTheFilesystem

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime