There is plenty of information available on Internet to start using and learning ROS.
- Exciting Robotics Projects and Tutorials using ROS!
- Topics Covered In The Book.
- Education and Democracy in Senegal;
It is a lot of information to sieve, specially for a newbie on robotics. This book, being the first on ROS I know to the best of my knowledge, comes to the rescue, it will save a lot of your time, if you are just starting with ROS. In my opi ROS ros. In my opinion, the structure of the book has been wisely chosen, starting from installing ROS to finishing on more advanced topics like using really complex robots on simulation, advancing step by step from chapter to chapter growing incrementally in complexity as we advance our reading.
And, albeit, the authors do not present the most updated version of ROS there is, ROS Hydro, all we learn through it, is applicable to it. So, whether you be, an amateur roboticist, a student in robotics engineering, or a seasoned engineer in robotics, willing to give a try to ROS for programming robotic systems, I think this book is a good cicerone to get into it fast and deep. Very interesting reading for those newcomers to ROS.
I will never criticize the old good way of learning something by playing with. But this book combines deep enough theoretical background with hands-on examples, making the learning process both faster and sounder. The result: at the end you will have a good understanding of what is ROS and why it is so powerful, together with practical skills to start working with it and go deeper in the areas you will focus on. The book doesn't and doesn't p Very interesting reading for those newcomers to ROS. The book doesn't and doesn't pretend to extensively cover all aspects of ROS, but to highlight the most important ones and provide hints on how to go deeper if necessary.
Another plus for the book: programmers already familiar with ROS as me will find many interesting tricks and options no always covered in the ROS wiki. For example, the debugging macros are way more powerful that I though. Apr 28, Amino Joulani added it. Trinh Quoc Anh rated it really liked it May 18, Houssam rated it it was amazing Dec 24, George rated it liked it Oct 06, Hal rated it liked it Feb 06, Ahmed rated it liked it Feb 04, Drew O'Malley rated it it was amazing Feb 06, Ahmad Ataka rated it liked it Mar 19, Shi Wan rated it really liked it Jun 25, Mohammed Magdy added it Nov 08, Siegfried-Angel added it Dec 04, Max Nova marked it as to-read Dec 04, How to Signup?
There are mainly 2 options: 1 - Your institution handles itself the process of account creation login and password : Please contact your librarian who will provide you with your access codes. We also invite you to ask your colleagues, friends, professors or librarians for help. They should know how to proceed…. SignIn with your Office account. Sauvegarder l'image. Date: pages: ISBN: If you are a robotic enthusiast who wants to learn how to build and program your own robots in an easy-to-develop, maintainable and shareable way, "Learning ROS for Robotics.
If you need to learn these tools, you can ind a lot of relevant resources on the Internet, or you can ind books on these topics instead. ROS recommends that you install the system using the repository instead of the source code, unless you are an advanced user and you want to make a customized installation; in that case, you may prefer installing ROS using the source code. So to install ROS using the repositories, we will start by coniguring the Ubuntu repository in our system.
Coniguring your Ubuntu repositories In this section, you will learn the steps for installing ROS Hydro in your computer. We assume that you know what an Ubuntu repository is, and how to manage it. Before we start the installation, we need to conigure our repositories. To do that, the repositories need to allow restricted, universe, and multiverse.
- Learning ROS for Robotics Programming.
- Learning ROS for Robotics Programming - Second Edition.
- Lentin Joseph.
- What robots will you program?;
- Understanding Native American Myths.
Make sure that all the listed options are checked as shown in the following screenshot: Normally these options are marked, so you should not have any problem with this step. Setting up your source. It is possible to install ROS Hydro in various versions of the operating system. You can use any of them, but we recommend version Keep in mind that Hydro works in the Precise Pangolin Once you've added the correct repository, your operating system will know where to download programs to install them into your system.
Setting up your keys This step is to conirm that the origin of the code is correct and that no-one has modiied the code or programs without the knowledge of the owner. Normally, when you add a new repository you have to add the keys of that repository, so it is added to your system's trusted list. Installing ROS We are ready to start the installation now, but before we do that it's better to make an update to avoid problems with the libraries and software with a version other than what ROS needs.
Normally it has four different installations, but this depends on the inal use. For example, if you are an advanced user, maybe you only need the basic installation for a robot without much space on the hard disc. For this book, we recommend you use the full installation because it will install everything necessary to practice the examples and tutorials.
You can install the rest of the packages as and when you need them. The rosdep command line too enables you to easily install system dependencies for the source you want to compile and is required to run some core components in ROS. Now rosdep is installed in ROS by default. If you are at this step, you have an installed version of ROS on your system!
To start using it, the system needs to know the location of the executable or binary iles as well as the other commands. To do so, normally you need to execute the next script; if you also install another ROS distro, you can work with both just by calling the script of the one you need each time, since this script simply sets your environment. This is the best test for inding out if you have ROS, and if it is installed correctly. Notice that if you open another shell and type roscore or other ROS commands, it does not work.
This is because it is necessary to execute the script again to conigure the global variables, the path where ROS is installed, and so on. It is very easy to solve this; you just need to add the script at the end of your. It has the coniguration of the shell or terminal, and each time the user opens the terminal, this ile is loaded. So you can add commands or coniguration to make the user's life easy. For this reason, we will add the script at the end of the. So you have several distros living in the same system and need to switch between them.
So you have to make sure that the version you are running is the last one in the ile. Getting rosinstall Now, the next step is to install a command tool that will help us install other packages with a single command. This tool is based in Python, but don't worry, you don't need to know Python to use it.
You have a complete ROS system installed in your system. When I inish a new installation of ROS, I personally like to test two things: that roscore works, and turtlesim. VirtualBox is free and supports all the major operating systems and pretty much every Linux lavor out there. If you don't want to change the operating system of your computer to Ubuntu, tools such as VirtualBox help us virtualize a new operating system in our computers without making any changes. In the following section, we are going to show you how to install VirtualBox and a new installation of Ubuntu.
After this virtual installation, you should have a clean installation to restart your development machine if you have any problems, or to save all the setups necessary for your robot in the machine. The latest version at the time of writing this book is 4. Once installed, you need to download the image of Ubuntu; for this tutorial we will use a copy of Ubuntu with ROS Hydro installed. For this version, the Nootrix team are using torrent to download the virtual machine; I tried this way to download the ile and it works perfectly.
You can ind different virtual machines with Ubuntu and ROS preinstalled, but we are going to use this version because it is referred to in the oficial pages of ROS. Keep the default coniguration and change only the name for the virtual system. This name is how you distinguish this virtual machine from others. You will see a progress bar. It means that VirtualBox is copying the ile with the virtual image, and it is creating a new copy with the new name.
Notice that this process doesn't modify the original ile ROS. The process will take a few minutes depending on your computer. When it inishes, you can start your virtual machine by clicking on the Start button. Remember to select the right machine before you start it. In our case, we only have one but you could have more: Sometimes, you will get an error as shown in the following screenshot. It is because your computer doesn't have the correct drivers to use the USB 2. Now you can restart the virtual machine and it should start without any problems.
Once the virtual machine starts, you should see the next window as seen in the following screenshot. It is the Ubuntu You can run all the examples and stacks that we are going to work with. They wanted an operating system that was stable and user-friendly. The GPIO is an easy way to communicate with sensors and actuators directly from the BeagleBone without intermediaries.
For this reason, it was common to install an operating system based on Ubuntu on the BeagleBone. The ARM technology is booming with the use of mobile devices such as smartphones and tablets. Apart from the increasing computer power of the ARM cortex, the great level of integration and low consumption have made this technology suitable for autonomous robotic systems. In the last few years, multiple ARM platforms for developers have been launched in the market. As this book is focused on ROS, we will list them without entering into detail.
There is a lot of information about Beaglebone Black and Ubuntu ARM available on websites, forums, and books that you can check out. So, an image of Ubuntu ARM is needed. You can obtain an Ubuntu The process described in the preceding webpage works ine, but we have to be careful with the version of Ubuntu used.
As the website is periodically updated, they are now using Ubuntu We will use an Ubuntu This memory space is very limited if we want to use a great part of the ROS Hydro packages. So in order to solve this situation, we can use SD cards with larger space and expand the ile system to occupy all the space available with re-partitioning. So if we want to work with a bigger memory space, it is recommended to expand the Beaglebone Black memory ile system. You can do this by following the commands listed next: 1. On typing n, a new partition will be created; if we type p it will be a primary partition.
And inally, run the following command to execute the expansion of the memory ile system of the operating system. At this point, the process of installation is pretty similar to the PC installation previously explained in this chapter. So, we should be familiar with it.
Setting up the local machine and source. The number of Ubuntu versions compatible with BeagleBone Black are limited, and only active builds can be found for Ubuntu So, it is not possible to make a full-desktop installation. It is recommended to install package by package to ensure that they will work on an ARM platform. We tried a lot of packages, and we could only not install rviz. This allows you to easily install libraries and solving system dependencies for the source you want to compile, and is required to run some core components in ROS. The bashrc setup must use the variables of the version being used only.
With these steps, you have everything necessary installed on your system to start working with ROS and you can also practice the examples in this book. You also have the option of installing ROS using the source code. This option is for advanced users and we recommend you use only the repository as installation as it is more common and normally does not give errors or problems. It is a good idea to play around with ROS and its installation on a virtual machine. That way, if you have problems with the installation or with something else, you can reinstall a new copy of your operating system and start again.
Normally, with virtual machines, you will not have access to real hardware, for example, sensors or actuators. Anyway, you can use it for testing the algorithms. Furthermore, you will start to create nodes and packages and use ROS with examples using Turtlesim. In this level, a group of concepts are used to explain how ROS is internally formed, the folder structure, and the minimum number of iles that it needs to work. The second level is the Computation Graph level where communication between processes and systems happens.
Setting up a developer's PC (after the course)
In this section, we will see all the concepts and systems that ROS has to set up systems, handle all the processes, communicate with more than a single computer, and so on. The third level is the Community level where there are certain tools and concepts to share knowledge, algorithms, and code from any developer. This level is important because ROS can grow quickly with great support from the community.
A package has the minimum structure and content to create a program within ROS. It may have ROS runtime processes nodes , configuration files, and so on. A package manifest is managed with a file called package. To maintain the simplicity of ROS, the stacks were removed, and now, metapackages make up this function. In ROS, there exist a lot of these metapackages; one of them is the navigation stack. It also has certain restrictions in its structure. ROS has a lot of standard types of messages. In the following screenshot, you can see the content of the turtlesim package.
What you see is a series of iles and folders with code, images, launch iles, services, and messages. Keep in mind that the screenshot was edited to show a short list of iles; the real package has more. The workspace Basically, the workspace is a folder where we have packages, edit the source iles or compile packages. It is useful when you want to compile various packages at the same time and is a good place to have all our developments localized. One of the most important files in this space is CMakeLists.
The src folder has this file because it is invoked by CMake when you configure the packages in the workspace. This is used to test the programs without the installation step. Once the programs are tested, you can install or export the package to share with other developers. You have two options with regard to building packages with catkin. The irst one is to use the standard CMake worklow. Another interesting feature of ROS are its overlays. When you are working with a package of ROS, for example, Turtlesim, you can do it with the installed version, or you can download the source ile and compile it to use your modiied version.
ROS permits you to use your version of this package instead of the installed version. This is very useful information if you are working on an upgrade of an installed package. At this moment, perhaps you don't understand the utility of this, but in the next chapters, we will use this feature to create our own plugins.
Packages Usually, when we talk about packages, we refer to a typical structure of iles and folders. You can create a folder for nodes and nodelets or organize it as you want. If you want to see the package dependencies as a graph, you will find a plugin called package graph in rqt.
Select a package and see the dependencies. To move between packages and their folders and iles, ROS gives us a very useful package called rosbash, which provides commands that are very similar to Linux commands. This is similar to the cd command in Linux. This is similar to the ls command in Linux.
The package. If you ind this ile inside a folder, probably this folder is a package or a metapackage. If you open the package. All of this is to make the installation and the distribution of these packages easy. Two typical tags that are used in the package. This is because the new package might use a functionality of another package. The following screenshot is an example of the package. This package does not have other iles, such as code, includes, and so on.
You can convert your stacks and packages from ROS Fuerte to Hydro and catkin using certain rules for migration. With this description, ROS can generate the right source code for these types of messages in several programming languages. Inside that folder, certain iles with the.
A message must have two principal parts: ields and constants. Fields deine the type of data to be transmitted in the message, for example, int32, float32, and string, or new types that you have created earlier, such as type1 and type2. Constants deine the name of the ields. This is used to add the time, frame, and so on.
This permits you to have the messages numbered, to see who is sending the message, and to have more functions that are transparent for the user and that ROS is handling. In ROS, there exist tools to work with messages. The rosmsg tool prints out the message deinition information and can ind the source iles that use a message type. In the upcoming sections, we will see how to create messages with the right tools.
Service descriptions are stored in. There are tools that exist to perform functions with services. The rossrv tool prints out the service descriptions and packages that contain the. If you want to create a service, ROS can help you with the service generator. These tools generate code from an initial speciication of the service. You only need to add the gensrv line to your CMakeLists.
ROS Book and Tutorials - Learning ROS for Robotics Programming - 2nd Edition
In the upcoming sections, you will learn how to create your own services. If you want to have a process that can interact with other nodes, you need to create a node with this process to connect it to the ROS network. Usually, a system will have many nodes to control different functions. You will see that it is better to have many nodes that provide only a single functionality, rather than have a large node that makes everything in the system. Nodes are written with a ROS client library, for example, roscpp or rospy. It also sets up connections between the nodes. If you don't have it in your system, you can't communicate with nodes, services, messages, and others.
In a distributed system, you will have the master in one computer, and you can execute nodes in this or other computers.
ROS Book and Tutorials - Learning ROS for Robotics Programming - 2nd Edition - ROS robotics news
With this parameter, it is possible to configure nodes while it's running or to change the working of the nodes. A message contains data that sends information to other nodes. ROS has many types of messages, and you can also develop your own type of message using standard messages. When a node is sending data, we say that the node is publishing a topic. Nodes can receive topics from other nodes simply by subscribing to the topic. A node can subscribe to a topic, and it isn't necessary that the node that is publishing this topic should exist. This permits us to decouple the production from the consumption.
It's important that the name of the topic be unique to avoid problems and confusion between topics with the same name. Services give us the possibility of interacting with nodes. Also, services must have a unique name. When a node has a service, all the nodes can communicate with it, thanks to ROS client libraries. Bags are an important mechanism to store data, such as sensor data, that can be difficult to collect but is necessary to develop and test algorithms.
You will use bags a lot while working with complex robots. In the following igure, you can see the graphic representation of this level. It represents a real robot working in real conditions. In the graph, you can see the nodes, the topics, which node is subscribed to a topic, and so on. This graph does not represent messages, bags, Parameter Server, and services. It is necessary for other tools to see a graphic representation of them. Using nodes in ROS provides us with fault tolerance and separates the code and functionalities, making the system simpler.
ROS has another type of node called nodelets. These special nodes are designed to run multiple nodes in a single process, with each nodelet being a thread light process. This way, we avoid using the ROS network among them but permit communication with other nodes. With that, nodes can communicate more eficiently, without overloading the network. Nodelets are especially useful for camera systems and 3D sensors, where the volume of data transferred is very high. A node must have a unique name in the system. This name is used to permit the node to communicate with another node using its name without ambiguity.
Throughout this book, we will use roscpp. ROS has tools to handle nodes and give us information about it, such as rosnode. The rosnode tool is a command-line tool used to display information about nodes, such as listing the currently running nodes. A powerful feature of ROS nodes is the possibility of changing parameters while you start the node. This feature gives us the power to change the node name, topic names, and parameter names. We use this to reconigure the node without recompiling the code so that we can use the node in different scenes.
I am sure that you don't understand this at this moment, but you will ind the utility of it in the upcoming chapters. To change parameters in the node, you can do something similar to changing the topic name. Bear in mind that you cannot use names that are reserved by the system.
Topics can be transmitted without a direct connection between nodes, which means that the production and consumption of data are decoupled. A topic can have various subscribers and can also have various publishers, but you can take care about publishing the same topic with different nodes because it can create conlicts. Each topic is strongly typed by the ROS message type used to publish it, and nodes can only receive messages from a matching type. A node can subscribe to a topic only if it has the same message type.
This is the default transport used in ROS. So, it is best suited to tasks such as teleoperation. It is a command-line tool that gives us information about the topic or publishes data directly on the network. It allows us to create and publish data in whatever topic we want, directly from the command line. We will learn to use it in the upcoming sections. Services When you need to communicate with nodes and receive a reply, you cannot do it with topics; you need to do it with services.
Services are developed by the user, and standard services don't exist for nodes. The iles with the source code of the messages are stored in the srv folder. Similar to topics, services have an associated service type that is the package resource name of the. As with other ROS ilesystem-based types, the service type is the package name and the name of the. ROS has two command-line tools to work with services: rossrv and rosservice. With rossrv, we can see information about the services' data structure, and it has exactly the same usage as rosmsg.
The message has a simple structure that uses standard types or types developed by the user. ROS has the rosmsg command-line tool to get information about messages. You can use this data later to visualize what has happened; you can play, stop, rewind, and perform other operations with it. The bag ile can be reproduced in ROS just as a real session can, sending the topics at the same time with the same data. Normally, we use this functionality to debug our algorithms. It tracks publishers and subscribers to topics as well as services.
The role of the master is to enable individual ROS nodes to locate one another. Once these nodes have located each other, they communicate with each other in a peer-to-peer fashion. The master is most commonly run using the roscore command, which loads the ROS master, along with other essential components. Parameter Server Parameter Server is a shared, multivariable dictionary that is accessible via a network. Nodes use this server to store and retrieve parameters at runtime.
ROS distributions play a similar role to Linux distributions. They make it easier to install a collection of software, and they also maintain consistent versions across a set of software. Anyone can sign up for an account, contribute their own documentation, provide corrections or updates, write tutorials, and more. Tutorials to practice with ROS It is time for you to practice what you have learned until now.
In the upcoming sections, you will see examples for you to practice along with the creation of packages, using nodes, using Parameter Server, and moving a simulated robot with Turtlesim. We are going to explain the most used ones. To get information and move to packages and stacks, we will use rospack, rosstack, roscd, and rosls. We use rospack and rosstack to get information about packages and stacks, the path, the dependencies, and so on.
In this workspace, we will have all the code that we will use in this book. The next step is building the workspace. These are the build and devel folders. You will obtain the same result if you close and open a new shell. It is useful after installing any new package.
Building an ROS package Once you have your package created and you have some code, it is necessary to build the package. When you build the package, what happens really is that the code is compiled. If you try to do it in any other folder, the command will fail. Playing with ROS nodes As we explained in the Nodes and nodelets section, nodes are executable programs, and these executables are in the devel space. To practice, and learn about, nodes, we are going to use a typical package called turtlesim.
It is normal because this node runs whenever roscore is run. We can get all the information about this node using parameters. You can see information about the node using rosnode info nameNode. Now, let's see how you interact with the node using topics and services. Learning how to interact with topics To interact and get information about topics, we have the rostopic tool. We only need to publish the topic with the correct name. This means that the irst node is publishing a topic that the second node can subscribe to.
Services allow nodes to send a request and receive a response. The tool that we are going to use to interact with services is called rosservice. This service will create another turtle in another location with a different orientation. ROS has a tool called rosparam to manage Parameter Server. These parameters change the color of the windows that are initially blue. With this parameter, you can save or load the contents of Parameter Server.
This is the basic way of communicating between two nodes, that is, to handle data and do something with this data. The name is message, and the second parameter is the buffer size. If the topic is publishing data quickly, the buffer will keep at 1, Now, we will create the other node. The buffer will be of 1,, and the function to handle the message will be messageCallback: ros::spin ; The ros::spin line is a loop where the node starts to read the topic and when a message arrives, messageCallback is called. You can use your favorite editor or the rosed tool. They are iles where we put a speciication about the type of data to be transmitted and the values of this data.
ROS will use these iles to create the necessary code for us to implement the msg and srv iles to be used in our nodes. Let's start with the msg ile irst. In the example used in the Building the node section, we created two nodes with a standard type message. Now, we are going to learn how to create custom messages with the tools that ROS has. Now, we are going to create a srv ile. These lines permit the coniguration of the messages and services and tell ROS how and what to build.
Using the new srv and msg iles First, we are going to learn how to create a service and how to use it in ROS. Our service will calculate the sum of three numbers. We need two nodes: a server and a client. Remember to put the iles in the src folder. A, int req. B, int req. If you remember, the message has three ields.
- Death, Mourning, and Burial: A Cross-Cultural Reader (The Human Lifecycle: Cross-Cultural Readings)!
- Introduction to the Qualitative Theory of Dynamical Systems on Surfaces.
- About the Author.
If the call succeeds, call will return true, and if not, call will return false. To build the new nodes, edit CMakeList. In these sections, we have created nodes, and we have been executing them in different shells. Imagine working with 20 nodes and the nightmare of executing each one in a shell!
Both are real robots and they are simulated in ROS. The ile has a launch tag; inside this tag, you can see the node tag. This launch ile will execute two nodes—the irst two examples of this chapter. If you take a look, you won't see anything. You will learn more about this utility in the following chapters. Normally, when you are programming a new node, you initialize the variables with data that can only be changed within the node. If you want to change these values dynamically from outside the node, you can use Parameter Server, services, or topics.
If you are working in a PID node to control a motor, for example, you should use the Dynamic Reconigure utility. In this section, you will learn how to conigure a basic node with this feature. Add the necessary lines in the CMakeLists. To use Dynamic Reconigure, you should write a coniguration ile and save it in the cfg folder in your package. The parameter has the following arguments: gen. Notice that the. It is necessary to change the permissions for the ile because the ile will be executed by ROS. The way to access the parameters is, for example, config.
The name of the parameter must be the same as the one that you conigured in the example2. When the server gets a reconiguration request, it will call the callback function. Once we are done with the explanation, we need to add lines to the CMakeLists. You can see an example in the following screenshot: Thanks to Dynamic Reconigure, you can program and test your nodes more eficiently and in a fast way. Using the program with hardware is a good choice and you will learn more about it in the next chapters.
You saw certain concepts, tools, and samples of how to interact with nodes, topics, and services. In the beginning, all of these concepts might look complicated and without use, but in the upcoming chapters, you will start to understand their applications. It is useful to practice using these terms and tutorials before continuing because, in the upcoming chapters, we will assume that you know all of the concepts and uses.
In the next chapter, you will learn how to debug and visualize data using ROS tools. This will help you to ind problems, know whether what ROS is doing is correct, and better deine what your expectations from it are. This comprises a message logging system similar to log4cxx, diagnostic messages and also visualization and inspection tools that show which nodes are running and how are they connected.
The message logging API will be explained, and advice will be given on how to choose the logging level. Then, we will explain the set of ROS tools that are meant to inspect which processes are running and what information is communicated among them. For instance, the following igure shows a tool that visualizes the graph of the system, where the nodes are the processes running and the edges represent the data worklow through communication topics.
We also show how to visualize markers and interactive markers. They run as a process in the operative system and have a PID. Therefore, you can debug them as with any program using standard tools, such as gdb. Similarly, you can check for memory leaks with valgrind or proile the performance of your algorithm with callgrind. Later, we will see how to add a logging message to our code in order to make it simple to diagnose problems that, in practice, helps to diagnose basic problems even without debugging the binaries.
Similar, later on, we will discuss ROS introspection tools that allow detecting broken connections between nodes easily. Therefore, although here we will show you a bottom-up overview, in practice, we follow a top-down approach to diagnose issues. Once roscore is running, you can start your node in gdb by pressing the R key and Enter , and you can also list the associated source code with the L key as well as setting breakpoints or any of the functionalities that gdb comes with.
With this launch preix, a new xterm terminal will be created with the node attached to gdb. Set breakpoints if needed, and then press the C or R key to run the node and debug it. For example, this is useful to obtain a backtrace bt if the node crashes. Proiling a node with valgrind while launching ROS Additionally, we can use the same attribute to attach the node to diagnosis tools. First of all, we have to set an unlimited core size; the current value can be checked with ulimit -a. But we must do it without compromising on the eficiency of our software and the clarity of its output.