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

Cannot build rosbuild workspace on top of catkin workspace in Hydro [closed]

asked 2013-09-17 08:11:17 -0500

updated 2013-09-17 08:21:04 -0500

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}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by georgebrindeiro
close date 2013-09-17 08:48:07

Comments

The first `source /opt/ros/hydro/setup.bash` is completely overwritten by the second source line, `source ~/workspaces/hydro/rosbuild_ws/setup.bash `.

William gravatar image William  ( 2013-09-17 08:15:36 -0500 )edit

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`?

William gravatar image William  ( 2013-09-17 08:16:31 -0500 )edit

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.

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-17 08:18:47 -0500 )edit

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."

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-17 08:23:27 -0500 )edit

@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.

William gravatar image William  ( 2013-09-17 08:39:21 -0500 )edit

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.

William gravatar image William  ( 2013-09-17 08:43:18 -0500 )edit

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)

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-17 08:44:54 -0500 )edit

Thanks for the help, William!

georgebrindeiro gravatar image georgebrindeiro  ( 2013-09-17 08:47:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-09-17 08:46:56 -0500

updated 2013-09-17 11:19:27 -0500

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.

edit flag offensive delete link more

Comments

1

It is best (for catkin workspaces) that you only source one setup file at a time. Glad this works for you now.

William gravatar image William  ( 2013-09-17 08:57:53 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-17 08:11:17 -0500

Seen: 1,336 times

Last updated: Sep 17 '13