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
Robot Operating System Cookbook

You're reading from   Robot Operating System Cookbook Over 70 recipes to help you master advanced ROS concepts

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781783987443
Length 484 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kumar Bipin Kumar Bipin
Author Profile Icon Kumar Bipin
Kumar Bipin
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with ROS 2. ROS Architecture and Concepts I FREE CHAPTER 3. ROS Architecture and Concepts – II 4. ROS Visualization and Debugging Tools 5. Accessing Sensors and Actuators through ROS 6. ROS Modeling and Simulation 7. Mobile Robot in ROS 8. The Robotic Arm in ROS 9. Micro Aerial Vehicles in ROS 10. ROS-Industrial (ROS-I) 11. Other Books You May Enjoy

Installing the ROS packages

Before the installation of the ROS packages, make sure our Debian package index is up-to-date:

$ sudo apt-get update

There are many different libraries and tools in ROS—not all compile fully on ARM. So, it is not possible to make a full desktop installation. We should install ROS packages individually.

We could install ros-base (Bare Bones), which includes the ROS package, build, and communication libraries, but does not include GUI tools (press ENTER (Y) when prompted):

$ sudo apt-get install ros-<ros_version>-ros-base

However, we could try to install the desktop installation, which includes the ROS, rqt, RViz, and robot-generic libraries:

$ sudo apt-get install ros-<ros_version>-desktop

Adding individual packages

We can install a specific ROS package:

$ sudo apt-get install ros-<ros_version>-PACKAGE

Find available packages with the following command:

$ apt-cache search ros-<ros_version>

Initializing rosdep

The rosdep command-line tool must be installed and initialized before we can use ROS. This allows us to easily install libraries and solve system dependencies for the source we want to compile, and is required to run some core components in ROS:

$ sudo apt-get install python-rosdep $ sudo rosdep init $ rosdep update

Environment setup

Well done! We have completed the ROS installation for the ARM platform. The ROS scripts and executables are mostly installed in /opt/ros/<ros_version>.

To get access to these scripts and executables, the ROS environment variables need to be added to the bash session. We have to source the following bash file:

$ source /opt/ros/<ros_version>/setup.bash

It's convenient if the ROS environment variables are automatically added to the bash session every time a new shell is launched:

$ echo "source /opt/ros/<ros_version>/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

If we have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version we are currently using:

$ source /opt/ros/<ros_version>/setup.bash

Getting rosinstall

rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables us to easily download several source trees for the ROS packages with a single command.

This tool is based on Python and can be installed using the following command:

$ sudo apt-get install python-rosinstall

As a basic example, we could run an ROS core on one terminal:

$ roscore

And from another terminal, we can publish a pose message:

$ rostopic pub /dummy geometry_msgs/Pose Position: x: 3.0 y: 1.0 z: 2.0 Orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 -r 8

Moreover, we could set ROS_MASTER_URI on our desktop system (in the same network) to point to our ARM Platform (IP 192.168.X.X).

On your laptop, add the following:

$ export ROS_MASTER_URI=http://192.168.1.6:11311

And, we will see pose published from the ARM platform to our laptop.

On your laptop, add the following:

$ rostopic echo -n2 /dummy Position: x: 1.0 y: 2.0 z: 3.0 Orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 ---
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