ros2bagwriter
Description
Use the ros2bagwriter object to create a ROS 2 bag file in a
folder that you specify. Use the write function to write logs to the ROS
2 bag file. Each log contains a topic, its corresponding timestamp, and a ROS 2 message. After
writing the logs to this ROS 2 bag file, call the delete function to
close the opened ROS 2 bag file, which also generates the metadata file
with .yaml extension and removes the ros2bagwriter object
from memory. You can see this metadata.yaml file in the same folder where
the bag file is generated. The ros2bagwriter object supports
sqlite3 (DB3) and MCAP storage format.
Note
The ros2bagwriter object locks the created ROS 2 bag file. to use the
ROS 2 bag file, delete and clear the ros2bagwriter object.
Creation
Description
creates a ROS 2 bag file in the location specified by bagWriter = ros2bagwriter(path)path and
returns its corresponding ros2bagwriter object. Use the object to write
records into the ROS 2 bag file. Use the path input argument to set
the Path
property.
The name of the ROS 2 bag file is the name of the folder containing it. If the folders
in path are not available, the object creates them and places the ROS
2 bag file accordingly.
sets the StorageFormat,
CacheSize,
SplitSize,
SplitDuration,
CompressionFormat, CompressionMode,
StorageConfigurationProfile and StorageConfigurationFile properties using name-value arguments.bagWriter = ros2bagwriter(path,Name=Value)
You can use the StorageFormat
property to create the ROS 2 bag file in sqlite3 (DB3) and MCAP storage
format.
SplitSize property enables you to set the maximum size of the bag files to a value which will split the bag files after the size of the logged data reaches the specified value. You can also set the maximum bag file duration using SplitDuration property which will split the bag files after reaching the specified elapsed time. If you specify both SplitSize and SplitDuration properties, the bag file will split at the first threshold. You can specify these options and enable compression. You can also create a compressed ROS 2 bag file with ZSTD compression format and write messages to it.
StorageConfigurationProfile property enables you to configure the
configuration profile used in writing messages to a ROS 2 bag file, when the StorageFormat
property is set to "mcap". You can then set this StorageConfigurationProfile to "custom" and use the
StorageConfigurationFile property to configure MCAP writer with your own
customized settings, by proving the path to the .yaml file. This
.yaml file contains the custom storage configuration profile of the
MCAP writer. For more information on how to write the .yaml file, see
Write .yaml file
for MCAP storage format. The MCAP storage format supports only
"file" compression mode for ROS 2 bag file.
Note
For improved and faster performance, it is recommended to use the MCAP storage format when creating a ROS 2 bag file for writing messages to it.
