Check if a node exists using rosnode.rosnode_ping()
I just need to find a method to check if a node exists. I'm programming with python and using threading module to make the node run in another thread (otherwise the main thread would get blocked.). Then I just use rosnode.rosnode_ping("/my_node_name")
to check if it is alive in the main thread. When running, rosnode.rosnode_ping()
method seems to be in a dead loop, and I can't figure out the reason (have some problem understanding the rosnode source code).
FInally I used rosnode.get_node_names()
to get the list of node name and check if the node is in it. THis method works. I just wonder what is the method rosnode.rosnode_ping()
really for. In api document it seems to be a method to check connectivity. But is that not for checking if node is alive?
Api document as follow: link text