0
$\begingroup$

Rosanswers logo

Hi,

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 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 tag to the launch file on my laptop that will run the openni.launch file on the robot.

Naturally, I looked at the documentation at http://www.ros.org/wiki/roslaunch/XML/include 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!

-Chris


Originally posted by cdleveille on ROS Answers with karma: 31 on 2012-08-14

Post score: 3

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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: http://www.ros.org/wiki/roslaunch/XML/machine

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

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

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!


Originally posted by jbohren with karma: 5809 on 2012-08-14

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by liborw on 2012-09-04:
I have tried that with openni.launch, but it still launches nodes on local machine.

Comment by jbohren on 2012-09-05:
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: http://www.ros.org/wiki/hydro/Planning/roslaunch

Comment by amrivera on 2013-03-22:
I tried it in ROS Electric, but had no luck. WARNING: [path/to/MASTER/pc/name.launch] unknown 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?

Comment by liborw on 2013-08-15:
On hydro this results in error: WARNING: [...launch] unknown attribute 'machine'

Comment by Girmi on 2017-01-16:
This isn't working on ROS Kinetic either, resulting in a warning and the nodes being launched on the local PC.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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

<launch>
        <include file="local_nodes.launch" />

        <group>
            <machine name="remote_machine" address="1.2.3.4" default="true" />
            <include file="remote_nodes.launch" />
        </group>
</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!


Originally posted by Girmi with karma: 111 on 2017-01-17

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Girmi on 2017-02-06:
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!

Comment by philwall3 on 2018-02-22:
Also the default="true" tag is needed to work properly. After adding that, it is finally working for me. Thanks!

Comment by Girmi on 2018-02-22:
Do you mean the defailt="true" attribute of the element (which is present in my example)? Or is an additional attribute needed somewhere?

Comment by philwall3 on 2018-02-22:
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.

Comment by MikeWrock on 2019-11-19:
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?

Comment by Girmi on 2019-11-20:
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.

Comment by Hemanth on 2019-11-21:
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.

Comment by dinesh on 2021-07-13:
does anyone has solved this issue. cas i'm also facing same issue and unable to solve it.

Comment by MikeWrock on 2021-07-13:
The solution I've used is to execute a command over SSH using a bash script called from a launch file. See my answer below

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.