The workspace

In general terms, the workspace is a folder which contains packages, those packages contain our source files and the environment or workspace provides us with a way to compile those packages. It is useful when you want to compile various packages at the same time and it is a good way of centralizing all of our developments.

A typical workspace is shown in the following screenshot. Each folder is a different space with a different role:

  • The source space: In the source space (the src folder), you put your packages, projects, clone packages, and so on. One of the most important files in this space isCMakeLists.txt. The src folder has this file because it is invoked by cmake when you configure the packages in the workspace. This file is created with the catkin_init_workspace command.
  • The build space: In the build folder, cmake and catkin keep the cache information, configuration, and other intermediate files for our packages and projects.
  • Development (devel) space: The devel folder is used to keep the compiled programs. 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 first one is to use the standard CMake workflow. With this, you can compile one package at a time, as shown in the following commands:

    $ cmake packageToBuild/
    $ make  

If you want to compile all your packages, you can use the catkin_make command line, as shown in the following commands:

    $ cd workspace
    $ catkin_make  

Both commands build the executable in the build space directory configured in ROS.

Another interesting feature of ROS is 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 file and compile it to use your modified 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. You might not understand the utility of this at the moment, but in the following chapters we will use this feature to create our own plugins.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.229.253