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 Programming: Building Powerful Robots

You're reading from   ROS Programming: Building Powerful Robots Design, build and simulate complex robots using the Robot Operating System

Arrow left icon
Product type Course
Published in Mar 2018
Publisher Packt
ISBN-13 9781788627436
Length
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (5):
Arrow left icon
Anil Mahtani Anil Mahtani
Author Profile Icon Anil Mahtani
Anil Mahtani
Aaron Martinez Aaron Martinez
Author Profile Icon Aaron Martinez
Aaron Martinez
Lentin Joseph Lentin Joseph
Author Profile Icon Lentin Joseph
Lentin Joseph
Enrique Fernandez Perdomo Enrique Fernandez Perdomo
Author Profile Icon Enrique Fernandez Perdomo
Enrique Fernandez Perdomo
Luis S√°nchez Luis S√°nchez
Author Profile Icon Luis S√°nchez
Luis S√°nchez
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (37) Chapters Close

Title page
Copyright and Credits
Packt Upsell
Preface
1. Getting Started with ROS FREE CHAPTER 2. ROS Architecture and Concepts 3. Visualization and Debugging Tools 4. The Navigation Stack - Robot Setups 5. The Navigation Stack - Beyond Setups 6. Manipulation with MoveIt! 7. Using Sensors and Actuators with ROS 8. Computer Vision 9. Point Clouds 10. Working with 3D Robot Modeling in ROS 11. Simulating Robots Using ROS and Gazebo 12. Working with Pluginlib, Nodelets, and Gazebo Plugins 13. Writing ROS Controllers and Visualization Plugins 14. Interfacing I/O Boards, Sensors, and Actuators to ROS 15. Programming Vision Sensors using ROS, Open-CV, and PCL 16. Building and Interfacing Differential Drive Mobile Robot Hardware in ROS 17. Exploring the Advanced Capabilities of ROS-MoveIt! 18. ROS for Industrial Robots 19. Troubleshooting and Best Practices in ROS 20. Face Detection and Tracking Using ROS, OpenCV and Dynamixel Servos 21. Building a Siri-Like Chatbot in ROS 22. Controlling Embedded Boards Using ROS 23. Teleoperate a Robot Using Hand Gestures 24. Object Detection and Recognition 25. Deep Learning Using ROS and TensorFlow 26. ROS on MATLAB and Android 27. Building an Autonomous Mobile Robot 28. Creating a Self-Driving Car Using ROS 29. Teleoperating a Robot Using a VR Headset and Leap Motion 30. Controlling Your Robots over the Web 1. Bibliography
2. Other Books You May Enjoy Index

Using ROS from a Docker image


Docker is an open platform that helps to distribute applications and complete systems. In some ways, it is similar to a virtual machine, but it is much faster and more flexible; see https://www.docker.com or https://dockerproject.org for more information.

Installing Docker

In order to install it in Ubuntu, you only have to run the following:

$ sudo apt-get install docker.io

Getting and using ROS Docker images and containers

Docker images are like virtual machines or systems already set up. There are servers that provide images like this, so the users only have to download them. The main server is Docker hub, found at https://hub.docker.com. There, it is possible to search for Docker images for different systems and configurations. In our case, we are going to use ROS Kinetic images already available. All ROS Docker images are listed in the official ROS repo images on the web at https://hub.docker.com/_/ros/. The ROS container image is pulled down with the following command:

$ docker pull ros

There's a possibility that you may see this error:

You should either update your system or try adding your user to the docker group to resolve this:

$ sudo usermod -a -G docker $(whoami)

You should see multiple Docker images getting downloaded simultaneously. Each image has a different hash name. This will take some time, especially on slow networks. You will see something like the following once it is done:

The ROS Kinetic distribution can be pulled down using the corresponding tag, using the following command:

$ docker pull ros:kinetic-robot

Although you do not need to know it, the images and containers are stored by Docker in /var/lib/docker by default.

Once the container is downloaded, we can run it interactively with the following command:

$ docker run -it ros

This will be like entering a session inside the Docker container. This command will create a new container from the main image. Inside it we have a full Ubuntu system with ROS Kinetic already installed. We can install additional packages and run ROS nodes, as in a regular system. With docker ps -a, you can check all the containers available and the image they come from.

We have to set up the ROS environment inside the container in order to start using ROS. That is, we have to run the following command:

$ source /opt/ros/kinetic/setup.bash

Docker containers can be stopped from other terminals using docker stop, and they can also be removed with docker rm. Docker also allows you to configure the container to expose the network, as well as mounting a host folder as volumes into it. In addition to this, it also supports a Python API, and has many other features. All this can be found in the official documentation at https://docs.docker.com. However, in principle, docker run should be enough, and we can even SSH into a running Docker container, as a regular machine, using its name. We can also open another terminal for a running container with the following command (where NAME is the name of the Docker container, that you can fine using docker ps -a):

$ docker exec -it NAME bash

You can also create your own Docker images using docker build and specify what should be installed in them in Dockerfile. You can even publish them online with docker push, contributing them to the community or simply sharing your working setup. This section comes with a working Docker image and Dockerfile to build it, and you can find this by running docker build from the same folder where Dockerfile is. This Docker image is basically an extension of the ROS Kinetic one with the code of the section. The instructions to download and install it would be on the GitHub repository with the rest of the code. 

You have been reading a chapter from
ROS Programming: Building Powerful Robots
Published in: Mar 2018
Publisher: Packt
ISBN-13: 9781788627436
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