Ask Your Question

How to include a .launch file on a remote machine from a .launch file?

asked 2012-08-14 12:12:44 -0600

cdleveille gravatar image

updated 2014-04-20 14:09:24 -0600

ngrennan gravatar image


I'm using openni_launch drivers for the Kinect on my robot. I am running roscore on a separate computer, my laptop. I have added a line reading <env name="ROS_MASTER_URI" value="MY_LAPTOP_NAME:PORT_NUM"/> to the openni.launch file on the robot computer so I can access the various image topics such as /camera/rgb/image_color from my laptop.

As it is, I can run the launch file on my laptop which creates the connection to the robot, and THEN I have to go over to the robot computer and launch openni.launch to start the Kinect drivers. This works fine, but it is inconvenient. I want to be able to start the Kinect drivers (execute the openni.launch file on the robot computer) from the launch file on my laptop.

I am wondering if there is a way to add an <include file=""/> tag to the launch file on my laptop that will run the openni.launch file on the robot.

Naturally, I looked at the <include> documentation at already, but there doesn't seem to be anything about including a file on another machine. That's why I thought I would check here.

Thanks very much for reading, and hope you can help!


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-08-14 12:40:29 -0600

jbohren gravatar image

updated 2012-08-14 12:49:27 -0600

It looks like it's undocumented, and it even gives a warning if you try to use it, but! You can, in fuerte, at least, add a "machine" attribute to an "include" tag in a launchfile and get it to launch everything in that included launchfile to come up on another machine.

See here for setting up machine tags:

And then just simply do (with appropriate values) something like:

  <machine name="other-pc" address="" env-loader="/opt/ros/fuerte/"/>
  <include file="/path/to/file/on/local/machine.launch" machine="other-pc"/>

It looks like what this is doing is actually reading a launchfile on the local machine, and then bringing up its nodes on the other machine!

edit flag offensive delete link more


I have tried that with openni.launch, but it still launches nodes on local machine.

liborw gravatar imageliborw ( 2012-09-04 21:05:53 -0600 )edit

Maybe it only works one level deep. This is an undocumented feature, but definitely something that I think should be added to the hydro roslaunch SIG:

jbohren gravatar imagejbohren ( 2012-09-05 02:37:28 -0600 )edit

I tried it in ROS Electric, but had no luck. WARNING: [path/to/MASTER/pc/name.launch] unknown <include> attribute 'machine'

I need to launch a node in a ClientPC with files living in the ClientPC too. Currently it attempts to read files in MASTERPC which also has them, but no luck either. Ideas?

amrivera gravatar imageamrivera ( 2013-03-22 07:30:00 -0600 )edit

On hydro this results in error: WARNING: [...launch] unknown <include> attribute 'machine'

liborw gravatar imageliborw ( 2013-08-15 04:32:49 -0600 )edit

This isn't working on ROS Kinetic either, resulting in a warning and the nodes being launched on the local PC.

Girmi gravatar imageGirmi ( 2017-01-16 08:00:09 -0600 )edit

answered 2017-01-17 02:59:55 -0600

Girmi gravatar image

updated 2018-02-22 03:58:42 -0600

If anyone is still looking for an answer, I think currently the most elegant solution is:

        <include file="local_nodes.launch" />

            <machine name="remote_machine" address="" default="true" />
            <include file="remote_nodes.launch" />

Tested with ROS Kinectic on Ubuntu 16.04.

Edit: Apparently the machine tag doesn't apply to a specific group, but to any nodes/includes that come after it. So the order in which the tags are defined is important!

edit flag offensive delete link more



Apparently the machine tag doesn't apply to a specific group, but to any nodes/includes that come after it. So the order in which the tags are defined is important!

Girmi gravatar imageGirmi ( 2017-02-06 03:56:19 -0600 )edit

Also the default="true" tag is needed to work properly. After adding that, it is finally working for me. Thanks!

philwall3 gravatar imagephilwall3 ( 2018-02-22 03:24:34 -0600 )edit

Do you mean the defailt="true" attribute of the <machine> element (which is present in my example)? Or is an additional attribute needed somewhere?

Girmi gravatar imageGirmi ( 2018-02-22 04:08:14 -0600 )edit

Yes I mean in the machine element like shown in your example. I was missing it at first and it was not opening the ssh connection to the remote machine, but instead just starting the launch file on the local machine.

philwall3 gravatar imagephilwall3 ( 2018-02-22 05:59:06 -0600 )edit

It seems to me like any file included via the file="" tag will be read locally but launched remotely, as in remote_nodes.launch must exist locally, but will launch the nodes mentioned within remotely. Can anyone else confirm this behaviour?

MikeWrock gravatar imageMikeWrock ( 2019-11-19 11:59:58 -0600 )edit

This is indeed the case. The same goes for the fact that any nodes you want to launch remotely, have to be installed locally as well.

Girmi gravatar imageGirmi ( 2019-11-20 07:39:03 -0600 )edit

I was able to launch a node remotely and that node was not installed locally. However, I am observing a problem with launching remote launch files. The ROS path of the local system is being checked for the package that contains the launch file and I recieved the ResourceNotFound error.

Hemanth gravatar imageHemanth ( 2019-11-21 04:57:33 -0600 )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



Asked: 2012-08-14 12:12:44 -0600

Seen: 4,401 times

Last updated: Feb 22 '18