Robotics StackExchange | Archived questions

roslaunch api - start/stop nodes on a remote machine

I am trying to write a python script using the roslaunch python API found on http://docs.ros.org.ros.informatik.uni-freiburg.de/api/roslaunch/html/. 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)

Asked by klimperdirndl on 2016-11-18 04:57:36 UTC

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?

Asked by gvdhoorn on 2016-11-18 06:46:49 UTC

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

Asked by klimperdirndl on 2016-11-18 07:05:42 UTC

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

Asked by gvdhoorn on 2016-11-18 07:25:54 UTC

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?

Asked by Cdfghglz on 2017-10-23 02:37:41 UTC

Answers