ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

First of all, it would be beneficial if you describe your layout in more detail.


Assumption

I'm answering now on the following assumption:

~/catkin_ws
     |-> build
     |-> devel
     |-> src
           |-> pkgA
                  |-> no src folder available
           |-> pkgB
                 |-> src (etc.) available

You got this workspace in a compiled state and you source ~/catkin_ws/devel/setup.bash to use it. pkgA is the one where the src has been deleted and thus cannot be compiled. The compiled binaries do reside in devel, though. You want to adapt pkgB.


Solution to your problem

The solution is actually pretty simple. Leave the ~/catkin_ws alone and use workspace chaining. In detail:

mkdir -p ~/my_catkin_ws/src                 # create a new workspace
source ~/catkin_ws/devel/setup.bash         # source the old one
cd ~/my_catkin_ws
catkin_make                                 # compile the new one
source ~/my_catkin_ws/devel/setup.bash      # now use the chained workspaces.

Then put a copy of pkgB (you do have the sources of this one) and any new packages you create into my_catkin_ws/src. Call catkin_make only in your new workspace. This allows you to use this pkgB and the pkgA of ~/catkin_ws.


What the other guy should have done

Don't pass around compiled workspaces, this makes no sense and is very error prone. You could, though install to a good place using catkin_make install (right install rules provided) and pass this directory around.