Avoid multiple calls to rospy.init_node

asked 2020-07-02 08:47:25 -0500

mercury gravatar image

I am trying to check is a node has already been init another part of a python script? So if I am writting a client class that wraps around a lot of pubs/subs. It needs a node to be active, so it should one should be created. But If I create a node before initializing the object. It will throw the following error:

raise rospy.exceptions.ROSException("rospy.init_node() has already been called with different arguments: "+str(_init_node_args))

So is there a way to check if the scrip has already been initialized? so I can create one if it does not exist and if one does exist and does not try to create another node.

edit retag flag offensive close merge delete