{"id":39079,"date":"2025-02-07T09:33:35","date_gmt":"2025-02-07T08:33:35","guid":{"rendered":"https:\/\/genesys-offenburg.de\/?post_type=smart-docs&#038;p=39079"},"modified":"2025-03-06T09:27:46","modified_gmt":"2025-03-06T08:27:46","slug":"ros2-recording-formats","status":"publish","type":"smart-docs","link":"https:\/\/genesys-offenburg.de\/en\/support\/integrationsloesungen\/ros\/ros2-recording-formats\/","title":{"rendered":"ROS2 &#8211; Recording formats"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-available-ros-formats\">Available ROS Formats<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-mcap-modern-capture-format\">MCAP (Modern Capture Format)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Newer format<\/strong> designed to be a <strong>high-performance<\/strong> alternative to <code>rosbag2<\/code>.<\/li>\n\n\n\n<li><strong>More efficient<\/strong> in terms of storage and playback speed.<\/li>\n\n\n\n<li><strong>Cross-platform &amp; language support<\/strong> (C++, Python, Rust, Go, etc.).<\/li>\n\n\n\n<li><strong>Better compression<\/strong> support (Zstandard, LZ4, and others).<\/li>\n\n\n\n<li><strong>Designed for large datasets<\/strong> and works well with sensors like LiDAR, cameras, and IMUs.<\/li>\n\n\n\n<li><strong>Faster indexing and seeking<\/strong>, improving playback efficiency.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-rosbag-ros-1-amp-ros-2\">ROSBAG (ROS 1 &amp; ROS 2)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Originally designed for <strong>ROS 1<\/strong> and adapted for <strong>ROS 2<\/strong>.<\/li>\n\n\n\n<li>Uses <strong>SQLite<\/strong> or other storage backends in ROS 2.<\/li>\n\n\n\n<li>Slower when handling <strong>large datasets<\/strong> compared to MCAP.<\/li>\n\n\n\n<li>Compression support, but <strong>not as efficient<\/strong> as MCAP.<\/li>\n\n\n\n<li><strong>Limited indexing &amp; metadata support<\/strong>, which can slow down seeking.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-which-one-should-you-use\">Which One Should You Use?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you are using <strong>ROS 2<\/strong>, MCAP is the preferred format because of its <strong>speed, efficiency, and better compression<\/strong>.<\/li>\n\n\n\n<li>If you are working with <strong>older ROS 1 systems<\/strong>, you might still need to use <code>rosbag<\/code>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-use-mcap-in-ros2\">How to use MCAP in ROS2?<\/h2>\n\n\n\n<p>ROS 2 supports MCAP as a storage backend for <code>ros2 bag<\/code>. To record using MCAP:<\/p>\n\n\n\n<div class=\"container_code\">\n    <button class=\"button_copy\">Copy<\/button>\n    <pre><code id=\"code_block\">ros2 bag record -a --storage mcap<\/code><\/pre>\n<\/div>\n\n<script>\n    document.querySelectorAll('.button_copy').forEach(button => {\n        button.addEventListener('click', function() {\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\n           \n            navigator.clipboard.writeText(code).then(() => {\n                this.textContent = \"Copied!\";\n                setTimeout(() => this.textContent = \"Copy\", 2000);\n            }).catch(err => console.error(\"Copy failed\", err));\n        });\n    });\n<\/script>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>To play it back: <\/p>\n\n\n\n<div class=\"container_code\">\n    <button class=\"button_copy\">Copy<\/button>\n    <pre><code id=\"code_block\">ros2 bag play<\/code><\/pre>\n<\/div>\n\n<script>\n    document.querySelectorAll('.button_copy').forEach(button => {\n        button.addEventListener('click', function() {\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\n           \n            navigator.clipboard.writeText(code).then(() => {\n                this.textContent = \"Copied!\";\n                setTimeout(() => this.textContent = \"Copy\", 2000);\n            }).catch(err => console.error(\"Copy failed\", err));\n        });\n    });\n<\/script>\n\n\n\n<p>The rosbag file can be recorded automatically at driver start with the\u00a0<code>record_rosbag<\/code>\u00a0argument in the\u00a0<code>adma_driver.launch.py<\/code>\u00a0set to True. By adapting the list\u00a0<code>recorded_topics<\/code>, the ROS topics getting written to the bag file can be chosen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-binary-format\">Binary Format<\/h2>\n\n\n\n<p>Besides the ROS data formats that can be recorded, it is also possible to logg the binary data stream in .gsdb files. The binary data get saved automatically by default in the directory of the executed terminal. We recommend to always log .gsdb files for support purposes and for being able to reprocess the raw data with new ROS driver updates. If not needed, the loggiung can be disabled\u00a0in the\u00a0<code>adma_driver.launch.py<\/code>\u00a0by setting\u00a0<code>log_gsdb_arg<\/code>\u00a0to False.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"383\" src=\"https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-1024x383.png\" alt=\"\" class=\"wp-image-39793\" srcset=\"https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-1024x383.png 1024w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-300x112.png 300w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-768x288.png 768w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-696x261.png 696w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-1068x400.png 1068w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10-1320x494.png 1320w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-10.png 1426w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This enables you to use the data in the ADMA Postprocessing toolchain seamlessly.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"205\" src=\"https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-1024x205.png\" alt=\"\" class=\"wp-image-39799\" srcset=\"https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-1024x205.png 1024w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-300x60.png 300w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-768x154.png 768w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-696x139.png 696w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12-1068x214.png 1068w, https:\/\/genesys-offenburg.de\/wp-content\/uploads\/2025\/02\/image-12.png 1308w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Available ROS Formats MCAP (Modern Capture Format) ROSBAG (ROS 1 &amp; ROS 2) Which One Should You Use? How to use MCAP in ROS2? ROS 2 supports MCAP as a storage backend for ros2 bag. To record using MCAP: Copy ros2 bag record -a &#8211;storage mcap To play it back: Copy ros2 bag play The [&hellip;]<\/p>\n","protected":false},"author":148,"featured_media":30266,"template":"","meta":{"_acf_changed":false,"_links_to":"","_links_to_type":0,"footnotes":""},"smartdocs_category":[812,890],"class_list":{"0":"post-39079","1":"smart-docs","2":"type-smart-docs","3":"status-publish","4":"has-post-thumbnail","6":"smartdocs_category-integrationsloesungen","7":"smartdocs_category-ros"},"acf":[],"_links":{"self":[{"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/smart-docs\/39079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/smart-docs"}],"about":[{"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/types\/smart-docs"}],"author":[{"embeddable":true,"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/users\/148"}],"version-history":[{"count":2,"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/smart-docs\/39079\/revisions"}],"predecessor-version":[{"id":39804,"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/smart-docs\/39079\/revisions\/39804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/media\/30266"}],"wp:attachment":[{"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/media?parent=39079"}],"wp:term":[{"taxonomy":"smartdocs_category","embeddable":true,"href":"https:\/\/genesys-offenburg.de\/en\/wp-json\/wp\/v2\/smartdocs_category?post=39079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}