Ask Your Question
4

rosrun not finding executable

asked 2013-04-09 02:35:30 -0500

exuvo gravatar image

updated 2013-04-09 03:34:10 -0500

I am at the "Writing a Simple Publisher and Subscriber (C++)" step in the tutorial and catkin_make works and i can manually run both talker and listener correctly from ~/code/catkin_ws/devel/lib/beginner_tutorials/ where the binaries are. The issue is that rosrun can't find them:

$ rosrun beginner_tutorials talker                       
[rosrun] Couldn't find executable named talker below /home/exuvo/code/catkin_ws/build/beginner_tutorials/catkin_generated/stamps/beginner_tutorials

I do not understand why it's not looking in the correct place as the ros path looks correct to me.

$ echo $ROS_PACKAGE_PATH                                 
/home/exuvo/code/catkin_ws:/opt/ros/groovy/share:/opt/ros/groovy/stacks

Any ideas what I am doing wrong?

Edit:

$ rospack profile
0.020060   /opt/ros/groovy/share
0.009610   /home/exuvo/code/catkin_ws
0.005365   /home/exuvo/code/catkin_ws/build
0.005278 * /opt/ros/groovy/share/common-lisp
0.005180 * /opt/ros/groovy/share/common-lisp/ros
0.002913 * /home/exuvo/code/catkin_ws/devel
0.002156   /home/exuvo/code/catkin_ws/build/beginner_tutorials
0.001267   /home/exuvo/code/catkin_ws/build/serial
0.001108 * /home/exuvo/code/catkin_ws/devel/share
0.001090 * /home/exuvo/code/catkin_ws/build/beginner_tutorials/CMakeFiles
0.000988 * /home/exuvo/code/catkin_ws/devel/lib
0.000923 * /home/exuvo/code/catkin_ws/build/serial/CMakeFiles
0.000882 * /home/exuvo/code/catkin_ws/src
0.000745   /home/exuvo/code/catkin_ws/build/beginner_tutorials/catkin_generated
0.000624   /home/exuvo/code/catkin_ws/build/kbot
0.000565 * /home/exuvo/code/catkin_ws/build/CMakeFiles
0.000561 * /home/exuvo/code/catkin_ws/src/kbot
0.000554 * /opt/ros/groovy/share/common-lisp/ros/std_msgs
0.000554   /home/exuvo/code/catkin_ws/build/kbot/kbot_bridge
0.000468 * /opt/ros/groovy/share/common-lisp/ros/sensor_msgs

OS: Arch Linux. Kernel: 3.8.5-1-ARCH x86_64. ROS: Desktop Install built from source.

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted
3

answered 2013-04-09 02:58:08 -0500

Usually $ rospack profile helps. As I understand it crawls through the directories in ROS_PACKAGE_PATH and updates the list of available packages.

P.S. How did you initialize the catkin workspace? The path looks truncated, i.e. it should be /home/exuvo/code/catkin_ws/src with src at the end, at least on my system it is like this. Just in case here is the tutorial.

edit flag offensive delete link more

Comments

My code is in ~/code/catkin_ws/src/beginner_tutorials as it should and the symlink to catkins toplevel CMakeLists exists in src. When i run catkin_make in ~/code/catkin_ws it creates the build and devel folders and find search gave me the path to the working executables.

exuvo gravatar imageexuvo ( 2013-04-09 03:31:20 -0500 )edit

So, have you tried rospack profile?

Boris gravatar imageBoris ( 2013-04-09 03:34:05 -0500 )edit

I edited the main post with the output, rosrun still not working. Should i somehow exclude the build folder? Do I need to run something more than catkin_make for rosrun to find things?

exuvo gravatar imageexuvo ( 2013-04-09 03:37:29 -0500 )edit

I found the error! I had missed the last line in the link you gave "source devel/setup.bash". I was only sourcing the global and adding the ros path manually. I thought you meant "catkin_init_workspace" when you wrote initialize workspace which i had done.

exuvo gravatar imageexuvo ( 2013-04-09 03:44:28 -0500 )edit

Great! One question though - did you initialize catkin workspace in catkin_ws/src or somewhere else? Maybe that is the effect of not sourcing devel/setup.bash, however, catkin_generated shouldn't be anywhere in catkin_ws/src, but in the catkin_ws/build.

Boris gravatar imageBoris ( 2013-04-09 03:55:20 -0500 )edit
1

I believe I initialized the catkin workspace in catkin_ws/src. All catkin_generated folders are under catkin_ws/build, I must have confused you somewhere. Thanks for the help.

exuvo gravatar imageexuvo ( 2013-04-10 07:06:50 -0500 )edit
6

answered 2013-09-11 10:40:17 -0500

eacousineau gravatar image

Just as a heads up for those who didn't read the docs (like I did), you will want to add your targets AFTER you call catkin_package() - otherwise your binaries will not be put in the right spot.

edit flag offensive delete link more

Comments

+1, man. This leads to unexpected search paths and tears.

kilmarnock gravatar imagekilmarnock ( 2016-04-18 10:15:52 -0500 )edit

+1, correct answer

ZQ.Jones gravatar imageZQ.Jones ( 2017-05-12 04:02:49 -0500 )edit
0

answered 2013-10-24 12:40:18 -0500

dsolomon gravatar image

Just clarifying (as I understand it) which part of the answer solved the problem. The tutorial linked by boris reminds the user to source the devel/setup.bash file when using a Catkin workspace. Unless you add that particular command to your .bashrc file, you will have to source setup.bash in EVERY terminal. If you are in the root of your workspace, just enter source devel/setup.bash. I always forget to do this when I open a new terminal for the first time.

edit flag offensive delete link more
0

answered 2013-04-09 03:04:28 -0500

Claudio gravatar image

rosrun is looking in a path

/home/exuvo/code/catkin_ws/build/beginner_tutorials/catkin_generated/stamps/beginner_tutorials

which is different from the one you use

~/code/catkin_ws/devel/lib/beginner_tutorials/

Now first of all a binary shouldn't be under a lib folder. Nothing actually prevents you from doing it, but it's not a good habit.

Have you followed the tutorial to correctly setup your workspace?

My supposition is that you didn't correctly write your CMakeLists.txt file: should you have something like

rosbuild_add_library(talker ${PROJECT_SOURCE_DIR}/src/talker.cpp)
rosbuild_add_library(listener ${PROJECT_SOURCE_DIR}/src/listener.cpp)

then your poblem is there. You have to build binaries, not libraries. So it should be:

rosbuild_add_executable(talker ${PROJECT_SOURCE_DIR}/src/talker.cpp)
rosbuild_add_executable(listener ${PROJECT_SOURCE_DIR}/src/listener.cpp)

Variations of this error (wrong cmake folder definitions for example) may lead to binaries being copied to the wrong folder and thus being unavailable to roslaunch.

edit flag offensive delete link more

Comments

Actually catkin_make was used. So there should be no rosbuild commands in the CMakeLists.txt and it seems to me that catkin actually puts binaries in the lib/ directory. (My guess is to not spoil $PATH from bin/, although I'd agree it's somewhat ugly.)

dornhege gravatar imagedornhege ( 2013-04-09 03:13:41 -0500 )edit

The folder i have the code in is ~/code/catkin_ws/src/beginner_tutorials. The cmake file is the one from https://raw.github.com/ros/catkin_tutorials/master/create_package_pubsub/catkin_ws/src/beginner_tutorials/CMakeLists.txt which the tutorial says I should use and it uses add_executable.

exuvo gravatar imageexuvo ( 2013-04-09 03:23:30 -0500 )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

1 follower

Stats

Asked: 2013-04-09 02:35:30 -0500

Seen: 18,442 times

Last updated: Jul 03 '14