roslaunch api - start/stop nodes on a remote machine

asked 2016-11-18 03:57:36 -0500

klimperdirndl gravatar image

I am trying to write a python script using the roslaunch python API found on http://docs.ros.org.ros.informatik.un... . If I run this code on machine2 it always starts the node local on machine2 even though I specified machine1. Everything works well when I do the same thing within a launch file specifying the machine1 in a machine tag.

What am I missing out? Has anybody ever used the roslaunch API for launching nodes remote?

master = roslaunch.core.Master(type_='rosmaster', uri='http://192.168.139.200:11311')

uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
roslaunch.configure_logging(uuid)
name = 'image_view_abc'
package = 'image_view'
type = 'image_view'

machine_1 = roslaunch.core.Machine(name='machine1', address='http://192.168.139.200', env_loader='/opt/ros/indigo/env.sh', user='account')

node = roslaunch.core.Node(name=name, package=package, node_type=type, machine_name='machine1')
node.machine = machine_1

launch = roslaunch.scriptapi.ROSLaunch()
launch.start()
process = launch.launch(node)
edit retag flag offensive close merge delete

Comments

Are you doing this to be able to start nodes on remote machines (ie: are you just after that functionality), or are you creating some kind of orchestration framework / tool that needs this? If the former: any reason not to use normal launch files with proper machine tags?

gvdhoorn gravatar image gvdhoorn  ( 2016-11-18 05:46:49 -0500 )edit

Yes I would like to dynamically launch and remap nodes from my tool (all python).

klimperdirndl gravatar image klimperdirndl  ( 2016-11-18 06:05:42 -0500 )edit

Ok, clear. Just making sure. node_manager_fkie might be interesting.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-18 06:25:54 -0500 )edit

Did you do any progress on using the API? I am facing a similar orchestration challenge. Could you give any inspiration on how you ended up solving your problem?

Cdfghglz gravatar image Cdfghglz  ( 2017-10-23 02:37:41 -0500 )edit