0
$\begingroup$

Rosanswers logo

Hi,

I'm trying to develop introspection nodes for ROS. So far I've been able to use some methods in the rosnode API to retrieve information on the nodes and topics from the master, and to execute the kill_node() method, but failing to actually kill the node (it actually returns me a correct list of the nodes it managed to kill and those it couldn't).

Does anyone knows if it a problem with permissions for the node calling that method? Because the command line tool rosnode kill works fine for me.

I launch a node to test its killing: $ rosrun amcl amcl

Calling the rosnode API doesn't seems to work, here is the method I use (passing '/amcl' as argument). I've tried to resolve the full name by looking at rosnode code, but I'm not sure of what a fully resolved node name is in ROS:

def kill_node1(x):
    a = scriptutil.script_resolve_name('/rosnode', x)
    rosnode.kill_nodes(a)

whereas this method that executes the rosnode command works:

def kill_node2(x):
    cmd = 'rosnode kill ' + x + ' &' 
    runCmd(cmd)

Thank you in avdance


Originally posted by chcorbato on ROS Answers with karma: 202 on 2011-09-28

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

UPDATE:

The problem is that kill_nodes() takes an array of node names, not a string.


First, a warning: the rosnode documentation notes "This library is intended for internal use only." That means that I am likely to tweak the internal API in non-backwards-compatible ways. You may wish to copy some of the easier routines into your own code to be safe.

There shouldn't be any permissions issues; the general technique (right now) is to make an XMLRPC call to the node to kill. This will change in the future, but that's how it works now.

My only guess is that your code may be specifying node names differently -- they have to be fully resolved names.


Originally posted by kwc with karma: 12244 on 2011-09-29

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by chcorbato on 2011-10-16:
thank you very much, that was the issue. Sorry it was trivial, I'm new to python programming

Comment by kwc on 2011-10-14:
see updated answer, kill_nodes() needs an array of strings, not a string

Comment by chcorbato on 2011-10-14:
Thank you very much for the advice, I knew of the intended use but surely I'd better copy the code. I have updated the question with more info, because trying to resolve the name gives me the same result

$\endgroup$

Your Answer

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