From 7268886bfd3dfa1119f3e53ed975c3db8b915a3d Mon Sep 17 00:00:00 2001 From: HenryFarmX Date: Thu, 6 Aug 2026 10:37:08 -0700 Subject: [PATCH 1/4] Switched to mcap format logging with compression, options in /config/mcap_writer_options.yaml --- config/mcap_writer_options.yaml | 4 ++++ include/vb_util_lib/bag_logger.h | 1 + src/vb_util_lib/bag_logger.cpp | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 config/mcap_writer_options.yaml diff --git a/config/mcap_writer_options.yaml b/config/mcap_writer_options.yaml new file mode 100644 index 0000000..8a4cf74 --- /dev/null +++ b/config/mcap_writer_options.yaml @@ -0,0 +1,4 @@ +compression: "Zstd" +compressionLevel: "Fastest" +chunkSize: 786432 +noChunkCRC: true \ No newline at end of file diff --git a/include/vb_util_lib/bag_logger.h b/include/vb_util_lib/bag_logger.h index a938a26..3304384 100644 --- a/include/vb_util_lib/bag_logger.h +++ b/include/vb_util_lib/bag_logger.h @@ -25,6 +25,7 @@ #define DEFAULT_BAG_DIR "/var/log/amros/" +#define MOUNTED_MEDIA_DIR "/mnt/usb/" #define DEFAULT_MEDIA_DIR "/media/amros" diff --git a/src/vb_util_lib/bag_logger.cpp b/src/vb_util_lib/bag_logger.cpp index 08c1c44..e55595b 100644 --- a/src/vb_util_lib/bag_logger.cpp +++ b/src/vb_util_lib/bag_logger.cpp @@ -173,6 +173,8 @@ void BagLogger::startLogging(std::string prefix, unsigned log_level) rosbag2_storage::StorageOptions storage_options; storage_options.uri = /*std::string("sqlite:///") +*/ file_name_; + storage_options.storage_id = "mcap"; + storage_options.storage_config_uri = "/home/ubuntu/ros2_ws/src/am_utils/config/mcap_writer_options.yaml"; writer_ = std::make_unique(); writer_->open(storage_options); printf("Opening bag file %s\n", file_name_.c_str()); From 99cc29b8a4eaf09a90af1c76476987ee2386b008 Mon Sep 17 00:00:00 2001 From: HenryFarmX Date: Mon, 19 Oct 2026 12:39:05 -0700 Subject: [PATCH 2/4] Removed hard coded path to mcap/compressed logging config yaml --- CMakeLists.txt | 3 +++ src/vb_util_lib/bag_logger.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8496e5c..af96648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,9 @@ install(DIRECTORY include/ install(DIRECTORY launch/ DESTINATION share/${PROJECT_NAME} ) +install(DIRECTORY config + DESTINATION share/${PROJECT_NAME} + ) install( TARGETS am_utils EXPORT am_utilsTargets diff --git a/src/vb_util_lib/bag_logger.cpp b/src/vb_util_lib/bag_logger.cpp index e55595b..8bae8fa 100644 --- a/src/vb_util_lib/bag_logger.cpp +++ b/src/vb_util_lib/bag_logger.cpp @@ -174,7 +174,7 @@ void BagLogger::startLogging(std::string prefix, unsigned log_level) rosbag2_storage::StorageOptions storage_options; storage_options.uri = /*std::string("sqlite:///") +*/ file_name_; storage_options.storage_id = "mcap"; - storage_options.storage_config_uri = "/home/ubuntu/ros2_ws/src/am_utils/config/mcap_writer_options.yaml"; + storage_options.storage_config_uri = ament_index_cpp::get_package_share_directory("am_utils") + "/config/mcap_writer_options.yaml"; writer_ = std::make_unique(); writer_->open(storage_options); printf("Opening bag file %s\n", file_name_.c_str()); From 2d0770f3745e157ed2d7997cd2e417339e6bcf81 Mon Sep 17 00:00:00 2001 From: HenryFarmX Date: Mon, 19 Oct 2026 12:40:58 -0700 Subject: [PATCH 3/4] Removed unneccessary changes --- include/vb_util_lib/bag_logger.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/vb_util_lib/bag_logger.h b/include/vb_util_lib/bag_logger.h index 3304384..a938a26 100644 --- a/include/vb_util_lib/bag_logger.h +++ b/include/vb_util_lib/bag_logger.h @@ -25,7 +25,6 @@ #define DEFAULT_BAG_DIR "/var/log/amros/" -#define MOUNTED_MEDIA_DIR "/mnt/usb/" #define DEFAULT_MEDIA_DIR "/media/amros" From 31c197830e447703fa08a05250ed5d994b67f12e Mon Sep 17 00:00:00 2001 From: HenryFarmX Date: Mon, 19 Oct 2026 13:20:12 -0700 Subject: [PATCH 4/4] Added mcap dependencies --- CMakeLists.txt | 1 + package.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index af96648..22fcb91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() set(dependencies + ament_index_cpp brain_box_msgs builtin_interfaces camera_info_manager diff --git a/package.xml b/package.xml index 9cda0cf..32826e9 100644 --- a/package.xml +++ b/package.xml @@ -28,6 +28,7 @@ rosbag2 rosbag2_cpp rosbag2_storage + rosbag2_storage_mcap sensor_msgs std_msgs stereo_msgs @@ -36,6 +37,7 @@ tf2_ros visualization_msgs cv_bridge + ament_index_cpp ament_lint_auto ament_lint_common