Revision history [back]

psutil can get you what you want in many instances.

import xmlrpclib, rosnode, rospy, psutil

def get_bin_exe(node_name):
ID = '/NODEINFO'
node_api = rosnode.get_api_uri(rospy.get_master(), node_name)
code, msg, pid = xmlrpclib.ServerProxy(node_api[2]).getPid(ID)
p = psutil.Process(pid)
return p.exe


As long as the node is running on the same machine, this will give you the path to the executable (this is how rqt_top gets info about running nodes).

psutil can get you what you want in many instances.

import xmlrpclib, rosnode, rospy, psutil

def get_bin_exe(node_name):
get_exe_path(node_name):
ID = '/NODEINFO'
node_api = rosnode.get_api_uri(rospy.get_master(), node_name)
code, msg, pid = xmlrpclib.ServerProxy(node_api[2]).getPid(ID)
p = psutil.Process(pid)
return p.exe


As long as the node is running on the same machine, this will give you the path to the executable (this is how rqt_top gets info about running nodes).