Ask Your Question

How to source only select workspaces ?

asked 2014-10-24 17:02:15 -0600

2ROS0 gravatar image


There are multiple catkin workspaces on my station (from different users).

If I source the setup.bash of only my workspace in my .bashrc it still sources a couple of other workspaces. Or that's what I think since I can roscd into those packages as well as see it in my ROS_PACKAGE_PATH.

What is the reason for this?

Thank you

edit retag flag offensive close merge delete


If you reset ROS_PACKAGE_PATH and re-source ~/.bashrc, what do you get ? :

source ~/.bashrc

At least you will know exactly what comes from your .bashrc

al-dev gravatar image al-dev  ( 2014-10-24 20:28:36 -0600 )edit

I did. I sourced /opt/ros/hydro/setup.bash. That makes ROS_PACKAGE_PATH have just the hydro default directories. And then I sourced the setup.bash from one of my workspaces devel space. And couple other workspaces are added along with that.

2ROS0 gravatar image 2ROS0  ( 2014-10-24 20:48:48 -0600 )edit

How about deleting your build/ and devel/ from that workspace and rebuilding the whole workspace?

al-dev gravatar image al-dev  ( 2014-10-24 20:53:39 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-26 16:07:17 -0600

Murilo F. M. gravatar image

updated 2014-10-27 16:07:13 -0600

The behaviour your are observing has to do with how catkin workspaces are chained.

At the time you created your catkin workspace, other workspaces had already been created and sourced within the shell you were using.

A quick fix (if you only want to have the system-wide installed ROS packages and your catkin workspace sourced) is:

cd your_catkin_ws/
rm -rf build/ devel/
source /opt/ros/hydro/setup.bash

Then, remember to have only one line in your .bashrc:

source path_to_your_catkin_ws/devel/setup.bash

See the answers (particularly the second one) to this question for a more detailed explanation on how chaining of catkin workspaces actually works.

edit flag offensive delete link more



build and devel are usually not under src. I think it should also be sufficient to only delete build/devel, source the hydro/setup.bash and catkin_make.

dornhege gravatar image dornhege  ( 2014-10-27 07:28:45 -0600 )edit

You are right, there is no need to delete the CmakeLists.txt. Thanks for pointing that out. I'm editing my answer to remove those commands.

Murilo F. M. gravatar image Murilo F. M.  ( 2014-10-27 16:06:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2014-10-24 17:02:15 -0600

Seen: 698 times

Last updated: Oct 27 '14