示例#1
0
    def main(self, *, args):  # noqa: D102
        qos_profile_overrides = {}  # Specify a valid default
        if args.qos_profile_overrides_path:
            qos_profile_dict = yaml.safe_load(args.qos_profile_overrides_path)
            try:
                qos_profile_overrides = convert_yaml_to_qos_profile(
                    qos_profile_dict)
            except (InvalidQoSProfileException, ValueError) as e:
                return print_error(str(e))

        storage_config_file = ''
        if args.storage_config_file:
            storage_config_file = args.storage_config_file.name

        # NOTE(hidmic): in merged install workspaces on Windows, Python entrypoint lookups
        #               combined with constrained environments (as imposed by colcon test)
        #               may result in DLL loading failures when attempting to import a C
        #               extension. Therefore, do not import rosbag2_transport at the module
        #               level but on demand, right before first use.
        from rosbag2_transport import rosbag2_transport_py
        rosbag2_transport_py.play(
            uri=args.bag_file,
            storage_id=args.storage,
            node_prefix=NODE_NAME_PREFIX,
            read_ahead_queue_size=args.read_ahead_queue_size,
            rate=args.rate,
            topics=args.topics,
            qos_profile_overrides=qos_profile_overrides,
            loop=args.loop,
            topic_remapping=args.remap,
            storage_config_file=storage_config_file)
示例#2
0
文件: play.py 项目: ruffsl/rosbag2
    def main(self, *, args):  # noqa: D102
        bag_file = args.bag_file
        if not os.path.exists(bag_file):
            return "[ERROR] [ros2bag] bag file '{}' does not exist!".format(
                bag_file)

        rosbag2_transport_py.play(
            uri=bag_file,
            storage_id=args.storage,
            read_ahead_queue_size=args.read_ahead_queue_size)
示例#3
0
 def main(self, *, args):  # noqa: D102
     bag_file = args.bag_file
     if not os.path.exists(bag_file):
         return "[ERROR] [ros2bag] bag file '{}' does not exist!".format(
             bag_file)
     # NOTE(hidmic): in merged install workspaces on Windows, Python entrypoint lookups
     #               combined with constrained environments (as imposed by colcon test)
     #               may result in DLL loading failures when attempting to import a C
     #               extension. Therefore, do not import rosbag2_transport at the module
     #               level but on demand, right before first use.
     from rosbag2_transport import rosbag2_transport_py
     rosbag2_transport_py.play(
         uri=bag_file,
         storage_id=args.storage,
         node_prefix=NODE_NAME_PREFIX,
         read_ahead_queue_size=args.read_ahead_queue_size,
         rate=args.rate)
示例#4
0
    def main(self, *, args):  # noqa: D102
        bag_file = args.bag_file
        if not os.path.exists(bag_file):
            return "[ERROR] [ros2bag] bag file '{}' does not exist!".format(
                bag_file)

        if len(args.topics) > 0:
            rosbag2_transport_py.play(
                uri=bag_file,
                storage_id=args.storage,
                node_prefix=NODE_NAME_PREFIX,
                read_ahead_queue_size=args.read_ahead_queue_size,
                topics=args.topics)
        else:
            rosbag2_transport_py.play(
                uri=bag_file,
                storage_id=args.storage,
                node_prefix=NODE_NAME_PREFIX,
                read_ahead_queue_size=args.read_ahead_queue_size)
示例#5
0
    def main(self, *, args):  # noqa: D102
        bag_file = args.bag_file
        if not os.path.exists(bag_file):
            return "Error: bag file '{}' does not exist!".format(bag_file)

        rosbag2_transport_py.play(uri=bag_file, storage_id='sqlite3')