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

How to source only select workspaces ?

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

2ROS0 gravatar image

Hi,

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

Comments

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

export ROS_PACKAGE_PATH=
source ~/.bashrc
echo $ROS_PACKAGE_PATH

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

al-dev gravatar image al-dev  ( 2014-10-24 20:28:36 -0500 )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 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

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

Murilo F. M. gravatar image

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

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
catkin_make

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

Comments

1

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 -0500 )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 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 1,868 times

Last updated: Oct 27 '14