0
$\begingroup$

Rosanswers logo

Hi everyone,

I don't know why, but I cannot get my catkin/rosbuild workspace setup to work in ROS Hydro. I have done everything the same way as I have done in Groovy, but when I source setup.bash from my Hydro rosbuild_ws I find that my $ROS_PACKAGE_PATH contains only the native ROS folders.

I appreciate any attempts to help me debug this issue, as I have gone as far as looking deeply into the auto-generated files that are sourced to find any differences that might lead to this behavior... The workspace files are essentially the same, so I am led to believe that the issue is with the native setup files.

As a reference, I am following these ROS tutorials:

ROS Groovy

georgebrindeiro@r2d2:~$ echo $ROS_PACKAGE_PATH
/home/georgebrindeiro/workspaces/groovy/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks

ROS Hydro

georgebrindeiro@r2d2:~$ echo $ROS_PACKAGE_PATH
/opt/ros/hydro/share:/opt/ros/hydro/stacks

This is the relevant portion of my ~/.bashrc:

(I always uncomment the corresponding ROS distro line and the rosbuild line when switching distros)

## ROS config ##
export ROS_MASTER_URI=http://localhost:11311
#export ROS_MASTER_URI=http://aramis:11311
#export ROS_MASTER_URI=http://athos:11311
#export ROS_MASTER_URI=http://porthos:11311

#source /opt/ros/groovy/setup.bash
source /opt/ros/hydro/setup.bash

#source ~/workspaces/groovy/catkin_ws/devel/setup.bash
#source ~/workspaces/groovy/rosbuild_ws/setup.bash

#source ~/workspaces/hydro/catkin_ws/devel/setup.bash
source ~/workspaces/hydro/rosbuild_ws/setup.bash

export ROSCONSOLE_CONFIG_FILE=~/.ros/rosconsole.config
alias roslog='gedit $ROSCONSOLE_CONFIG_FILE'
alias rosversion='echo $ROS_DISTRO'

EDIT: Here are my .rosinstall files

ROS Groovy

- setup-file: {local-name: /home/georgebrindeiro/workspaces/groovy/catkin_ws/devel/setup.sh}

ROS Hydro

# IT IS UNLIKELY YOU WANT TO EDIT THIS FILE BY HAND,
# UNLESS FOR REMOVING ENTRIES.
# IF YOU WANT TO CHANGE THE ROS ENVIRONMENT VARIABLES
# USE THE rosinstall TOOL INSTEAD.
# IF YOU CHANGE IT, USE rosinstall FOR THE CHANGES TO TAKE EFFECT
- setup-file: {local-name: /home/georgebrindeiro/workspaces/hydro/catkin_ws/devel/setup.sh}

Originally posted by georgebrindeiro on ROS Answers with karma: 1264 on 2013-09-17

Post score: 0


Original comments

Comment by William on 2013-09-17:
The first source /opt/ros/hydro/setup.bash is completely overwritten by the second source line, source ~/workspaces/hydro/rosbuild_ws/setup.bash .

Comment by William on 2013-09-17:
A rosbuild workspace generates it's setup files when the workspace is created, where as a catkin workspace generates them when it is built. Can you post the contents of ~/workspaces/hydro/rosbuild_ws/.rosinstall?

Comment by georgebrindeiro on 2013-09-17:
I didn't realize that! That's how I have always done it, though. Shouldn't the second line be including catkin_ws in $ROS_PACKAGE_PATH as well, though? As I said, I do the exact same thing with ROS Groovy and get a different result.

Comment by georgebrindeiro on 2013-09-17:
I was able to get my previous behavior by sourcing both the catkin_ws and the rosbuild_ws setup files. Does that mean that the following line in the tutorials is deprecated?

"You can source the generated rosbuild_ws/setup.sh files to work with both the rosbuild and the catkin workspace."

Comment by William on 2013-09-17:
@georgebrindeiro, That line is still valid. The rosbuild workspace just refers to another setup file. The catkin workspace reconstructs the environment it was built in (regardless of the environment before sourcing it). Can you try rosws regerenate? That should recreate the setup.*sh in the rosbuild workspace.

Comment by William on 2013-09-17:
In this case, the first source in your bashrc sets up your environment to use the /opt/ros/hydro workspace, but the second line (indirectly sources ~/workspaces/hydro/catkin_ws/devel/setup.sh) unsets this and sets up the state of the environment when that workspace, ~/workspaces/hydro/catkin_ws/devel/, was built, which just happens to be the /opt/ros/hydro workspace. So it only appears to be "updating" or adding to the previous source line.

Comment by georgebrindeiro on 2013-09-17:
I ran rosws regenerate and it didn't work immediately. I tried commenting all lines except the one refering to the rosbuild_ws and it worked. So I guess the issue is that sourcing the rosbuild_ws line does not completely overwrite the native distro line (at least to the extent of some env variables)

Comment by georgebrindeiro on 2013-09-17:
Thanks for the help, William!

Comment by Johannes Meyer on 2013-09-17:
This erroneous behavior of catkin when chaining workspaces was reported here: https://github.com/ros/catkin/issues/505. Should be fixed in the upcoming catkin release. Your answer is correct nevertheless, but not the root cause of your original problem.

Comment by georgebrindeiro on 2013-09-17:
Thanks for the additional info! I'll add it to my answer for the sake of completeness.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should only source one setup.bash file at any point in time. The problem was found to be sourcing multiple setup.bash files at once, which apparently used to work by sheer luck. My suggestion is that be made clearer in the tutorials, since I obviously missed the point until today :)

EDIT: The real reason why this is happening is because of erroneous behavior of catkin when chaining workspaces, as reported here: https://github.com/ros/catkin/issues/505. Should be fixed in the upcoming catkin release.


Originally posted by georgebrindeiro with karma: 1264 on 2013-09-17

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by William on 2013-09-17:
It is best (for catkin workspaces) that you only source one setup file at a time. Glad this works for you now.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.