Is there a way to get the package name or directory/location of a running node? Preferably from within a separate python node.

Things I've tried:

  • rosnode info doesn't seem to give any info on which package the node is running in.
  • `rosgraph.masterapi.Master.lookupNode() will give me the IP address, but no package information.
  • I could search for nodes manually using a linux command like locate or `find` for the name, but if there are multiple packages that have the same node name, I won't know which is actually running.
  • 1
    $\begingroup$ Why exactly do you need the package at runtime? I don't know the answer to your question, but maybe there is an alternative for what you actually want to achieve. $\endgroup$
    – JRTG
    Commented Oct 21, 2023 at 8:35
  • $\begingroup$ Another issue I'll point out is that since ros is a distributed system, the ros package may not even be installed locally on the machine this hypothetical python code is executing on. $\endgroup$
    – Mike973
    Commented Oct 21, 2023 at 12:54


Your Answer

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

Browse other questions tagged or ask your own question.