Esempio n. 1
0
 def add_arguments(self, parser, cli_name):
     arg = parser.add_argument(
         'topic_name',
         help="Name of the ROS topic to listen to (e.g. '/chatter')")
     arg.completer = TopicNameCompleter(
         include_hidden_topics_key='include_hidden_topics')
     parser.add_argument(
         'message_type', nargs='?',
         help="Type of the ROS message (e.g. 'std_msgs/String')")
     add_qos_arguments_to_argument_parser(
         parser, is_publisher=False, default_preset='sensor_data')
     parser.add_argument(
         '--csv', action='store_true',
         help='Output all recursive fields separated by commas (e.g. for '
              'plotting)')
     parser.add_argument(
         '--full-length', '-f', action='store_true',
         help='Output all elements for arrays, bytes, and string with a '
              "length > '--truncate-length', by default they are truncated "
              "after '--truncate-length' elements with '...''")
     parser.add_argument(
         '--truncate-length', '-l', type=unsigned_int, default=DEFAULT_TRUNCATE_LENGTH,
         help='The length to truncate arrays, bytes, and string to '
              '(default: %d)' % DEFAULT_TRUNCATE_LENGTH)
     parser.add_argument(
         '--no-arr', action='store_true', help="Don't print array fields of messages")
     parser.add_argument(
         '--no-str', action='store_true', help="Don't print string fields of messages")
Esempio n. 2
0
    def add_arguments(self, parser, cli_name):
        add_strategy_node_arguments(parser)

        arg = parser.add_argument(
            'topic_name',
            help="Name of the ROS topic to listen to (e.g. '/chatter')")
        arg.completer = TopicNameCompleter(
            include_hidden_topics_key='include_hidden_topics')
        parser.add_argument(
            'message_type',
            nargs='?',
            help="Type of the ROS message (e.g. 'std_msgs/msg/String')")
        add_qos_arguments_to_argument_parser(parser,
                                             is_publisher=False,
                                             default_preset='sensor_data')
        parser.add_argument(
            '--csv',
            action='store_true',
            help='Output all recursive fields separated by commas (e.g. for '
            'plotting)')
        parser.add_argument(
            '--field',
            type=str,
            default=None,
            help='Echo a selected field of a message. '
            "Use '.' to select sub-fields. "
            'For example, to echo the position field of a nav_msgs/msg/Odometry message: '
            "'ros2 topic echo /odom --field pose.pose.position'",
        )
        parser.add_argument(
            '--full-length',
            '-f',
            action='store_true',
            help='Output all elements for arrays, bytes, and string with a '
            "length > '--truncate-length', by default they are truncated "
            "after '--truncate-length' elements with '...''")
        parser.add_argument(
            '--truncate-length',
            '-l',
            type=unsigned_int,
            default=DEFAULT_TRUNCATE_LENGTH,
            help='The length to truncate arrays, bytes, and string to '
            '(default: %d)' % DEFAULT_TRUNCATE_LENGTH)
        parser.add_argument('--no-arr',
                            action='store_true',
                            help="Don't print array fields of messages")
        parser.add_argument('--no-str',
                            action='store_true',
                            help="Don't print string fields of messages")
        parser.add_argument('--lost-messages',
                            action='store_true',
                            help='Report when a message is lost')
        parser.add_argument('--raw',
                            action='store_true',
                            help='Echo the raw binary representation')
Esempio n. 3
0
 def add_arguments(self, parser, cli_name):
     arg = parser.add_argument(
         'topic_name',
         help="Name of the ROS topic to publish to (e.g. '/chatter')")
     arg.completer = TopicNameCompleter(
         include_hidden_topics_key='include_hidden_topics')
     arg = parser.add_argument(
         'message_type',
         help="Type of the ROS message (e.g. 'std_msgs/String')")
     arg.completer = TopicTypeCompleter(topic_name_key='topic_name')
     arg = parser.add_argument(
         'values',
         nargs='?',
         default='{}',
         help='Values to fill the message with in YAML format '
         "(e.g. 'data: Hello World'), "
         'otherwise the message will be published with default values')
     arg.completer = TopicMessagePrototypeCompleter(
         topic_type_key='message_type')
     parser.add_argument('-r',
                         '--rate',
                         metavar='N',
                         type=positive_float,
                         default=1.0,
                         help='Publishing rate in Hz (default: 1)')
     parser.add_argument(
         '-p',
         '--print',
         metavar='N',
         type=int,
         default=1,
         help='Only print every N-th published message (default: 1)')
     group = parser.add_mutually_exclusive_group()
     group.add_argument('-1',
                        '--once',
                        action='store_true',
                        help='Publish one message and exit')
     group.add_argument('-t',
                        '--times',
                        type=nonnegative_int,
                        default=0,
                        help='Publish this number of times and then exit')
     parser.add_argument('-n',
                         '--node-name',
                         help='Name of the created publishing node')
     add_qos_arguments_to_argument_parser(parser,
                                          is_publisher=True,
                                          default_preset='system_default')