示例#1
0
文件: echo.py 项目: tim-fan/ros2cli
    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')
示例#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(
            '--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(
            '--once',
            action='store_true',
            help='Print the first message received and then exit')
        parser.add_argument(
            '--timeout',
            metavar='N',
            type=unsigned_int,
            default=None,
            help='The time after which the application will exit')
示例#3
0
    def add_arguments(self, parser, cli_name):
        add_strategy_node_arguments(parser)

        parser.add_argument(
            '-t', '--show-types', action='store_true',
            help='Additionally show the topic type')
        parser.add_argument(
            '-c', '--count-topics', action='store_true',
            help='Only display the number of topics discovered')
        # duplicate the following argument from the command for visibility
        parser.add_argument(
            '--include-hidden-topics', action='store_true',
            help='Consider hidden topics as well')
示例#4
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 get info (e.g. '/chatter')")
     parser.add_argument(
         '--verbose',
         '-v',
         action='store_true',
         help='Prints detailed information like the node name, node namespace, topic type, '
              'GUID and QoS Profile of the publishers and subscribers to this topic')
     arg.completer = TopicNameCompleter(
         include_hidden_topics_key='include_hidden_topics')
示例#5
0
    def add_arguments(self, parser, cli_name):
        add_strategy_node_arguments(parser)

        arg = parser.add_argument(
            'topic_type',
            help=
            "Name of the ROS topic type to filter for (e.g. 'std_msg/msg/String')"
        )
        arg.completer = message_type_completer
        parser.add_argument(
            '-c',
            '--count-topics',
            action='store_true',
            help='Only display the number of topics discovered')
        # duplicate the following argument from the command for visibility
        parser.add_argument('--include-hidden-topics',
                            action='store_true',
                            help='Consider hidden topics as well')
示例#6
0
 def add_arguments(self, parser, cli_name) -> None:
     arg = parser.add_argument('POLICY_FILE_PATH',
                               type=pathlib.Path,
                               help='path of the policy xml file')
     arg.completer = FilesCompleter(allowednames=('xml'), directories=False)
     add_strategy_node_arguments(parser)
示例#7
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')")
        parser.add_argument(
            '--qos-profile',
            choices=rclpy.qos.QoSPresetProfiles.short_keys(),
            help='Quality of service preset profile to subscribe with (default: {})'
                 .format(default_profile_str))
        default_profile = rclpy.qos.QoSPresetProfiles.get_from_short_key(default_profile_str)
        parser.add_argument(
            '--qos-depth', metavar='N', type=int,
            help='Queue size setting to subscribe with '
                 '(overrides depth value of --qos-profile option)')
        parser.add_argument(
            '--qos-history',
            choices=rclpy.qos.QoSHistoryPolicy.short_keys(),
            help='History of samples setting to subscribe with '
                 '(overrides history value of --qos-profile option, default: {})'
                 .format(default_profile.history.short_key))
        parser.add_argument(
            '--qos-reliability',
            choices=rclpy.qos.QoSReliabilityPolicy.short_keys(),
            help='Quality of service reliability setting to subscribe with '
                 '(overrides reliability value of --qos-profile option, default: '
                 'Automatically match existing publishers )')
        parser.add_argument(
            '--qos-durability',
            choices=rclpy.qos.QoSDurabilityPolicy.short_keys(),
            help='Quality of service durability setting to subscribe with '
                 '(overrides durability value of --qos-profile option, default: '
                 'Automatically match existing publishers )')
        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='DEPRECATED: Does nothing')
        parser.add_argument(
            '--no-lost-messages', action='store_true', help="Don't report when a message is lost")
        parser.add_argument(
            '--raw', action='store_true', help='Echo the raw binary representation')
示例#8
0
文件: echo.py 项目: ros2/ros2cli
    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')")
        parser.add_argument(
            '--qos-profile',
            choices=rclpy.qos.QoSPresetProfiles.short_keys(),
            help=
            'Quality of service preset profile to subscribe with (default: {})'
            .format(default_profile_str))
        default_profile = rclpy.qos.QoSPresetProfiles.get_from_short_key(
            default_profile_str)
        parser.add_argument('--qos-depth',
                            metavar='N',
                            type=int,
                            help='Queue size setting to subscribe with '
                            '(overrides depth value of --qos-profile option)')
        parser.add_argument(
            '--qos-history',
            choices=rclpy.qos.QoSHistoryPolicy.short_keys(),
            help='History of samples setting to subscribe with '
            '(overrides history value of --qos-profile option, default: {})'.
            format(default_profile.history.short_key))
        parser.add_argument(
            '--qos-reliability',
            choices=rclpy.qos.QoSReliabilityPolicy.short_keys(),
            help='Quality of service reliability setting to subscribe with '
            '(overrides reliability value of --qos-profile option, default: '
            'Automatically match existing publishers )')
        parser.add_argument(
            '--qos-durability',
            choices=rclpy.qos.QoSDurabilityPolicy.short_keys(),
            help='Quality of service durability setting to subscribe with '
            '(overrides durability value of --qos-profile option, default: '
            'Automatically match existing publishers )')
        parser.add_argument(
            '--csv',
            action='store_true',
            help=
            ('Output all recursive fields separated by commas (e.g. for '
             'plotting). '
             'If --include-message-info is also passed, the following fields are prepended: '
             'source_timestamp, received_timestamp, publication_sequence_number,'
             ' reception_sequence_number.'))
        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(
            '--flow-style',
            action='store_true',
            help=
            'Print collections in the block style (not available with csv format)'
        )
        parser.add_argument('--lost-messages',
                            action='store_true',
                            help='DEPRECATED: Does nothing')
        parser.add_argument('--no-lost-messages',
                            action='store_true',
                            help="Don't report when a message is lost")
        parser.add_argument('--raw',
                            action='store_true',
                            help='Echo the raw binary representation')
        parser.add_argument('--filter',
                            dest='filter_expr',
                            help='Python expression to filter messages that '
                            'are printed. Expression can use Python builtins '
                            'as well as m (the message).')
        parser.add_argument(
            '--once',
            action='store_true',
            help='Print the first message received and then exit.')
        parser.add_argument('--include-message-info',
                            '-i',
                            action='store_true',
                            help='Shows the associated message info.')