Rospy launch multiple file.launch from python node

asked 2021-09-11 15:13:20 -0600

reavers92 gravatar image

updated 2021-09-11 18:52:43 -0600

Mike Scheutzow gravatar image

Hi everyone.

I would like to know if there are libraries or functions for launch one or more file.launch from a python node without waiting the end of the first node to launch the second. Specifically, my python node will be a simple subscriber that will read the node name to launch from a specific message:

import rospy
from std_msgs.msg import node_name


def node_launch(data):
    node = data.data
    ---------------


def listener():
    rospy.init_node('node_name')
    rospy.Subscriber("chatter", String, node_launch)
    rospy.spin()

I would like to know how to implement the logic to launch a node inside the def node_launch (data): without it waiting for the end of the node and being able to launch another node if required. Are there any procedures or libraries to do this or do I have to create with differents threads?

Thanks everyone.

edit retag flag offensive close merge delete

Comments

If you type python subprocess into the search box at the top of this page, you get more than 100 hits.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-09-11 18:51:21 -0600 )edit