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

Organize nodes in subdirectorys

asked 2015-02-24 10:11:13 -0600

Karl_Auer gravatar image

Hello everybody,

I'm using ROS for a while now and I'm curious if it's possible to group packages in subdirectory and access them with rosrun. I already organized my code in theme-based folders in which the node folders are located. It appears that catkin has no problem with this structure whatsoever, but rosrun has. I added my src folder to ROS_PACKAGE_PATH but nothing is found. Is there a possibility to use this how I'm trying to? I know that I could just put all packages in the src folder and seperate them by name (like status_lights), but thats very messy. Has anyone a solution to my little problem?

Best Wishes,


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-24 10:34:02 -0600

gvdhoorn gravatar image

updated 2015-02-24 10:35:05 -0600

You can organise your packages any way you want, catkin will crawl your directory structure and discover packages. rosrun should have no problem with this either, provided you have correctly sourced the devel/setup.bash after building your workspace. The only constraint is that catkin by default only looks for packages under the src directory in your catkin workspace.

I added my src folder to ROS_PACKAGE_PATH but nothing is found.

If you use catkin to build, and source the devel/setup.bash, you should not need to set ROS_PACKAGE_PATH yourself.

edit flag offensive delete link more


The part about sourcing devel/setup.bash came to me about 5 min after I posted the question.

I think i have correctly sourced it (just typed source ~/catkin_ws/devel/setup.bash ) , but when my packages are in subfolders they're not seen by rosrun

Karl_Auer gravatar image Karl_Auer  ( 2015-02-24 11:16:13 -0600 )edit

Have you rebuilt your workspace? After that, source the devel/setup.bash in new terminal. If rosrun then still can't find your packages, try a rospack profile (this rebuilds a cache).

Don't forget to remove any export ROS_PACKAGE_PATH lines from your .bashrc.

gvdhoorn gravatar image gvdhoorn  ( 2015-02-24 11:18:06 -0600 )edit

Question Tools

1 follower


Asked: 2015-02-24 10:11:13 -0600

Seen: 791 times

Last updated: Feb 24 '15