# Why do we need multiple setup files to overlay the environment?

If I understood correctly, the main purpose of the "setup" files (which can be found in a workspace), when "sourced", is to set up (and change?) a few environment (shell) variables. Anyway, I have a bunch of doubts and questions regarding these concepts.

The documentation http://wiki.ros.org/ROS/Tutorials/Ins... states:

During the installation of ROS, you will see that you are prompted to source one of several setup.*sh files, or even add this 'sourcing' to your shell startup script. This is required because ROS relies on the notion of combining spaces using the shell environment. This makes developing against different versions of ROS or against different sets of packages easier.

I suppose that the mentioned spaces are the "source", the "devel", the "build" and the "install" spaces (which are mentioned here http://wiki.ros.org/catkin/workspaces ). Why do we have/need/want to combine different spaces? What does that even mean? What exactly are we combining from these spaces?

Why exactly combining makes developing against different versions of ROS or against different sets of packages easier?

It also states, at the bottom of the same article:

The catkin_make command is a convenience tool for working with catkin workspaces. Running it the first time in your workspace, it will create a CMakeLists.txt link in your src folder. Additionally, if you look in your current directory you should now have a build and devel folder. Inside the devel folder you can see that there are now several setup.*sh files. Sourcing any of these files will overlay this workspace on top of your environment.

In order to understand a little bit better regarding these concepts, in this particular case, why do we need/want to overlay the workspace using the setup.bash file under the devel directory?

What does "overlay the workspace" exactly mean? According to the documentation (http://wiki.ros.org/catkin/Tutorials/using_a_workspace#Installing_Packages)

Also in the devel space there will be setup.*sh files generated, which when sourced will prefix your environment with this devel space.

What does "prefix your environment with this devel space" exactly mean? How do we know that our environment is prefixed with this devel space?

When do we need to overlay workspaces?

edit retag close merge delete