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

roslaunch can't find launch files with "catkin build"

asked 2015-07-30 07:18:44 -0500

drewm1980 gravatar image

updated 2015-07-30 08:40:01 -0500

If I use "catkin_make" to build my workspace, and re-source my bashrc, then roslaunch is able to find my launch files and the nodes launch just fine.

If I do a "cakin clean -a" and a "cakin build," and re-source my bashrc, roslaunch can't autocomplete my launch files, or run any of the nodes in my workspace.

Here are the ROS related lines from my .bashrc:

export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=http://localhost:11311
export ROS_ROOT=/opt/ros/indigo
export PATH=/opt/ros/indigo/bin:$PATH
source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/indigo/lib

The difference in my environment is only in the ROS_PACKAGE_PATH variable:

with catkin tools ("catkin make"):

ROS_PACKAGE_PATH=/home/awagner/catkin_ws/install/share:/home/awagner/catkin_ws/install/stacks:/home/awagner/catkin_ws/src/image_retriever:/home/awagner/catkin_ws/src/ros-indigo-openni2-camera-0.2.4:/home/awagner/catkin_ws/src/bear_detector:/opt/ros/indigo/share:/opt/ros/indigo/stacks

with catkin_make:

ROS_PACKAGE_PATH=/home/awagner/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

so catkin tools is appending ROS_PACKAGE_PATH with all of the subdirectories of my packages, rather than just the parent package. Is this just a bug in the newer "python-catkin-tools" catkin front-end? Anyone else running into this?

$ rospack profile 
Full tree crawl took
0.018942 seconds. Directories marked with (*) contain no manifest.  You may want to delete these directories. To get just of list of directories without manifests, re-run the profile with --zombie-only
-------------------------------------------------------------
0.015500   /opt/ros/indigo/share
0.001762   /home/awagner/catkin_ws/install/share
0.000158 * /home/awagner/catkin_ws/install/share/libautocalib
0.000139 * /home/awagner/catkin_ws/install/share/libplanview
0.000066 * /home/awagner/catkin_ws/install/share/bearvis
0.000042 * /home/awagner/catkin_ws/install/share/libautocalib/data
0.000027 * /home/awagner/catkin_ws/install/share/libdmd
0.000026 * /home/awagner/catkin_ws/install/share/libpdetect
0.000025 * /opt/ros/indigo/share/doc
0.000023 * /home/awagner/catkin_ws/install/share/libplanview/data
0.000023 * /home/awagner/catkin_ws/install/share/libbeardetect
0.000023 * /home/awagner/catkin_ws/install/share/libdepthio
0.000005 * /opt/ros/indigo/share/doc/liborocos-kdl

My version of catkin tools: $ apt-cache show python-catkin-tools Package: python-catkin-tools Version: 0.3.0-1

I am running ROS Indigo on Ubuntu 14.04

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
4

answered 2017-02-16 13:34:47 -0500

afakih gravatar image

It looks like that you have the catkin install option enabled for your workspace and you do not have install rules for the launch files in the packages CMakeLists.txt.

When install is enabled, source devel/setup.bash will source the install space instead of the devel one. To disable the install option do

catkin config --no-install
catkin clean --all

Then rebuild your workspace.

To add an install rule in your CMakeLists.txt, add:

install(DIRECTORY
launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
edit flag offensive delete link more
1

answered 2015-07-30 07:34:26 -0500

gvdhoorn gravatar image

updated 2015-07-30 08:20:26 -0500

Here are the ROS related lines from my .bashrc:

export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=http://localhost:11311
export ROS_ROOT=/opt/ros/indigo
export PATH=/opt/ros/indigo/bin:$PATH
source /opt/ros/indigo/setup.bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/indigo/lib

Apart from the ROS_HOSTNAME perhaps, all of this should not be necessary (unless you have a rather non-standard setup going on). Could you clarify why you think these should be in your .bashrc?

Sourcing /path/to/your/catkin_ws/devel/setup.bash should setup all the required environment variables to work with packages build in that particular catkin_ws.

If you want, you could add source /path/to/your/catkin_ws/devel/setup.bash to your .bashrc, but the effect should be the same.

If I do a "cakin clean -a" and a "cakin build," and re-source my bashrc, roslaunch can't autocomplete my launch files, or run any of the nodes in my workspace.

Which makes sense, because without sourcing the setup.bash from the workspace you are working with, none of the paths will be setup correctly.

Could you test by starting up a clean terminal, unset all the ROS related environment variables, sourcing the correct setup.bash, running rospack profile and then try roslaunch-ing one of your packages?


Edit:

source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash

This is also not necessary: you only need to source the 'last' workspace. In this case, that would be ~/catkin_ws/devel/setup.bash.

edit flag offensive delete link more

Comments

I actually had sourced the setup.bash; I just missed it when scraping the ROS crap out of my .bashrc into this bug report. Sorry about that. I'm not sure why I'm having to force some of those ros environment variables; still tracking down why I need them.

drewm1980 gravatar image drewm1980  ( 2015-07-30 08:16:05 -0500 )edit

I removed as many ros variables as I could. (ROS_MASTER_URI and ROS_HOSTNAME were needed or roscore hangs on my machine). I rebuilt, re- "rospack profile", started new shell. No change in behavior. Does "catkin make" play well with roslaunch on your machine?

drewm1980 gravatar image drewm1980  ( 2015-07-30 08:37:42 -0500 )edit

Yes, it should not matter whether you use catkin_make or catkin build. Both should result in a working devel or install space. A hanging roscore would suggest issues with DNS resolution, but that is outside the scope of the current issue.

gvdhoorn gravatar image gvdhoorn  ( 2015-07-30 09:07:58 -0500 )edit

Could you remove everything (ROS) from your .bashrc (except HOSTNAME and MASTER_URI), save, start a new terminal, verify no ROS_* variables are set (nor extra entries added to (LD_LIBRARY_)PATH etc). Then source your devel space, try rospack find image_retriever (or something).

gvdhoorn gravatar image gvdhoorn  ( 2015-07-30 09:10:52 -0500 )edit

Hello, thanks for trying to help me with this. There are a bunch of ROS variables set ~outside by my .bashrc (I inherited this laptop from a previous dev), and not in any of the usual places. I will try to track that down first. And I'll just use catkin_build in the mean-time.

drewm1980 gravatar image drewm1980  ( 2015-07-31 06:09:46 -0500 )edit

Biggest problems are mostly caused by the various PATH variables. I'd try to remove all of those first, then work with a 'clean' terminal, only source a single devel/setup.bash and see what works and what doesn't. Then continue from there.

gvdhoorn gravatar image gvdhoorn  ( 2015-07-31 06:33:27 -0500 )edit
0

answered 2021-10-20 23:19:06 -0500

CroCo gravatar image

In my case which was a silly mistake, the launch folder is not inside the package folder.

edit flag offensive delete link more
0

answered 2016-03-06 21:42:38 -0500

I experienced the same issue when switching from catkin_make to catkin build (launch files were not found anymore), except I only experienced it with a subset of package.

By comparing the packages, I have been able to notice that the package which had problem did not contain code, therefore I had 'cleaned' the generated CMakeLists.txt and I had removed the catkin_package() declaration. By adding it back to the CMakeLists.txt, the problem was solved.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-07-30 07:18:44 -0500

Seen: 15,338 times

Last updated: Oct 20 '21