Ejemplo n.º 1
0
    def __call__(cls, *args, **kwargs):
        """Called when you call ConnectionBasedTransport()"""
        obj = type.__call__(cls, *args, **kwargs)

        # display node input/output topics
        parser = argparse.ArgumentParser()
        parser.add_argument('--inout', action='store_true')
        args = parser.parse_args(rospy.myargv()[1:])
        if args.inout:
            obj.subscribe()
            tp_manager = rospy.topics.get_topic_manager()
            print('Publications:')
            for topic, topic_type in tp_manager.get_publications():
                if topic == '/rosout':
                    continue
                topic = unresolve_name(rospy.get_name(), topic)
                print(' * {0} [{1}]'.format(topic, topic_type))
            print('Subscriptions:')
            for topic, topic_type in tp_manager.get_subscriptions():
                topic = unresolve_name(rospy.get_name(), topic)
                print(' * {0} [{1}]'.format(topic, topic_type))
            sys.exit(0)

        obj._post_init()
        return obj
Ejemplo n.º 2
0
    def __call__(cls, *args, **kwargs):
        """Called when you call ConnectionBasedTransport()"""
        obj = type.__call__(cls, *args, **kwargs)

        # display node input/output topics
        parser = argparse.ArgumentParser()
        parser.add_argument('--inout', action='store_true')
        args = parser.parse_args(rospy.myargv()[1:])
        if args.inout:
            obj.subscribe()
            tp_manager = rospy.topics.get_topic_manager()
            print('Publications:')
            for topic, topic_type in tp_manager.get_publications():
                if topic == '/rosout':
                    continue
                topic = unresolve_name(rospy.get_name(), topic)
                print(' * {0} [{1}]'.format(topic, topic_type))
            print('Subscriptions:')
            for topic, topic_type in tp_manager.get_subscriptions():
                topic = unresolve_name(rospy.get_name(), topic)
                print(' * {0} [{1}]'.format(topic, topic_type))
            sys.exit(0)

        obj._post_init()
        return obj
Ejemplo n.º 3
0
def warn_no_remap(*names):
    node_name = rospy.get_name()
    resolved_names = [rosgraph.names.resolve_name(n, node_name) for n in names]
    mappings = rospy.names.get_resolved_mappings()
    for r_name in resolved_names:
        if r_name in mappings:
            continue
        name = unresolve_name(node_name, r_name)
        rospy.logwarn("[{node_name}] '{name}' has not been remapped.".format(
            node_name=node_name, name=name))
Ejemplo n.º 4
0
def warn_no_remap(*names):
    node_name = rospy.get_name()
    resolved_names = [rosgraph.names.resolve_name(n, node_name) for n in names]
    mappings = rospy.names.get_resolved_mappings()
    for r_name in resolved_names:
        if r_name in mappings:
            continue
        name = unresolve_name(node_name, r_name)
        rospy.logwarn("[{node_name}] '{name}' has not been remapped."
                      .format(node_name=node_name, name=name))
Ejemplo n.º 5
0
def test_unresolve_name_0():
    node_name = 'relay_0'
    name = 'relay_0/input'
    assert_equal(unresolve_name(node_name, name), '~input')
Ejemplo n.º 6
0
def test_unresolve_name_1():
    node_name = 'relay_0'
    name = 'relay_1/input'
    assert_equal(unresolve_name(node_name, name), name)