0
$\begingroup$

Rosanswers logo

I'm trying to find machines that publish a certain type of message. Therefore I'm inspecting the list of rosnodes rosnode.rosnode_listnodes() and would like to get the IP address of the corresponding machines running a specific node.

There is a method rosnode.lookup_uri(...), but I have no idea how to use it. I also looked into the rospy, rosgraph, names and network modules - so far without success. Among other information,rosnode.rosnode_info(node_name) prints the URI. But it might be a rather expensive method and, unfortunately, it returns None.


Originally posted by Falko on ROS Answers with karma: 268 on 2016-11-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

>>> import rosgraph
>>> master = rosgraph.Master('/mynode')
>>> master.lookupNode("node_name')

This worked for me, but not sure if it's safe to deal with ros master directly this way.


Originally posted by huanxiner with karma: 271 on 2016-11-04

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by gvdhoorn on 2016-11-05:
Alternatively, you could use the Master API directly.

Comment by Falko on 2016-11-07:
Great, thanks! Apparently, you can even get the master via rosgraph.Master(''). It's definitely the answer I was looking for. :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.