ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

roslaunch python api access node class

asked 2021-03-02 04:49:19 -0600

joao.aguizo gravatar image

updated 2021-03-03 12:51:57 -0600

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%20U...)

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-03 12:52:51 -0600

joao.aguizo gravatar image

updated 2021-03-29 18:31:32 -0600

jayess gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-02 04:49:19 -0600

Seen: 204 times

Last updated: Mar 29 '21