{"id":42108,"date":"2025-07-11T12:25:24","date_gmt":"2025-07-11T10:25:24","guid":{"rendered":"https:\/\/genesys-offenburg.de\/?post_type=smart-docs&#038;p=42108"},"modified":"2025-07-11T12:29:28","modified_gmt":"2025-07-11T10:29:28","slug":"ros2-data-reception-and-logging","status":"publish","type":"smart-docs","link":"https:\/\/genesys-offenburg.de\/zh-hans\/support\/integrationsloesungen\/ros\/ros2-data-reception-and-logging\/","title":{"rendered":"ROS2 &#8211; Data reception and logging"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-checking-the-data-reception\">Checking the data reception<\/h2>\n\n\n\n<p>Check the currently published ROS topics by using:<\/p>\n\n\n\n<div class=\"container_code\">\r\n    <button class=\"button_copy\">Copy<\/button>\r\n    <pre><code id=\"code_block\">ros2 topic list<\/code><\/pre>\r\n<\/div>\r\n\r\n<script>\r\n    document.querySelectorAll('.button_copy').forEach(button => {\r\n        button.addEventListener('click', function() {\r\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\r\n           \r\n            navigator.clipboard.writeText(code).then(() => {\r\n                this.textContent = \"Copied!\";\r\n                setTimeout(() => this.textContent = \"Copy\", 2000);\r\n            }).catch(err => console.error(\"Copy failed\", err));\r\n        });\r\n    });\r\n<\/script>\n\n\n\n<div style=\"height:28px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Now you can visualize the live data:<\/p>\n\n\n\n<div class=\"container_code\">\n    <button class=\"button_copy\">Copy<\/button>\n    <pre><code id=\"code_block\">ros2 topic echo \/genesys\/adma\/\"topic-name\"<\/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<h2 class=\"wp-block-heading\" id=\"h-recording-data\">Recording Data<\/h2>\n\n\n\n<p>For recording the data you can either select some topics you want to record.<\/p>\n\n\n\n<div class=\"container_code\">\r\n    <button class=\"button_copy\">Copy<\/button>\r\n    <pre><code id=\"code_block\">ros2 bag record -o my_recording \/genesys\/adma\/imu \/ouster\/points\r\n<\/code><\/pre>\r\n<\/div>\r\n\r\n<script>\r\n    document.querySelectorAll('.button_copy').forEach(button => {\r\n        button.addEventListener('click', function() {\r\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\r\n           \r\n            navigator.clipboard.writeText(code).then(() => {\r\n                this.textContent = \"Copied!\";\r\n                setTimeout(() => this.textContent = \"Copy\", 2000);\r\n            }).catch(err => console.error(\"Copy failed\", err));\r\n        });\r\n    });\r\n<\/script>\n\n\n\n<div style=\"height:28px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Or you can logg all available ROS topics. <\/p>\n\n\n\n<div class=\"container_code\">\r\n    <button class=\"button_copy\">Copy<\/button>\r\n    <pre><code id=\"code_block\">ros2 bag record -a<\/code><\/pre>\r\n<\/div>\r\n\r\n<script>\r\n    document.querySelectorAll('.button_copy').forEach(button => {\r\n        button.addEventListener('click', function() {\r\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\r\n           \r\n            navigator.clipboard.writeText(code).then(() => {\r\n                this.textContent = \"Copied!\";\r\n                setTimeout(() => this.textContent = \"Copy\", 2000);\r\n            }).catch(err => console.error(\"Copy failed\", err));\r\n        });\r\n    });\r\n<\/script>\n\n\n\n<div style=\"height:28px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In ROS 2, you can record data in two formats: <strong>ROSBag<\/strong> and <strong>MCAP<\/strong>. We recommend using <strong>MCAP<\/strong> due to its superior performance, including faster indexing, better compression, and improved efficiency for large datasets. (Check <a href=\"https:\/\/genesys-offenburg.de\/support\/integrationsloesungen\/ros\/ros2-recording-formats\/\" target=\"_blank\" rel=\"noreferrer noopener\">ROS2 - Recording Formats<\/a>).<\/p>\n\n\n\n<div class=\"container_code\">\r\n    <button class=\"button_copy\">Copy<\/button>\r\n    <pre><code id=\"code_block\">ros2 bag record -a -s mcap<\/code><\/pre>\r\n<\/div>\r\n\r\n<script>\r\n    document.querySelectorAll('.button_copy').forEach(button => {\r\n        button.addEventListener('click', function() {\r\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\r\n           \r\n            navigator.clipboard.writeText(code).then(() => {\r\n                this.textContent = \"Copied!\";\r\n                setTimeout(() => this.textContent = \"Copy\", 2000);\r\n            }).catch(err => console.error(\"Copy failed\", err));\r\n        });\r\n    });\r\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-compressing-mcap-files\">Compressing MCAP files<\/h2>\n\n\n\n<p>To reduce the storage load of the measurement files (.mcap), use the mcap cli tool as follows:<\/p>\n\n\n\n<div class=\"container_code\">\r\n    <button class=\"button_copy\">Copy<\/button>\r\n    <pre><code id=\"code_block\">mcap_cli compress $FILENAME-INPUT.mcap -o $FILENAME-OUTPUT.mcap\r\n<\/code><\/pre>\r\n<\/div>\r\n\r\n<script>\r\n    document.querySelectorAll('.button_copy').forEach(button => {\r\n        button.addEventListener('click', function() {\r\n            const code = this.parentElement.querySelector('pre code').innerText; \/\/ Selects the code inside <pre><code>\r\n            \r\n            navigator.clipboard.writeText(code).then(() => {\r\n                this.textContent = \"Copied!\";\r\n                setTimeout(() => this.textContent = \"Copy\", 2000);\r\n            }).catch(err => console.error(\"Copy failed\", err));\r\n        });\r\n    });\r\n<\/script>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-smartdocs-notice\"><div class=\"smartdocs-block-notice notice-info\"><p><strong>Note<\/strong>: We recommend compressing each measurement file and replacing the original data file. All commonly used software and tools fully support working with compressed data files. Otherwise, the <strong>\"filename\"<\/strong> in the metadata file must be updated accordingly.<\/p><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Checking the data reception Check the currently publish [&hellip;]<\/p>\n","protected":false},"author":148,"featured_media":0,"template":"","meta":{"_acf_changed":false,"_links_to":"","_links_to_type":0,"footnotes":""},"smartdocs_category":[812,890],"class_list":{"0":"post-42108","1":"smart-docs","2":"type-smart-docs","3":"status-publish","5":"smartdocs_category-integrationsloesungen","6":"smartdocs_category-ros"},"acf":[],"_links":{"self":[{"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/smart-docs\/42108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/smart-docs"}],"about":[{"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/types\/smart-docs"}],"author":[{"embeddable":true,"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/users\/148"}],"version-history":[{"count":3,"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/smart-docs\/42108\/revisions"}],"predecessor-version":[{"id":42115,"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/smart-docs\/42108\/revisions\/42115"}],"wp:attachment":[{"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/media?parent=42108"}],"wp:term":[{"taxonomy":"smartdocs_category","embeddable":true,"href":"https:\/\/genesys-offenburg.de\/zh-hans\/wp-json\/wp\/v2\/smartdocs_category?post=42108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}