Ask Your Question

having trouble launching a launch file from another launch file

asked 2015-01-05 17:13:24 -0500

A.M Dynamics gravatar image

updated 2015-01-05 20:28:27 -0500

Dear all,

I’ve created a catkin workspace and so far it includes one package. This package has a cpp file as a node which uses API function from other package (youbot APIs). So far it has worked well and it can drive my robot (Kuka youbot). Now I want to call a launch file of other package (e.g. Kinect Xbox) from the launch of the pack I have already created. To do this I did following steps: 1- I created a catkin workspace named youbot_kinect_test which includes ‘build’, ‘devel’,’src’. 2- In ‘src’ there is the first package named ’ main_node’ including main.cpp, package.xml, Cmakelists.txt and Launch folder. 3- In the launch folder I put a launch file which includes another launch file(the Kinect launch file) as follow:

'<launch> <include file="$(find freenect_launch)/opt/ros/hydro/share/freenect_launch/freenect.launch"/> </launch>'

But my problem is that when I run roslaunch main_node Kinect_test.launch I receive this error:

while processing /opt/ros/hydro/share/freenect_launch/opt/ros/hydro/share/freenect_launch/freenect.launch: Invalid roslaunch XML syntax: [Errno 2] No such file or directory: u'/opt/ros/hydro/share/freenect_launch/opt/ros/hydro/share/freenect_launch/freenect.launch'

Now my question is that is it possible to call a launch file from another? Do I have to change and edit the package.xml? Is it correct to put the launch file in the main_node package?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-01-05 17:23:00 -0500

updated 2015-01-05 17:23:17 -0500

I believe is should be like <include file="$(find freenect_launch)/launch/freenect.launch"/>

edit flag offensive delete link more


Many thanks. My problem is solved but would you please explain why? Why mine was not correct? Is it because the command 'find' has already included " freenect_launch" package and there is no need for writing whole directory?

A.M Dynamics gravatar image A.M Dynamics  ( 2015-01-05 17:42:33 -0500 )edit

If you do roscd freenect_launch it will take you to /opt/ros/<distro>/share that is basically what $(find freenect_launch) does thus you do not need to include it. Once in the correct directory, you need to advance to launch and then the file.launch.

tonybaltovski gravatar image tonybaltovski  ( 2015-01-05 19:44:32 -0500 )edit

Thanks. I got it.

A.M Dynamics gravatar image A.M Dynamics  ( 2015-01-05 20:24:48 -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


Asked: 2015-01-05 17:13:24 -0500

Seen: 1,215 times

Last updated: Jan 05 '15