Robotics StackExchange | Archived questions

roslaunch python api access node class

Hello, I have been trying to use the roslaunch python API (http://wiki.ros.org/roslaunch) to instantiate a node and launch it. My question is, is it possible to access the node to be dispatched variables using this API? I tried applying this example to my use-case but without any success:

import roslaunch

package = 'rqt_gui'

executable = 'rqt_gui'

node = roslaunch.core.Node(package, executable)

launch = roslaunch.scriptapi.ROSLaunch()

launch.start()

process = launch.launch(node)

print process.is_alive()

process.stop()

(from http://wiki.ros.org/roslaunch/API%20Usage)

EDIT: Is there any way of getting the launched node name? That would work as well for my use-case.

Asked by joao.aguizo on 2021-03-02 05:49:19 UTC

Comments

Answers

Found out that in the "process" variable you can access the name of the node in the name property.

process = launch.launch(node)

It does not answer the original question, but it works well enough for my use-case, just needed the node name, which is anonymous, in order to subscribe to an output topic generated by that same node.

Asked by joao.aguizo on 2021-03-03 13:52:51 UTC

Comments