ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
rospy.init_node()
is global; you should not call it more than once in your program.
Instead, you could pass your node's namespace into the superclass constructor:
class Base(object):
def __init__(self, name=""):
service_name = 'get_state'
if name:
service_name = name + '/' + service_name
service = rospy.Service(service_name, ...)
class Node1(Base):
def __init__(self):
super(Node1, self).__init__('node1')