No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/rosbag2_storage_mcap+humble)
.


    $ ros2 bag record -s mcap /topic1 /topic2 ...

    $ ros2 bag play -s mcap path/to/your_recording.mcap

    $ ros2 bag info -s mcap path/to/your_recording.mcap


####  Maintainers


**[ emersonknapp ](/emersonknapp) ** commented  Apr 7, 2021  •


##  0.6.0 (2022-11-28)


_No known dependants._


[ mcap_vendor ](/p/mcap_vendor/github-ros2-rosbag2) [ ros2bag
](/p/ros2bag/github-ros2-rosbag2) [ rosbag2 ](/p/rosbag2/github-ros2-rosbag2)
[ rosbag2_compression ](/p/rosbag2_compression/github-ros2-rosbag2) [
rosbag2_compression_zstd ](/p/rosbag2_compression_zstd/github-ros2-rosbag2) [
rosbag2_cpp ](/p/rosbag2_cpp/github-ros2-rosbag2) [ rosbag2_examples_cpp
](/p/rosbag2_examples_cpp/github-ros2-rosbag2) [ rosbag2_examples_py
](/p/rosbag2_examples_py/github-ros2-rosbag2) [ rosbag2_interfaces
](/p/rosbag2_interfaces/github-ros2-rosbag2) [
rosbag2_performance_benchmarking ](/p/rosbag2_performance_benchmarking/github-
ros2-rosbag2) [ rosbag2_performance_benchmarking_msgs
](/p/rosbag2_performance_benchmarking_msgs/github-ros2-rosbag2) [ rosbag2_py
](/p/rosbag2_py/github-ros2-rosbag2) [ rosbag2_storage
](/p/rosbag2_storage/github-ros2-rosbag2) [ rosbag2_storage_default_plugins
](/p/rosbag2_storage_default_plugins/github-ros2-rosbag2) rosbag2_storage_mcap
[ rosbag2_storage_sqlite3 ](/p/rosbag2_storage_sqlite3/github-ros2-rosbag2) [
rosbag2_test_common ](/p/rosbag2_test_common/github-ros2-rosbag2) [
rosbag2_test_msgdefs ](/p/rosbag2_test_msgdefs/github-ros2-rosbag2) [
rosbag2_tests ](/p/rosbag2_tests/github-ros2-rosbag2) [ rosbag2_transport
](/p/rosbag2_transport/github-ros2-rosbag2) [ shared_queues_vendor
](/p/shared_queues_vendor/github-ros2-rosbag2) [ sqlite3_vendor
](/p/sqlite3_vendor/github-ros2-rosbag2) [ zstd_vendor
](/p/zstd_vendor/github-ros2-rosbag2)
---|---

github-ros2-rosbag2


###  Source Tutorials


    # Using the MCAP CLI https://github.com/foxglove/mcap/tree/main/go/cli/mcap
    $ mcap compress fast.mcap -o compressed.mcap
    # Using `ros2 bag convert`
    $ cat << EOF > convert.yaml
    output_bags:
      - uri: compressed
        storage_id: mcap
        storage_preset_profile: zstd_small
    EOF
    $ ros2 bag convert -i fast.mcap -o convert.yaml


_No launch files found_


rosbag2_storage_mcap is available as part of the [ current ROS 2 distributions
](https://docs.ros.org/en/rolling/Releases.html) . On Ubuntu, after following
the [ ROS 2 installation instructions
](https://docs.ros.org/en/humble/Installation.html) , you can use:


Copy link


Skip to content


###  Services


_No service files found_


Sorry, something went wrong.


> Now I think the question becomes - what's the functionality we want within
> that definitional framework?


####  Additional Links


To configure details of the MCAP writer for ` ros2 bag record ` , use the `
--storage-config-file ` options to provide a YAML file describing `
mcap::McapWriterOptions ` . Field descriptions below copied from [
McapWriterOptions declaration
](https://github.com/foxglove/mcap/blob/main/cpp/mcap/include/mcap/writer.hpp#L18)


Contributor


[ rclpy fails to run on arm64 after cross-compilation
](/question/329161/rclpy-fails-to-run-on-arm64-after-cross-compilation/)


    # Replace "rolling" with your ROS distro (`echo $ROS_DISTRO`)
    $ sudo apt install ros-rolling-rosbag2-storage-mcap


Field  |  Type / Values  |  Description
---|---|---
noChunkCRC  |  bool  |  Disable CRC calculation for Chunks. Ignored if `
noChunking=true ` .
noAttachmentCRC  |  bool  |  Disable CRC calculation for Attachments.
enableDataCRC  |  bool  |  Enables CRC calculation for the entire Data
section. Useful when ` noChunking=True ` .
noSummaryCRC  |  bool  |  Disable CRC calculation for the Summary section.
noChunking  |  bool  |  Do not write Chunks to the file, instead writing
Schema, Channel, and Message records directly into the Data section.
noMessageIndex  |  bool  |  Do not write Message Index records to the file. If
` noSummary=true ` and ` noChunkIndex=false ` , Chunk Index records will still
be written to the Summary section, providing a coarse message index.
noSummary  |  bool  |  Do not write Summary or Summary Offset sections to the
file, placing the Footer record immediately after DataEnd. This can provide
some speed boost to file writing and produce smaller files, at the expense of
requiring a conversion process later if fast summarization or indexed access
is desired.
chunkSize  |  unsigned int  |  Target uncompressed Chunk payload size in
bytes. Once a Chunk's uncompressed data meets or exceeds this size, the Chunk
will be compressed (if compression is enabled) and written to disk. Note that
smaller Chunks may be written, such as the last Chunk in the Data section.
This option is ignored if ` noChunking=true ` .
compression  |  "None", "Lz4", "Zstd"  |  Compression algorithm to use when
writing Chunks. This option is ignored if ` noChunking=true ` .
compressionLevel  |  "Fastest", "Fast", "Default", "Slow", "Slowest"  |
Compression level to use when writing Chunks. Slower generally produces
smaller files, at the expense of more CPU time. These levels map to different
internal settings for each compression algorithm.
forceCompression  |  bool  |  By default, Chunks that do not benefit from
compression will be written uncompressed. This option can be used to force
compression on all Chunks. This option is ignored if ` noChunking=true ` .
noRepeatedSchemas  |  bool  |  Advanced option.
noRepeatedChannels  |  bool  |  Advanced option.
noMetadataIndex  |  bool  |  Advanced option.
noChunkIndex  |  bool  |  Advanced option.
noStatistics  |  bool  |  Advanced option.
noSummaryOffsets  |  bool  |  Advanced option.

Example:


* [ ros_serialization ](/questions/scope:all/sort:activity-desc/tags:ros_serialization/page:1/)


Use MCAP files with regular [ ` ros2 bag ` commands
](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Recording-And-
Playing-Back-Data/Recording-And-Playing-Back-Data.html) by adding the `
--storage mcap ` option (abbreviated as ` -s mcap ` ):


###  ROS 2 Distro maintenance


    # mcap_writer_options.yml
    noChunkCRC: false
    noChunking: false
    noMessageIndex: false
    noSummary: false
    chunkSize: 786432
    compression: "Zstd"
    compressionLevel: "Fast"
    forceCompression: false

    $ ros2 bag record -s mcap -o my_bag --all --storage-config-file mcap_writer_options.yml


The check would work like: I get a Reader for format 1 ( ` Reader_1 ` ) and a
writer for format 2 ( ` Writer_2 ` ). The reader reports that it would return
NIF keys ` X ` , ` Y ` , and ` Z ` . The writer reports that it consumes ` X `
, ` Y ` , and ` A ` . So the conversion would occur with two warnings: One,
that any data pertaining to ` Z ` would be lost. Two, that it had to use
defaults for ` A ` in the new format.


edited


**[ emersonknapp ](/emersonknapp) ** commented  Apr 6, 2021  •


  * Overview
  * 0  Assets
  * 15  Dependencies
  * 0  Tutorials
  * 0  Q & A


[ mcap_vendor ](/ros-tooling/rosbag2_storage_mcap/tree/main/mcap_vendor
"mcap_vendor")


    noChunking: true
    noSummaryCRC: true


This is why I was thinking of having the keys being in the neutral
intermediary format (I'll just use NIF, it's shorter). Though the keys aren't
going to be 1:1 name-wise. Mostly, I'd see it as a way to tell at-a-glance
what type of information needs to be stored/read.


Deserializing multiple topics from a ROS2 Bag (SQLite3)


**[ amacneil ](/amacneil) ** commented  Apr 9, 2021  •


All of these cases work in ROS 1. I don't remember ever having incompatible
bag files, and I haven't experienced fundamental issues making different
versions of ROS talk to each other, and my first extensive use of ROS 1
started with Fuerte.

---

👍  1  emersonknapp reacted with thumbs up emoji


add a comment


Configures the MCAP writer for the highest possible write throughput and
lowest resource utilization. This preset does not calculate CRCs for integrity
checking, and does not write a message index. This preset profile is useful
for resource-constrained robots.


* [ ros2bag ](/questions/scope:all/sort:activity-desc/tags:ros2bag/page:1/)


[ rosbag2_storage_mcap_testdata ](/ros-
tooling/rosbag2_storage_mcap/tree/main/rosbag2_storage_mcap_testdata
"rosbag2_storage_mcap_testdata")


##  Usage


CHANGELOG


  * set defaults for SQLite plugin parity ( [ #68 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/68) )
  * rosbag2_storage_mcap: add storage preset profiles ( [ #57 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/57) )
  * rename test_fixture_interfaces package to testdata ( [ #64 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/64) )
  * Switch to using the vendored zstd library. ( [ #59 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/59) )
  * Add set_read_order reader API ( [ #54 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/54) )
  * Contributors: Chris Lalancette, Emerson Knapp, James Smith


Please note: ROS Answers requires javascript to work properly, please enable
javascript in your browser, [ here is how
](https://www.google.com/support/bin/answer.py?answer=23852)


Assignees


_No direct system dependencies._


  * mcap_storage: \'none\' is a valid storage preset profile ( [ #86 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/86) )
  * mcap_storage: handle update_metadata call ( [ #83 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/83) )
  * Update clang-format rules to fit ROS 2 style guide ( [ #80 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/80) )
  * Revert \"read_order: throw exception from set_read_order for unsupported orders\" This reverts commit aef9b9a65293f9e5d80a858ef84e485a8655a0c0.
  * read_order: throw exception from set_read_order for unsupported orders
  * Fix compile flags to work on rosbag_storage:0.17.x ( [ #78 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/78) ) This fixes the compile flags for rolling, which has two versions -- one that does not support read order (0.17.x) and one that does support read order (0.18.x).
  * Fix Windows build ( [ #73 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/73) ) Update mcap version to newest windows-compatible release. Add visibility macros for tests. Add clang-format preprocessor indentation for visibility_control to be readable.
  * Contributors: Andrew Symington, Emerson Knapp, James Smith, james-rms


I was referring to the invoked rosbag2's current implementation version for `
Bag Metadata Version ` and ` Storage Implementation Version ` \- by "current
format" i meant "the thing that happens by default when you write a bag with
rosbag2", or "the version of metadata and storage that is implemented by my
installed version of rosbag2"

---

👍  1  jhdcs reacted with thumbs up emoji


##  0.1.0 (2022-03-24)


I'm not sure that the converter would necessarily be intelligent to know what
the "current" format of a bag is. It would merely understand that you wanted
to convert from one ` Storage Type ` \- ` Storage Format ` pair to another. It
would just happen in this case that the ` Storage Type ` is unchanged, and the
data within is just being laid out slightly differently. This was the use case
that I figured you were talking about here ( [ #677 (comment)
](https://github.com/ros2/rosbag2/issues/677#issuecomment-801468839) ), and
what spawned this issue initially. I just realized that once you're
transforming data into a different format, it's not a _gigantic_ logical leap
to transform it into a different ` Storage Type ` . You're still just
"transforming data", it's just that your transformation has gotten a bit
bigger.


#  Provide feedback


[ .github/  workflows  ](/ros-
tooling/rosbag2_storage_mcap/tree/main/.github/workflows "This path skips
through empty directories")


Whenever a ROS 2 distribution reaches EOL, search for comments marked
COMPATIBILITY - which may no longer be needed when no new releases will be
made for that distro.


No version for distro **hydro** . Known supported distros are highlighted in
the buttons above.


This package was recently merged into [ https://github.com/ros2/rosbag2
](https://github.com/ros2/rosbag2/tree/rolling/rosbag2_storage_mcap/ros2/rosbag2)
from [ https://github.com/ros-tooling/rosbag2_storage_mcap
](https://github.com/ros2/rosbag2/tree/rolling/rosbag2_storage_mcap/ros-
tooling/rosbag2_storage_mcap) . To view historical pull requests and git
history of this package, check [ here ](https://github.com/ros-
tooling/rosbag2_storage_mcap/commits/main) .


Copy link


####  Package Summary


  * Added mcap_vendor package. Updated CMakeLists.txt to fetch dependencies with FetchContent rather than Conan.
  * Contributors: Jacob Bandes-Storch


####  ` fastwrite `


Cancel  Submit feedback


[ [ROS2] publishing UInt16 ](/question/349003/ros2-publishing-uint16/)


Failed to get question list, you can ticket an issue [ here
](https://github.com/ros-infrastructure/rosindex/issues/new)


Equivalent to this storage configuration:


* [ The ReadME Project  GitHub community articles  ](/readme)


[ ](https://github.com/)


[ jhdcs ](/jhdcs) opened this issue  Apr 6, 2021  · 24 comments


**[ emersonknapp ](/emersonknapp) ** commented  Apr 7, 2021  •


> > you are referring to the "stitcher" that is under development
>
> If you read through the discussion, you'll see that "Stitcher" was an
> inappropriate name for the API that will be presented there, and we are
> discussing the proper naming for it. I've suggested "Rewriter" - which
> starts to look a lot like a "Converter", which is why it is good for us to
> be very precise with definitions of terms.


No version for distro **indigo** . Known supported distros are highlighted in
the buttons above.


Name


* Foxglove


Search or jump to...


EDIT: sounds like we have a new concept to add: ` Message Definition Version `
\- which gets baked into a ` Serialized Message ` implicitly. There is no
explicit storage of a version for the message definitions, perhaps we could
grab the package version for the package a message is defined in, then store
that as more metadata within the bag. That would allow for us to tell at a
glance whether it might have changed.

---

All reactions


Sorry, something went wrong.


**Tags** |  _No category tags._
---|---
**Version** |  0.26.0
**License** |  Apache-2.0
**Build type** |  AMENT_CMAKE
**Use** |  RECOMMENDED

###  Repository Summary


We read every piece of feedback, and take your input very seriously.


> What you have called a "Type/Format Pair" looks to me like the combination
> of
>
>
>     * `rosbag2_storage::StorageOptions`
>
>     * `rosbag2_transport::RecordOptions`
>


Collaborator


##  0.1.5 (2022-04-25)


Closed


##  Related questions


[ Sign in ](/login?return_to=https%3A%2F%2Fgithub.com%2Fros-
tooling%2Frosbag2_storage_mcap)


For


---

All reactions


    * [ Enterprise ](/enterprise)
    * [ Teams ](/team)
    * [ Startups ](/enterprise/startups)
    * [ Education  ](https://education.github.com)


##  0.1.6 (2022-07-22)


edited


####  ` fastwrite `


##  Usage


##  0.1.2 (2022-04-20)


  *[
              2021-01-14 10:47:48 -0500
             ]: 2021-01-14 10:47:48 -0500
  *[
              2021-04-01 08:26:37 -0500
             ]: 2021-04-01 08:26:37 -0500
  *[
              2021-04-02 06:36:49 -0500
             ]: 2021-04-02 06:36:49 -0500
  *[
        2021-01-14 10:47:48 -0500
       ]: 2021-01-14 10:47:48 -0500
  *[
        2024-04-17 19:33:13 -0500
       ]: 2024-04-17 19:33:13 -0500


[ **13** watching ](/ros-tooling/rosbag2_storage_mcap/watchers)


That is a good question, that I'm not sure I fully addressed/touched on in my
original post. I'll try to expand my thoughts on the matter here.


[ Sign up
](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-
name%3E%2F%3Crepo-
name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-
repo&source_repo=ros2%2Frosbag2)


[ Generic Bag(s)->Bag(s) Rewriter  #831  ](/ros2/rosbag2/issues/831)


The approach I'm trying ( [ found here ](https://kyungpyo-
kim.github.io/study/ros2-bag-file-parsing/) ) is to use `
rosbag2::converter_interfaces::SerializationFormatConverter ` :


**Checkout URI** |  [ https://github.com/ros2/rosbag2.git
](https://github.com/ros2/rosbag2.git)
---|---
**VCS Type** |  git
**VCS Version** |  iron
**Last Updated**

2024-02-08  |  **Dev Status** |  DEVELOPED
**CI status** |  No Continuous Integration
**Released** |  RELEASED
**Tags** |  _No category tags._
**Contributing** |  [ Help Wanted (  0  ) ](/r/rosbag2/#iron-contribute-lists-
help-wanted)
[ Good First Issues (  0  ) ](/r/rosbag2/#iron-contribute-lists-good-first-
issue)
[ Pull Requests to Review (  0  ) ](/r/rosbag2/#iron-contribute-lists-pull-
requests)

###  Package Description


  Guides

  * [ Python ](/guides/python/ros2)


##  1\. Upgrade an old bag format to the current bag format


[ Hi there! Please sign in
](/account/signin/?next=/question/369573/deserializing-multiple-topics-from-a-
ros2-bag-sqlite3/) [ help ](/help/ "help")


Equivalent to this storage configuration:


Collaborator


You can also use one of the preset profiles described below, for example:


###  Topics


[ subscribe to rss feed ](/feeds/question/369573/ "subscribe to the rss feed")


I don't mind if they're a little more verbose and therefore self-contained
definitions - especially since it sounds like these should mostly be "under
the hood". I'd rather wait until later - I am seeing something like the
following concepts:


####  Package Summary


[ CPPLINT.cfg ](/ros-tooling/rosbag2_storage_mcap/blob/main/CPPLINT.cfg
"CPPLINT.cfg")


All reactions


##  0.1.1 (2022-04-01)


I just found the portion you were talking about, thanks for pointing it out! I
had missed that. And I absolutely agree - it's best to have precise
definitions so that everyone's in sync before starting on a potentially large
project like this.


auto type_support = rosbag2::get_typesupport(datatype_name, "rosidl_typesupport_cpp");


Seen: **2,269 times**


No version for distro **bouncy** . Known supported distros are highlighted in
the buttons above.


Closed


###  [ rosbag2_storage_mcap ](/p/rosbag2_storage_mcap) package from [ rosbag2
](/r/rosbag2/github-ros2-rosbag2) repo


_No README found._ _[ See repository README. ](/r/rosbag2_storage_mcap/github-
ros-tooling-rosbag2_storage_mcap/#galactic) _


**[ jhdcs ](/jhdcs) ** commented  Apr 7, 2021


    * [ All features ](/features)
    * [ Documentation  ](https://docs.github.com)
    * [ GitHub Skills  ](https://skills.github.com/)
    * [ Blog  ](https://github.blog)


---

[
API Docs ](http://docs.ros.org/en/rolling/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [
Browse Code
](https://github.com/ros2/rosbag2/tree/rolling/rosbag2_storage_mcap "View
source code on repository")


* Revert \"rosbag2_storage_mcap: add storage preset profiles\" This reverts commit 38830add3935b978968fe2703d3180b413ccc8c2.


Contributor  Author


a community-maintained index of robotics software | [ privacy ](/privacy.txt)


##  0.1.3 (2022-04-20)


[ [WIP] Adding Rewriter  #709  ](/ros2/rosbag2/pull/709)


  * README
  * Apache-2.0 license


###  Dependant Packages


CHANGELOG


  * Foxglove
  * Michael Orlov
  * ROS Tooling Working Group


* Solutions


_No message files found._


##  Question Tools


By Solution


####  Authors


##  Use saved searches to filter your results more quickly


I'm not limited to C++, I found some cool python libraries that could help but
they do not support Dashing unfortunately.


###  ROS 2 Distro maintenance


          // optionally, print:
          // std::cout << (int)msgColor.r << " " << (int)msgColor.g << " " <<  (int)msgColor.b <<  std::endl;
        }
      }
    }


What you have called a "Type/Format Pair" looks to me like the combination of


##  0.1.1 (2022-04-01)


|  [ Ask Your Question ](/questions/ask/)
---|---|---|---

1


> I'd like to figure out how to make a differentiation between
>
>
>     1. "upgrade an old bag format to the current bag format" - this prompts
> a larger discussion about how we handle bag format versioning (metadata
> format or storage format)
>
>     2. "rewrite a bag within the same version, with different configuration"
> - which is what we're discussing on #709. I think there exists a trivial
> implementation for this.
>


#  rosbag2_storage_mcap


  Inspect MCAP

Use the [ ` mcap ` CLI tool
](https://github.com/foxglove/mcap/tree/main/go/cli/mcap) to inspect MCAP
files, validate their contents, and even echo their messages to ` stdout ` .

For an exhaustive list of ways to interact with your MCAP data, check out the
[ mcap GitHub repo ](https://github.com/foxglove/mcap/tree/main/go/cli/mcap) .


This is partially why I was thinking of a "neutral intermediary format". It
would allow you to load up the data and quickly check for missing/added keys
like I outlined in the previous paragraph, but at the added cost of extra time
and possibly RAM usage. An alternative could also be to somehow parse the
bag's first data row, and try to extract what keys are different between the
input/output configurations. This would rely on a row-based storage solution,
though.


##  Development


###  Wiki Tutorials


  * CMake build script will now execute pip install conan automatically.
  * Contributors: Daisuke Nishimatsu


#  Search code, repositories, users, issues, pull requests...


_No plugins found._


**[ emersonknapp ](/emersonknapp) ** commented  Apr 6, 2021  •


_No message files found._


I am not sure _exactly_ what is meant by this, but I'm guessing from the issue
that you linked that you are referring to the "stitcher" that is under
development. I don't think the converter would really do this. In my mind,
it's supposed to be more focused on transforming between ` Storage Type ` \- `
Storage Format ` pairs. It may _call_ the "stitcher" as part of the
transformation process, but that wouldn't be it's primary focus.


[
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=80&u=e790a8959c895c919401b76e17bb58b6814b9e9a&v=4)
](/jhdcs)


README


  * Upgrade mcap to fix LZ4 error and segfault ( [ #42 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/42) ) Incorporates fixes from [ https://github.com/foxglove/mcap/pull/478 ](https://github.com/foxglove/mcap/pull/478) and [ https://github.com/foxglove/mcap/pull/482 ](https://github.com/foxglove/mcap/pull/482)
  * Contributors: Jacob Bandes-Storch


$ ros2 bag record -s mcap -o my_bag --all --storage-preset-profile fastwrite


  * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
  * [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
  * [ Security ](/security)
  * [ Status ](https://www.githubstatus.com/)
  * [ Docs ](https://docs.github.com/)
  * [ Contact ](https://support.github.com?tags=dotcom-footer)
  * Manage cookies
  * Do not share my personal information


Contributor  Author


Query


Last updated: **Apr 02 '21**


humble  iron  rolling  noetic


[ Branches  ](/ros-tooling/rosbag2_storage_mcap/branches) [ Tags  ](/ros-
tooling/rosbag2_storage_mcap/tags)


Search or jump to...


edited


Older


##  0.1.2 (2022-04-20)


_No additional links._


Copy link


[ README.md ](/ros-tooling/rosbag2_storage_mcap/blob/main/README.md
"README.md")


![](/assets/package.png) |


then I recorded all three topics with


[ Sign in
](/login?return_to=https%3A%2F%2Fgithub.com%2Fros2%2Frosbag2%2Fissues%2F717)


    * [ Learning Pathways  ](https://resources.github.com/learn/pathways/)
    * [ White papers, Ebooks, Webinars  ](https://resources.github.com/)
    * [ Customer Stories ](/customer-stories)
    * [ Partners  ](https://partner.github.com/)


> Reading Emerson's comment at [ here
> ](https://github.com/ros2/rosbag2/pull/709#discussion_r611110847) , perhaps
> we should make some clearer definitions for each of the operations that the
> converter can perform?
>
> Some ideas:
>  Changing storage version -> ` re-version `
>  Changing storage implementation (ex: from ` sqlite ` to ` ros1bag ` ) -> `
> transmute `


[ ](/ros-tooling/rosbag2_storage_mcap/branches) [ ](/ros-
tooling/rosbag2_storage_mcap/tags)


##  0.1.5 (2022-04-25)


##  0.1.0 (2022-03-24)


_No known dependants._


##  0.1.7 (2022-08-15)


###  Messages


###  Writer Configuration


####  Package Summary


**Checkout URI** |  [ https://github.com/ros-tooling/rosbag2_storage_mcap.git
](https://github.com/ros-tooling/rosbag2_storage_mcap.git)
---|---
**VCS Type** |  git
**VCS Version** |  main
**Last Updated**

2022-11-29  |  **Dev Status** |  DEVELOPED
**CI status** |  No Continuous Integration
**Released** |  RELEASED
**Tags** |  _No category tags._
**Contributing** |  [ Help Wanted (  0  ) ](/r/rosbag2_storage_mcap/#galactic-
contribute-lists-help-wanted)
[ Good First Issues (  0  ) ](/r/rosbag2_storage_mcap/#galactic-contribute-
lists-good-first-issue)
[ Pull Requests to Review (  0  ) ](/r/rosbag2_storage_mcap/#galactic-
contribute-lists-pull-requests)

###  Package Description


[ jhdcs ](/jhdcs) opened this issue  Apr 6, 2021  · 24 comments


###  Recent questions tagged ` rosbag2_storage_mcap ` at **[ Robotics Stack
Exchange ](https://robotics.stackexchange.com/) **


Equivalent to this storage configuration:


[ mcap.dev/ ](https://mcap.dev/ "https://mcap.dev/")


All reactions


  * [ Notifications ](/login?return_to=%2Fros-tooling%2Frosbag2_storage_mcap)
  * [ Fork  5  ](/login?return_to=%2Fros-tooling%2Frosbag2_storage_mcap)
  * [ Star  30  ](/login?return_to=%2Fros-tooling%2Frosbag2_storage_mcap)


    * [ Actions  Automate any workflow  ](/features/actions)
    * [ Packages  Host and manage packages  ](/features/packages)
    * [ Security  Find and fix vulnerabilities  ](/features/security)
    * [ Codespaces  Instant dev environments  ](/features/codespaces)
    * [ Copilot  Write better code with AI  ](/features/copilot)
    * [ Code review  Manage code changes  ](/features/code-review)
    * [ Issues  Plan and track work  ](/features/issues)
    * [ Discussions  Collaborate outside of code  ](/features/discussions)


  * Support timestamp-ordered playback ( [ #50 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/50) )
  * Support regex topic filtering
  * Contributors: James Smith


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/rosbag2_storage_mcap/Tutorials)
for more details. _


First, I started the node:


_No additional links._


###  Wiki Tutorials


##  Installation


###  Launch files


rosbag2 storage plugin using the MCAP file format


Copy link


    [INFO] [rosbag2_storage]: Opened database '../rosbag2_test_data_multi'.
    0x96d480    turtlesim/msg/Pose  Pose
    0x96d480    turtlesim/msg/Pose  Pose
    terminate called after throwing an instance of 'eprosima::fastcdr::exception::NotEnoughMemoryException'
      what():  Not enough memory in the buffer stream


Sorry, something went wrong.


You signed in with another tab or window. [ Reload ]() to refresh your
session.  You signed out in another tab or window. [ Reload ]() to refresh
your session.  You switched accounts on another tab or window. [ Reload ]() to
refresh your session.  Dismiss alert


Password


add a comment


[
![@emersonknapp](https://avatars.githubusercontent.com/u/537409?s=80&u=df10fea87305edde062008566721a9968483fa56&v=4)
](/emersonknapp)


[
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=40&u=e790a8959c895c919401b76e17bb58b6814b9e9a&v=4)
](/jhdcs) [ jhdcs ](/jhdcs) closed this as [ completed
](/ros2/rosbag2/issues?q=is%3Aissue+is%3Aclosed+archived%3Afalse+reason%3Acompleted)
Jul 30, 2021


Skip to main content

[ ![MCAP Logo](/img/mcap240.webp) ![MCAP Logo](/img/mcap240.webp) **MCAP**
](/) [ Guides ](/guides) [ API Reference ](/reference) [ Specification
](/spec)

[ Slack  ](https://foxglove.dev/slack) [ GitHub
](https://github.com/foxglove/mcap)

  * [ Introduction ](/guides)
  * [ Concepts ](/guides/concepts)
  * [ CLI ](/guides/cli)
  * [ Getting Started ](/guides/getting-started)

    * [ FlatBuffers ](/guides/getting-started/flatbuffers)
    * [ JSON ](/guides/getting-started/json)
    * [ Protobuf ](/guides/getting-started/protobuf)
    * [ ROS 1 ](/guides/getting-started/ros-1)
    * [ ROS 2 ](/guides/getting-started/ros-2)
  * [ C++ ](/category/c)

  * [ Python ](/category/python)

  * [ Benchmarks ](/category/benchmarks)

  * [ ](/)
  * [ Getting Started  ](/guides/getting-started)
  * ROS 2

On this page


I think that the storage implementation should be allowed to update its schema
over time. Each new schema would be a new ` Storage Implementation Version `
with its own reader and writer. Ideally, this shouldn't have to happen too
often, but this way we can support the most conversions, and have more
breathing room if we need to change schemas (since we can tell people to
update the schema, and point them to this tool to do it for them).


  * [1.0.0] Use Summary section for get_metadata() and seek(), implement remaining methods ( [ #17 ](https://github.com/wep21/rosbag2_storage_mcap/issues/17) )
  * feat: add play impl ( [ #16 ](https://github.com/wep21/rosbag2_storage_mcap/issues/16) )
  * chore: refine package.xml ( [ #15 ](https://github.com/wep21/rosbag2_storage_mcap/issues/15) )
  * Don\'t throw when READ_WRITE mode is used; add .mcap file extension to recorded files ( [ #14 ](https://github.com/wep21/rosbag2_storage_mcap/issues/14) ) I may be missing something, but from a cursory glance at [this code]( [ https://github.com/ros2/rosbag2/blob/342d8ed3c1c4ae0411a4a92b60e79a728b8974b8/rosbag2_storage/src/rosbag2_storage/impl/storage_factory_impl.hpp#L108-L135 ](https://github.com/ros2/rosbag2/blob/342d8ed3c1c4ae0411a4a92b60e79a728b8974b8/rosbag2_storage/src/rosbag2_storage/impl/storage_factory_impl.hpp#L108-L135) ), it appears that the [APPEND]{.title-ref} mode is never used. This means we need to support [READ_WRITE]{.title-ref}. This also adds a [.mcap]{.title-ref} extension to recorded file names.
  * Add dynamic message definition lookup ( [ #13 ](https://github.com/wep21/rosbag2_storage_mcap/issues/13) ) Currently, an exception will be thrown if lookup fails.
  * Switch C++ formatter to clang-format ( [ #12 ](https://github.com/wep21/rosbag2_storage_mcap/issues/12) ) Remove uncrustify linter in favor of clang-format, which is easier to configure for use in VS Code format-on-save.
  * Merge pull request [ #7 ](https://github.com/wep21/rosbag2_storage_mcap/issues/7) from ros-tooling/jhurliman/reader-writer Reader and writer implementation
  * uninitialized struct
  * lint
  * lint
  * lint
  * Reader and writer implementation
  * Merge pull request [ #6 ](https://github.com/wep21/rosbag2_storage_mcap/issues/6) from wep21/add-metadata-impl feat: add metadata impl
  * feat: add metadata impl
  * Merge pull request [ #5 ](https://github.com/wep21/rosbag2_storage_mcap/issues/5) from wep21/mcap-storage-impl feat: mcap storage impl
  * chore: update cmake minimum version
  * chore: install mcap header
  * chore: include mcap header
  * fix: move fetch content into rosbag2 storage mcap
  * Merge pull request [ #3 ](https://github.com/wep21/rosbag2_storage_mcap/issues/3) from ros-tooling/emersonknapp/mcap_plugin_skeleton Add mcap storage plugin skeleton and CI
  * Add rosbag2_storage_mcap skeleton
  * Contributors: Daisuke Nishimatsu, Emerson Knapp, Jacob Bandes-Storch, John Hurliman, wep21


Contributor  Author


rosbag2_storage_mcap is available as part of the [ current ROS 2 distributions
](https://docs.ros.org/en/rolling/Releases.html) . On Ubuntu, after following
the [ ROS 2 installation instructions
](https://docs.ros.org/en/humble/Installation.html) , you can use:


##  0.6.0 (2022-11-28)


##  0.1.4 (2022-04-21)


##  0.15.4 (2023-01-10)


    * [ Topics ](/topics)
    * [ Trending ](/trending)
    * [ Collections ](/collections)


before deserializing.


##  rosbag2_storage_mcap


####  Additional Links


[ Sign in ](/login?return_to=https%3A%2F%2Fgithub.com%2Fros-
tooling%2Frosbag2_storage_mcap)


Historically, in ROS 1, there were a few version changes, and no explicit
guarantee of compatibility: [ http://wiki.ros.org/Bags/Format
](http://wiki.ros.org/Bags/Format) . It's been stable for quite some time. I
don't want to completely derail [ @jhdcs ](https://github.com/jhdcs) 's issue,
so maybe there is a more appropriate place to continue this discussion.

---

All reactions


###  Wiki Tutorials


[ Activity  ](/ros-tooling/rosbag2_storage_mcap/activity)


  Using ` ros2 bag convert `

To convert your existing ROS 2 ` .db3 ` files into MCAP files, you can use `
ros2 bag convert ` from within your ROS2 workspace.

    $ cat << EOF > convert.yaml
    output_bags:
      - uri: ros2_output
        storage_id: mcap
        all: true
    EOF
    $ ros2 bag convert -i ros2_input.db3 -o convert.yaml


##  Installation


To configure details of the MCAP writer for ` ros2 bag record ` , use the `
--storage-config-file ` options to provide a YAML file describing `
mcap::McapWriterOptions ` . Field descriptions below copied from [
McapWriterOptions declaration
](https://github.com/foxglove/mcap/blob/main/cpp/mcap/include/mcap/writer.hpp#L18)


_No additional authors._


Collaborator


    * [ All features ](/features)
    * [ Documentation  ](https://docs.github.com)
    * [ GitHub Skills  ](https://skills.github.com/)
    * [ Blog  ](https://github.blog)


##  Use saved searches to filter your results more quickly


This commit does not belong to any branch on this repository, and may belong
to a fork outside of the repository.


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/rosbag2_storage_mcap+rolling)
.


main


Copy link


_No service files found_


The end user would not know what the actual internal storage names are for
each of the formats. The NIF would describe them like "Message Timestamp", or
"Message Index". If they went digging through the code, they could figure it
out. But they could do that right now anyways.


###  Storage Preset Profiles


$ ros2 bag record -s mcap -o my_bag --all --storage-preset-profile fastwrite


4 participants


Skip to content


**[ jhdcs ](/jhdcs) ** commented  Apr 12, 2021


edited


Is there a way to set a combination of ` datatype_name ` in the type_support?


**[ danthony06 ](/danthony06) ** commented  Apr 9, 2021


[ rosbag2_storage_mcap/README.md
](https://github.com/ros2/rosbag2/tree/humble/rosbag2_storage_mcap/README.md
"Open in git repository")


##  Usage


  * mcap_storage: \'none\' is a valid storage preset profile ( [ #86 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/86) )
  * mcap_storage: handle update_metadata call ( [ #83 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/83) )
  * Update clang-format rules to fit ROS 2 style guide ( [ #80 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/80) )
  * Revert \"read_order: throw exception from set_read_order for unsupported orders\" This reverts commit aef9b9a65293f9e5d80a858ef84e485a8655a0c0.
  * read_order: throw exception from set_read_order for unsupported orders
  * Fix compile flags to work on rosbag_storage:0.17.x ( [ #78 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/78) ) This fixes the compile flags for rolling, which has two versions -- one that does not support read order (0.17.x) and one that does support read order (0.18.x).
  * Fix Windows build ( [ #73 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/73) ) Update mcap version to newest windows-compatible release. Add visibility macros for tests. Add clang-format preprocessor indentation for visibility_control to be readable.
  * Contributors: Andrew Symington, Emerson Knapp, James Smith, james-rms


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/rosbag2_storage_mcap/Tutorials)
for more details. _


[ rosbag2_storage_mcap_testdata ](/ros-
tooling/rosbag2_storage_mcap/tree/main/rosbag2_storage_mcap_testdata
"rosbag2_storage_mcap_testdata")


Though, if people disagree with me, and think that they _do_ in fact cover the
same ground, I don't think that extending the API to just route a call to the
"stitcher" would be a bad thing. If an end user calls the converter and asks
it to stitch a file, they don't want a lecture from me about how they should
_actually_ be calling the "stitcher". They want their bag stitched!

---

All reactions


Jump to bottom


Toggle navigation


With those definitions/thoughts out of the way, I'll apply it to the two
issues you've raised:


  Using the ` mcap ` CLI tool

The [ ` mcap ` CLI tool
](https://github.com/foxglove/mcap/tree/main/go/cli/mcap


Or, whoever implements each reader and each writer has some sort of hardcoded
keys correspond with each schema, and their defaults. When matching them up,
the converter will be able to compare these two sets of keys for differences.
It would also have the added bonus that the reader would be able to check for
corrupted input bags... Potentially...


##  0.1.3 (2022-04-20)


#  ROS 2 Bag Converter  #717


* [ Pricing ](/pricing)


##  Definitions


####  ` zstd_fast `


[ .vscode ](/ros-tooling/rosbag2_storage_mcap/tree/main/.vscode ".vscode")


I think your definition is much better than mine. Let's go with yours moving
forward.


  * Read/parse from any valid ROS 2 bag format, _both old and new_
  * Convert parsed data into a neutral intermediary format
  * Write from neutral intermediary format to any valid ROS 2 bag format, _both old and new_
  * Report any data that would be lost due to the transference to the new format
  * Report any data that would be missing from the new format


##  ⚠ Move from ` ros-tooling ` organization


    # mcap_writer_options.yml
    noChunkCRC: false
    noChunking: false
    noMessageIndex: false
    noSummary: false
    chunkSize: 786432
    compression: "Zstd"
    compressionLevel: "Fast"
    forceCompression: false

    $ ros2 bag record -s mcap -o my_bag --all --storage-config-file mcap_writer_options.yml


##  0.1.1 (2022-04-01)


This is being closed in favor of other spawned issues.

---

All reactions


[ How to get ROS2 parameter hosted by another Node ](/question/340600/how-to-
get-ros2-parameter-hosted-by-another-node/)


Equivalent to this storage configuration:


[ Report repository ](/contact/report-
content?content_url=https%3A%2F%2Fgithub.com%2Fros-
tooling%2Frosbag2_storage_mcap&report=ros-tooling+%28user%29)


This package provides a [ storage plugin
](https://github.com/ros2/rosbag2#storage-format-plugin-architecture) for
rosbag2 which extends it with support for the [ MCAP ](https://mcap.dev) file
format.


  * [ github-ros2-rosbag2 ](/p/rosbag2_storage_mcap/github-ros2-rosbag2)
  * [ github-ros-tooling-rosbag2_storage_mcap ](/p/rosbag2_storage_mcap/github-ros-tooling-rosbag2_storage_mcap)


1\. Moved code responsible for adding schema and channel from write(msg) to
create_topic(topic) method to reduce performance burden on first message write
and in lieu to preparation for moving schema collection process to upper
SequentialWriter layer.


Labels


Copy link


[ ](https://lunrjs.com/guides/searching.html "Help to Search")


Clear


* [ GitHub Sponsors  Fund open source developers  ](/sponsors)


Sorry, something went wrong.


#  ⚠  Moved to [ ros2/rosbag2 ](https://github.com/ros2/rosbag2) ⚠


  * [ Code  ](/ros2/rosbag2)
  * [ Issues  ](/ros2/rosbag2/issues)
  * [ Pull requests  ](/ros2/rosbag2/pulls)
  * [ Actions  ](/ros2/rosbag2/actions)
  * [ Projects  ](/ros2/rosbag2/projects)
  * [ Security  ](/ros2/rosbag2/security)
  * [ Insights  ](/ros2/rosbag2/pulse)


  * [1.0.0] Use Summary section for get_metadata() and seek(), implement remaining methods ( [ #17 ](https://github.com/wep21/rosbag2_storage_mcap/issues/17) )
  * feat: add play impl ( [ #16 ](https://github.com/wep21/rosbag2_storage_mcap/issues/16) )
  * chore: refine package.xml ( [ #15 ](https://github.com/wep21/rosbag2_storage_mcap/issues/15) )
  * Don\'t throw when READ_WRITE mode is used; add .mcap file extension to recorded files ( [ #14 ](https://github.com/wep21/rosbag2_storage_mcap/issues/14) ) I may be missing something, but from a cursory glance at [this code]( [ https://github.com/ros2/rosbag2/blob/342d8ed3c1c4ae0411a4a92b60e79a728b8974b8/rosbag2_storage/src/rosbag2_storage/impl/storage_factory_impl.hpp#L108-L135 ](https://github.com/ros2/rosbag2/blob/342d8ed3c1c4ae0411a4a92b60e79a728b8974b8/rosbag2_storage/src/rosbag2_storage/impl/storage_factory_impl.hpp#L108-L135) ), it appears that the [APPEND]{.title-ref} mode is never used. This means we need to support [READ_WRITE]{.title-ref}. This also adds a [.mcap]{.title-ref} extension to recorded file names.
  * Add dynamic message definition lookup ( [ #13 ](https://github.com/wep21/rosbag2_storage_mcap/issues/13) ) Currently, an exception will be thrown if lookup fails.
  * Switch C++ formatter to clang-format ( [ #12 ](https://github.com/wep21/rosbag2_storage_mcap/issues/12) ) Remove uncrustify linter in favor of clang-format, which is easier to configure for use in VS Code format-on-save.
  * Merge pull request [ #7 ](https://github.com/wep21/rosbag2_storage_mcap/issues/7) from ros-tooling/jhurliman/reader-writer Reader and writer implementation
  * uninitialized struct
  * lint
  * lint
  * lint
  * Reader and writer implementation
  * Merge pull request [ #6 ](https://github.com/wep21/rosbag2_storage_mcap/issues/6) from wep21/add-metadata-impl feat: add metadata impl
  * feat: add metadata impl
  * Merge pull request [ #5 ](https://github.com/wep21/rosbag2_storage_mcap/issues/5) from wep21/mcap-storage-impl feat: mcap storage impl
  * chore: update cmake minimum version
  * chore: install mcap header
  * chore: include mcap header
  * fix: move fetch content into rosbag2 storage mcap
  * Merge pull request [ #3 ](https://github.com/wep21/rosbag2_storage_mcap/issues/3) from ros-tooling/emersonknapp/mcap_plugin_skeleton Add mcap storage plugin skeleton and CI
  * Add rosbag2_storage_mcap skeleton
  * Contributors: Daisuke Nishimatsu, Emerson Knapp, Jacob Bandes-Storch, John Hurliman, wep21


In my mind, the metadata format/version and storage format/version are **NOT**
equivalent. In future, we may add in a parameter to the metadata to keep track
of what storage format/version is in use by the bag, but I feel that the
underlying storage format should be allowed to evolve/update as more and
better techniques are developed to store the data, so long as they do not
necessitate needing to significantly modify the metadata file (a significant
modification would be the addition/removal of key-value pairs from the
metadata file)


    1. Fixed some findings from Clang-Tidy
    2. Some renames according to the ROS2 coding style
    3. Add default initializations for member variables


##  2\. Rewrite a bag within the same version, with different configuration


Using MCAPs written with ` fastwrite ` as a long-term storage format is not
recommended. Some features will not work when reading MCAP files without a
message index, such as reading messages from a subset of topics or seeking.
When recording MCAPs on your robot with ` fastwrite ` , it is a good idea to
post-process these files afterwards, to restore the message index and also
save storage space:


Contributor  Author


##  0.3.0 (2022-09-09)


Last commit date

---|---|---|---

##  Latest commit


[ API Docs ](http://docs.ros.org/en/iron/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [ Browse Code
](https://github.com/ros2/rosbag2/tree/iron/rosbag2_storage_mcap "View source
code on repository")


####  Authors


#  ROS 2 Bag Converter  #717


Field  |  Type / Values  |  Description
---|---|---
noChunkCRC  |  bool  |  Disable CRC calculation for Chunks. Ignored if `
noChunking=true ` .
noAttachmentCRC  |  bool  |  Disable CRC calculation for Attachments.
enableDataCRC  |  bool  |  Enables CRC calculation for the entire Data
section. Useful when ` noChunking=True ` .
noSummaryCRC  |  bool  |  Disable CRC calculation for the Summary section.
noChunking  |  bool  |  Do not write Chunks to the file, instead writing
Schema, Channel, and Message records directly into the Data section.
noMessageIndex  |  bool  |  Do not write Message Index records to the file. If
` noSummary=true ` and ` noChunkIndex=false ` , Chunk Index records will still
be written to the Summary section, providing a coarse message index.
noSummary  |  bool  |  Do not write Summary or Summary Offset sections to the
file, placing the Footer record immediately after DataEnd. This can provide
some speed boost to file writing and produce smaller files, at the expense of
requiring a conversion process later if fast summarization or indexed access
is desired.
chunkSize  |  unsigned int  |  Target uncompressed Chunk payload size in
bytes. Once a Chunk's uncompressed data meets or exceeds this size, the Chunk
will be compressed (if compression is enabled) and written to disk. Note that
smaller Chunks may be written, such as the last Chunk in the Data section.
This option is ignored if ` noChunking=true ` .
compression  |  "None", "Lz4", "Zstd"  |  Compression algorithm to use when
writing Chunks. This option is ignored if ` noChunking=true ` .
compressionLevel  |  "Fastest", "Fast", "Default", "Slow", "Slowest"  |
Compression level to use when writing Chunks. Slower generally produces
smaller files, at the expense of more CPU time. These levels map to different
internal settings for each compression algorithm.
forceCompression  |  bool  |  By default, Chunks that do not benefit from
compression will be written uncompressed. This option can be used to force
compression on all Chunks. This option is ignored if ` noChunking=true ` .
noRepeatedSchemas  |  bool  |  Advanced option.
noRepeatedChannels  |  bool  |  Advanced option.
noMetadataIndex  |  bool  |  Advanced option.
noChunkIndex  |  bool  |  Advanced option.
noStatistics  |  bool  |  Advanced option.
noSummaryOffsets  |  bool  |  Advanced option.

Example:


But the data does not deserialize correctly except for the first type, I
assume it is because it should receive an offset of some sort before
deserialitazion starts.


* Contributors: James Smith, Michael Orlov


  1. [ Home ](/)
  2. [ Packages ](/packages)
  3. rosbag2_storage_mcap


Equivalent to this storage configuration:


  * [ github-ros2-rosbag2 ](/p/rosbag2_storage_mcap/github-ros2-rosbag2)
  * [ github-ros-tooling-rosbag2_storage_mcap ](/p/rosbag2_storage_mcap/github-ros-tooling-rosbag2_storage_mcap)


  Examples

  * [ Python ](https://github.com/foxglove/mcap/tree/main/python/examples/ros2) \- [ reader ](https://github.com/foxglove/mcap/tree/main/python/examples/ros2/py_mcap_demo/py_mcap_demo/reader.py) and [ writer ](https://github.com/foxglove/mcap/tree/main/python/examples/ros2/py_mcap_demo/py_mcap_demo/writer.py)


####  ` zstd_small `


Contributor


* [ ros2 ](/questions/scope:all/sort:activity-desc/tags:ros2/page:1/)


  Record with MCAP

ROS2 supports recording directly to MCAP using the [ rosbag2 MCAP storage
plugin ](https://github.com/ros-tooling/rosbag2_storage_mcap) . To get
started, install the plugin:

    $ sudo apt-get install ros-$ROS_DISTRO-rosbag2-storage-mcap

Set your storage ID to ` mcap ` when recording:

    $ ros2 bag record -s mcap --all

You can also customize [ MCAP writer options ](https://github.com/ros-
tooling/rosbag2_storage_mcap


For example, the keys for the default SQLite storage would be what's here:


####  Additional Links


Copy link


While the spawning comment referred to the converter being used to upgrade bag
formats, I feel that it should be possible to implement this generically
enough that you could convert from any supported bag type to any other
supported bag type. In theory, at any rate.


> Let me propose a slightly different definition structure according to the
> implementation:


###  Recent questions tagged ` rosbag2_storage_mcap ` at **[ Robotics Stack
Exchange ](https://robotics.stackexchange.com/) **


  * Create ` Reader(input_bag) `
  * Create ` Writer(output_bag, output_configuration) `
  * ` while reader.has_next(): writer.write(reader.next()) `


_No message files found._


Name  |  Repo  |  Deps  |  [ rosbag2_storage_default_plugins
](/p/rosbag2_storage_default_plugins/github-ros2-rosbag2#iron) |  [ github-
ros2-rosbag2 ](/r/rosbag2/github-ros2-rosbag2) |  [
](/p/rosbag2_storage_default_plugins/github-ros2-rosbag2#iron-deps)
---|---|---

###  Launch files


##  Usage


    noChunking: true
    noSummaryCRC: true


Whenever a ROS 2 distribution reaches EOL, search for comments marked
COMPATIBILITY - which may no longer be needed when no new releases will be
made for that distro.


* rosbag2_storage_mcap: add storage preset profiles


##  0.15.7 (2023-07-18)


    ros2 run turtlesim turtlesim_node
    ros2 run turtlesim turtle_teleop_key


###  [ rosbag2_storage_mcap ](/p/rosbag2_storage_mcap) package from [ rosbag2
](/r/rosbag2/github-ros2-rosbag2) repo


    # Replace "rolling" with your ROS distro (`echo $ROS_DISTRO`)
    $ sudo apt install ros-rolling-rosbag2-storage-mcap


* Solutions


Use MCAP files with regular [ ` ros2 bag ` commands
](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Recording-And-
Playing-Back-Data/Recording-And-Playing-Back-Data.html) by adding the `
--storage mcap ` option (abbreviated as ` -s mcap ` ):


##  Comments


Collaborator


    # Replace "humble" with your ROS distro (`echo $ROS_DISTRO`)
    $ sudo apt install ros-humble-rosbag2-storage-mcap


Cancel  Create saved search


  * [ github-ros2-rosbag2 ](/p/rosbag2_storage_mcap/github-ros2-rosbag2)
  * [ github-ros-tooling-rosbag2_storage_mcap ](/p/rosbag2_storage_mcap/github-ros-tooling-rosbag2_storage_mcap)


The issue I see with that approach, though, is that you would need each
version to understand how to convert their data to/from every other version.
Any time someone adds a new version, you would have to go through all the
previous versions and create code to convert to/from that version. If we
convert to/from the NIF, we won't need to write any extra code. Everything
else already knows how to extract what it needs from the NIF, and can report
extra/missing values.


Name


Copy link


No version for distro **crystal** . Known supported distros are highlighted in
the buttons above.


* Contributors: James Smith, Michael Orlov


###  Services


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/rosbag2_storage_mcap/Tutorials)
for more details. _


Side note: These two structures may not actually be currently split along the
right boundaries. They also happen to contain some "runtime implementation
details" (such as number of compression threads, message queue size), which we
can ignore for the sake of this discussion. This side note suggests to me that
we might want to reconsider the struct groupings.


README


Configures the MCAP writer for the highest possible write throughput and
lowest resource utilization. This preset does not calculate CRCs for integrity
checking, and does not write a message index. This preset profile is useful
for resource-constrained robots.


That may be a big enough feature to have its own standalone ticket, like
"Tanslate older CDR messages to newer message definitions". The "translate
serialization format to generically introspectable key/value tree" could be
implemented by specific serialization format plugins, and then a common bit of
code could implemented the conversion from that to the newer message
definition. <\-- I see now that I've gotten to where you were with "neutral
intermediary format". It wasn't clear to me that's what you'd been talking
about.


In order to be a _true_ bag converter, it must do the following:


####  Additional Links


    $ source /opt/ros/[distro]/setup.bash
    $ git clone https://github.com/ros-tooling/rosbag2_storage_mcap.git
    $ cd rosbag2_storage_mcap
    $ colcon build

    # In another shell:
    $ source /opt/ros/[distro]/setup.bash
    $ cd rosbag2_storage_mcap
    $ source install/local_setup.bash
    $ ros2 bag info -s mcap path/to/your_recording.mcap


No version for distro **kinetic** . Known supported distros are highlighted in
the buttons above.


ROS 2


[ LICENSE ](/ros-tooling/rosbag2_storage_mcap/blob/main/LICENSE "LICENSE")


Additional navigation options


  * set defaults for SQLite plugin parity ( [ #68 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/68) )
  * rosbag2_storage_mcap: add storage preset profiles ( [ #57 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/57) )
  * rename test_fixture_interfaces package to testdata ( [ #64 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/64) )
  * Switch to using the vendored zstd library. ( [ #59 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/59) )
  * Add set_read_order reader API ( [ #54 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/54) )
  * Contributors: Chris Lalancette, Emerson Knapp, James Smith


* [ The ReadME Project  GitHub community articles  ](/readme)


###  Dependant Packages


_No additional links._


Resources


Configures the MCAP writer to use chunk compression with [ zstd
](http://facebook.github.io/zstd/) . Chunk compression yields file sizes
comparable to bags compressed with file-level compression, but allows tools to
efficiently read messages without decompressing the entire bag. This preset
uses the lowest compression ratio and disables CRC calculation, to achieve
high throughput while conserving disk space.


Copy link


[ subscription callback types ROS1 vs. ROS2 ](/question/333462/subscription-
callback-types-ros1-vs-ros2/)


  * Fix build for Foxy ( [ #34 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/34) )
  * Contributors: Jacob Bandes-Storch


* Open Source


Last commit message


##  Completion Criteria


Configures the MCAP writer to write 4MB chunks, compressed with zstd using its
highest compression ratio. This produces very small bags, but can be resource-
intensive to write. This preset also calculates chunk CRCs, which allow a
reader to determine if a chunk is corrupted. This preset is useful when using
` ros2 bag convert ` as a post-processing step.


No version for distro **jade** . Known supported distros are highlighted in
the buttons above.


1\. Moved code responsible for adding schema and channel from write(msg) to
create_topic(topic) method to reduce performance burden on first message write
and in lieu to preparation for moving schema collection process to upper
SequentialWriter layer.


I had to familiarize myself with Protobuf, since I've not used it before. But
it looks almost _exactly_ like something I was envisioning for the NIF...

---

All reactions


_No launch files found_


CHANGELOG


##  Description


Ah! Excellent! That will simplify things a great deal, I think.


I could write out some Python pseudocode in a while, if you think that would
help. Or I may be completely off-track here, and just making everything too
complicated.

---

All reactions


[ mcap_vendor ](/p/mcap_vendor/github-ros2-rosbag2) [ ros2bag
](/p/ros2bag/github-ros2-rosbag2) [ rosbag2 ](/p/rosbag2/github-ros2-rosbag2)
[ rosbag2_compression ](/p/rosbag2_compression/github-ros2-rosbag2) [
rosbag2_compression_zstd ](/p/rosbag2_compression_zstd/github-ros2-rosbag2) [
rosbag2_cpp ](/p/rosbag2_cpp/github-ros2-rosbag2) [ rosbag2_interfaces
](/p/rosbag2_interfaces/github-ros2-rosbag2) [
rosbag2_performance_benchmarking ](/p/rosbag2_performance_benchmarking/github-
ros2-rosbag2) [ rosbag2_py ](/p/rosbag2_py/github-ros2-rosbag2) [
rosbag2_storage ](/p/rosbag2_storage/github-ros2-rosbag2) [
rosbag2_storage_default_plugins ](/p/rosbag2_storage_default_plugins/github-
ros2-rosbag2) rosbag2_storage_mcap  [ rosbag2_storage_mcap_testdata
](/p/rosbag2_storage_mcap_testdata/github-ros2-rosbag2) [ rosbag2_test_common
](/p/rosbag2_test_common/github-ros2-rosbag2) [ rosbag2_tests
](/p/rosbag2_tests/github-ros2-rosbag2) [ rosbag2_transport
](/p/rosbag2_transport/github-ros2-rosbag2) [ shared_queues_vendor
](/p/shared_queues_vendor/github-ros2-rosbag2) [ sqlite3_vendor
](/p/sqlite3_vendor/github-ros2-rosbag2) [ zstd_vendor
](/p/zstd_vendor/github-ros2-rosbag2)
---|---

github-ros2-rosbag2


###  Footer navigation


  * ` Storage Implementation ` \- provided by a specific plugin, e.g. ` sqlite3 ` , ` rosbag2_bag_v2 ` , ` leveldb `
  * ` Storage Implementation Version ` \- this is not something that has been implemented to date - this would be for example the sqlite database schema, if it were to change between rosbag2 versions
  * ` Bag Metadata Version ` \- the format version of the ` metadata.yaml ` file. This has evolved a few times and currently has simple if/then parsing for older versions


writer-configuration) such as compression and
chunk size using storage options:

    $ cat << EOF > my_storage_config.yaml
    compression: "Lz4"
    compressionLevel: "Fastest"
    EOF
    $ ros2 bag record -s mcap --all --storage-config-file my_storage_config.yaml


##  0.2.0 (2022-09-08)


I have a ` ReaderA ` . ` ReaderA ` reports that has ` SerializedBagMessage V1
` . The current version of ` SerializedBagMessage ` is ` V3 ` \- according to
the rosbag2 binaries that I am running. Because of version-management code, I
know how to construct a ` SerializedBagMessageV3 ` from a `
SerializedBagMessageV1 ` \- there is no "key juggling" (at least not anywhere
that we have to think about above the level of ` SerializedBagMessage ` ).
Now, I can send these messages to the ` WriterB ` , which doesn't need to do
anything special because it is receiving messages in the up-to-date format.

---

All reactions


Name  |  Name  |


This package provides a [ storage plugin
](https://github.com/ros2/rosbag2#storage-format-plugin-architecture) for
rosbag2 which extends it with support for the [ MCAP ](https://mcap.dev) file
format.


edited


Sorry, something went wrong.


You can also use one of the preset profiles described below, for example:


###  Storage Preset Profiles


[ Powered by Askbot version 0.10.2 ](http://askbot.com)


* Some minor improvements in rosbag2_storage_mcap after review ( [ #58 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/58) )


  * "Bag Forward/Back Compatibility" - storage reads past and future versions as well as they can, by having a schema definition with forward/backward compatibility in mind. I see that this breaks down to the following two, ideally which have a similar solution
    * "Bag Metadata Schema Compatibility" for metadata.yaml and/or the metadata as stored in the bagfile
    * "Message Schema Compatibility" for the ` SerializedBagMessage ` which is the schema for how messages are stored (currently ` timestamp,topic,serialized_data ` )
  * "Bag Rewriting" - opening a bag with one ` StorageOptions+RecordOptions ` and write it out with a different set (feature superset over "changing storage implementation") - happening at  [ [WIP] Adding Rewriter  #709  ](https://github.com/ros2/rosbag2/pull/709)
  * "Message Definition Flexibility" - by having the message definition ( ` .msg ` / ` IDL ` ) stored in the bag, be able to change a message, before publishing, to some receiver's current version of that definition. This one I think needs a lot more independent hashing out - the way it worked in ROS1 was very different than how the RMW/DDS API works now.


$ ros2 bag record -s mcap -o my_bag --all --storage-preset-profile fastwrite


We read every piece of feedback, and take your input very seriously.


####  Authors


Collaborator


Projects


    * [ CI/CD & Automation ](/solutions/ci-cd/)
    * [ DevOps ](/solutions/devops/)
    * [ DevSecOps  ](https://resources.github.com/devops/fundamentals/devsecops/)


    noChunking: true
    noSummaryCRC: true


No version for distro **melodic** . Known supported distros are highlighted in
the buttons above.


Milestone


[ ros2 ](/ros2) /  **[ rosbag2 ](/ros2/rosbag2) ** Public


Closed


---

[
API Docs ](http://docs.ros.org/en/foxy/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [
Browse Code ](https://github.com/ros-
tooling/rosbag2_storage_mcap/tree/main/rosbag2_storage_mcap "View source code
on repository")


---

[
API Docs ](http://docs.ros.org/en/humble/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [
Browse Code ](https://github.com/ros2/rosbag2/tree/humble/rosbag2_storage_mcap
"View source code on repository")


Sorry, something went wrong.


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/rosbag2_storage_mcap/Tutorials)
for more details. _


* 👍  1 reaction


Copy link


  * Add all lz4 sources to fix undefined symbols at runtime ( [ #46 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/46) )
  * Contributors: Emerson Knapp


[ __ ](/questions/) |


At least, that's what I was thinking for that sort of a warning system.

---

All reactions


ros2 bag record -a


> This is partially why I was thinking of a "neutral intermediary format". It
> would allow you to load up the data and quickly check for missing/added keys
> like I outlined in the previous paragraph, but at the added cost of extra
> time and possibly RAM usage. An alternative could also be to somehow parse
> the bag's first data row, and try to extract what keys are different between
> the input/output configurations. This would rely on a row-based storage
> solution, though.


###  Writer Configuration


[ [ROS2] Navigation2 only planning short local plan
](/question/364379/ros2-navigation2-only-planning-short-local-plan/)


##  Languages


_No additional authors._


####  Maintainers


  * Add topic_id returned by storage to the TopicMetadata ( [ #1538 ](https://github.com/ros2/rosbag2/issues/1538) )
  * Use rw_lock to protect mcap metadata lists. ( [ #1561 ](https://github.com/ros2/rosbag2/issues/1561) )
  * Remove rcpputils::fs dependencies from rosbag2_storages ( [ #1558 ](https://github.com/ros2/rosbag2/issues/1558) )
  * remove unused headers ( [ #1544 ](https://github.com/ros2/rosbag2/issues/1544) )
  * Link and compile against rosbag2_storage_mcap: Fixed issue 1492 ( [ #1496 ](https://github.com/ros2/rosbag2/issues/1496) )
  * Use enum values for offered_qos_profiles in code and string names in serialized metadata ( [ #1476 ](https://github.com/ros2/rosbag2/issues/1476) )
  * Store serialized metadata in MCAP file ( [ #1423 ](https://github.com/ros2/rosbag2/issues/1423) )
  * Contributors: Alejandro Hern


###  Storage Preset Profiles


> Any time someone adds a new version, you would have to go through all the
> previous versions and create code to convert to/from that version


Now I think the question becomes - what's the functionality we want within
that definitional framework? I think it is:


####  Authors


##  0.1.4 (2022-04-21)


[ robotics ](/topics/robotics "Topic: robotics") [ storage ](/topics/storage
"Topic: storage") [ file-format ](/topics/file-format "Topic: file-format") [
recording ](/topics/recording "Topic: recording") [ ros2 ](/topics/ros2
"Topic: ros2") [ rosbag2 ](/topics/rosbag2 "Topic: rosbag2")


[ mcap.dev/ ](https://mcap.dev/ "https://mcap.dev/")


Equivalent to this storage configuration:


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/rosbag2_storage_mcap+foxy)
.


[ ros-infrastructure/rosindex  ](https://github.com/ros-
infrastructure/rosindex "Find rosindex in Github") | _generated on 2024-04-17_


####  Package Summary


  * CMake build script will now execute pip install conan automatically.
  * Contributors: Daisuke Nishimatsu


###  ROS 2 Distro maintenance


_No direct system dependencies._


![](/assets/package.png) |


Sorry, something went wrong.


I feel like I disagree, but I think I mainly am disagreeing with the way the
concept is being presented. I would put it more like:


[
![@emersonknapp](https://avatars.githubusercontent.com/u/537409?s=80&u=df10fea87305edde062008566721a9968483fa56&v=4)
](/emersonknapp)


1. We have internally run a variety of Ubuntu/ROS distributions, including 16.04, 18.04, and 20.04, which are all currently supported. We also interact with external engineers who may be running their own mix of Ubuntu versions. If we go out into the field, and use a laptop to bag some data from a live system that is experiencing issues, I expect to be able to be able to look at, and replay, the data in the field with my collaborators, even if they are running a different ROS version, as long as that ROS version is currently supported. I also expect to be able to bring that data to our lab, and distribute it to my colleagues, who can look at, and replay, that information, no matter what supported version of Ubuntu and ROS they are running on their laptop.


CHANGELOG


##  0.15.8 (2023-09-19)


##  0.15.9 (2024-01-24)


[ Search syntax tips ](https://docs.github.com/search-github/github-code-
search/understanding-github-code-search-syntax)


[ Sign in
](/login?return_to=https%3A%2F%2Fgithub.com%2Fros2%2Frosbag2%2Fissues%2F717)


    compression: "Zstd"
    compressionLevel: "Fastest"
    noChunkCRC: true


Failed to get question list, you can ticket an issue [ here
](https://github.com/ros-infrastructure/rosindex/issues/new)


_No README found._ _[ See repository README. ](/r/rosbag2_storage_mcap/github-
ros-tooling-rosbag2_storage_mcap/#foxy) _


    noChunking: true
    noSummaryCRC: true


##  Related Issues


Resources


[ ![@vinnnyr](https://avatars.githubusercontent.com/u/22486686?s=40&v=4)
](/vinnnyr) [ vinnnyr ](/vinnnyr) mentioned this issue  Apr 10, 2021


By Solution


[
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=40&u=e790a8959c895c919401b76e17bb58b6814b9e9a&v=4)
](/jhdcs) [ jhdcs ](/jhdcs) added the [ enhancement
](/ros2/rosbag2/labels/enhancement) New feature or request  label  Apr 6, 2021


Deps  |  |  Name  |  [ ](/p/ament_cmake#rolling-deps) |  [ 1
](/packages/ament_cmake) |  [ ament_cmake ](/p/ament_cmake#rolling)
---|---|---
[ ](/p/ament_cmake_python#rolling-deps) |  [ 1 ](/packages/ament_cmake_python)
|  [ ament_cmake_python ](/p/ament_cmake_python#rolling)
[ ](/p/ament_cmake_clang_format#rolling-deps) |  [ 1
](/packages/ament_cmake_clang_format) |  [ ament_cmake_clang_format
](/p/ament_cmake_clang_format#rolling)
[ ](/p/ament_cmake_gmock#rolling-deps) |  [ 1 ](/packages/ament_cmake_gmock) |
[ ament_cmake_gmock ](/p/ament_cmake_gmock#rolling)
[ ](/p/ament_lint_auto#rolling-deps) |  [ 1 ](/packages/ament_lint_auto) |  [
ament_lint_auto ](/p/ament_lint_auto#rolling)
[ ](/p/ament_lint_common#rolling-deps) |  [ 1 ](/packages/ament_lint_common) |
[ ament_lint_common ](/p/ament_lint_common#rolling)
[ ](/p/rosbag2_test_common#rolling-deps) |  [ 1
](/packages/rosbag2_test_common) |  [ rosbag2_test_common
](/p/rosbag2_test_common#rolling)
[ ](/p/std_msgs#rolling-deps) |  [ 2 ](/packages/std_msgs) |  [ std_msgs
](/p/std_msgs#rolling)
[ ](/p/ament_index_cpp#rolling-deps) |  [ 1 ](/packages/ament_index_cpp) |  [
ament_index_cpp ](/p/ament_index_cpp#rolling)
[ ](/p/mcap_vendor#rolling-deps) |  [ 2 ](/packages/mcap_vendor) |  [
mcap_vendor ](/p/mcap_vendor#rolling)
[ ](/p/pluginlib#rolling-deps) |  [ 1 ](/packages/pluginlib) |  [ pluginlib
](/p/pluginlib#rolling)
[ ](/p/rcutils#rolling-deps) |  [ 1 ](/packages/rcutils) |  [ rcutils
](/p/rcutils#rolling)
[ ](/p/rosbag2_storage#rolling-deps) |  [ 1 ](/packages/rosbag2_storage) |  [
rosbag2_storage ](/p/rosbag2_storage#rolling)
[ ](/p/yaml_cpp_vendor#rolling-deps) |  [ 1 ](/packages/yaml_cpp_vendor) |  [
yaml_cpp_vendor ](/p/yaml_cpp_vendor#rolling)

###  System Dependencies


##  Footer


The reason I suggest parsing to a neutral intermediary format is that it may
make writing plugins for this converter a little easier. Instead of a plugin
developer having to worry about transforming data between their format and any
other format, all they would need to worry about is transforming to/from a
known intermediary format. This may also make it easier for us to keep track
of what things each bag format provides/needs, and check for things not
"matching up".


[
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=80&u=e790a8959c895c919401b76e17bb58b6814b9e9a&v=4)
](/jhdcs)


###  Stars


rosbag2 storage plugin using the MCAP file format


  * Store IDL message definitions in Schema records when no MSG definition is available ( [ #43 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/43) )
  * Contributors: James Smith


Email Address


Repositories


###  Wiki Tutorials


[ mcap_vendor ](/p/mcap_vendor/github-ros-tooling-rosbag2_storage_mcap)
rosbag2_storage_mcap  [ rosbag2_storage_mcap_testdata
](/p/rosbag2_storage_mcap_testdata/github-ros-tooling-rosbag2_storage_mcap)
---|---

github-ros-tooling-rosbag2_storage_mcap


Ah, okay. This will not be as convenient for people who do not decide to go
with Rosbag2's default metadata and storage... But if they're not going with
them, things aren't as convenient anyways. So this should probably be fine to
include.

---

All reactions


Cancel  Submit feedback


**[ danthony06 ](/danthony06) ** commented  Apr 7, 2021


> to know what the "current" format of a bag is


Copy link


Configures the MCAP writer to write 4MB chunks, compressed with zstd using its
highest compression ratio. This produces very small bags, but can be resource-
intensive to write. This preset also calculates chunk CRCs, which allow a
reader to determine if a chunk is corrupted. This preset is useful when using
` ros2 bag convert ` as a post-processing step.


Equivalent to this storage configuration:


###  [ rosbag2_storage_mcap ](/p/rosbag2_storage_mcap) package from [
rosbag2_storage_mcap ](/r/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap) repo


To see all available qualifiers, see our [ documentation
](https://docs.github.com/search-github/github-code-search/understanding-
github-code-search-syntax) .


_No launch files found_


* [ csv ](/questions/scope:all/sort:activity-desc/tags:csv/page:1/)


_No service files found_


The site is read-only. Please transition to use Robotics Stack Exchange


  * Foxglove
  * Michael Orlov
  * ROS Tooling Working Group


###  ROS 2 Distro maintenance


  * Added mcap_vendor package. Updated CMakeLists.txt to fetch dependencies with FetchContent rather than Conan.
  * Contributors: Jacob Bandes-Storch


5 tasks


To configure details of the MCAP writer for ` ros2 bag record ` , use the `
--storage-config-file ` options to provide a YAML file describing `
mcap::McapWriterOptions ` . Field descriptions below copied from [
McapWriterOptions declaration
](https://github.com/foxglove/mcap/blob/main/cpp/mcap/include/mcap/writer.hpp#L18)


    1. Fixed some findings from Clang-Tidy
    2. Some renames according to the ROS2 coding style
    3. Add default initializations for member variables


Sorry, something went wrong.


###  Package Dependencies


####  Maintainers


    $ ros2 bag record -s mcap /topic1 /topic2 ...

    $ ros2 bag play -s mcap path/to/your_recording.mcap

    $ ros2 bag info -s mcap path/to/your_recording.mcap


[ Aghiad Haloul ](/users/67878/aghiad-haloul/) ![flag of
Germany](/m/default/media/images/flags/de.gif?v=28)
11  ●  1  ●  1  ●  2


_Not currently indexed._


  Visualize MCAP

[ Foxglove ](https://foxglove.dev/) supports playing back local and remote ROS
2 db3 files, as well as local and remote MCAP files containing ROS 2 data.

With that said, we recommend MCAP files over ROS 2 db3 files, as the latter
are not completely self-contained.

[ Edit this page
](https://github.com/foxglove/mcap/tree/main/website/docs/guides/getting-
started/ros-2.md)

[ Previous  ROS 1  ](/guides/getting-started/ros-1) [ Next  C++
](/category/c)

  * Record with MCAP
  * Convert to MCAP
    * Using ` ros2 bag convert `
    * Using the ` mcap ` CLI tool
  * Read and write MCAP
    * Guides
    * Examples
  * Inspect MCAP
  * Visualize MCAP

Docs

  * [ Guides ](/guides)
  * [ API Reference ](/reference)
  * [ Specification ](/spec)

Community

  * [ GitHub  ](https://github.com/foxglove/mcap)
  * [ Slack  ](https://foxglove.dev/slack)
  * [ Stack Overflow  ](https://stackoverflow.com/questions/tagged/mcap)
  * [ Robotics Stack Exchange  ](https://robotics.stackexchange.com/questions/tagged/mcap)

Enterprise


* [ Pricing ](/pricing)


###  Watchers


###  Plugins


  * ` /turtle1/cmd_vel ` of type ` geometry_msgs/msg/Twist `
  * ` /turtle1/color_sensor ` of type ` turtlesim/msg/Color `
  * ` /turtle1/pose ` of type ` turtlesim/msg/Pose `


    compression: "Zstd"
    compressionLevel: "Fastest"
    noChunkCRC: true


    void deserialize(const std::string datatype_name){
      //Opening part:
      rosbag2::SequentialReader reader;
      rosbag2::ConverterOptions converter_options{};
      converter_options.input_serialization_format = "cdr";
      converter_options.output_serialization_format = "cdr";
      reader.open(storage_options, converter_options);

      // Load the topics
      auto topics = reader.get_all_topics_and_types();
      rosbag2::SerializationFormatConverterFactory factory;
      std::unique_ptr<rosbag2::converter_interfaces::SerializationFormatDeserializer> cdr_deserializer_;
      cdr_deserializer_ = factory.load_deserializer("cdr");

      // Iterate through the file
      while(reader.has_next()){
        auto serialized_message = reader.read_next();

        auto ros_message = std::make_shared<rosbag2_introspection_message_t>();
        ros_message->time_stamp = 0;
        ros_message->message = nullptr;
        ros_message->allocator = rcutils_get_default_allocator();
        auto type_support = rosbag2::get_typesupport(datatype_name, "rosidl_typesupport_cpp");

        if(datatype_name == "geometry_msgs/msg/Twist"){
          ros_message->message = new geometry_msgs::msg::Twist();
        }
        else if(datatype_name == "turtlesim/msg/Pose"){
          ros_message->message = new turtlesim::msg::Pose();
        }
        else if(datatype_name == "turtlesim/msg/Color"){
          ros_message->message = new turtlesim::msg::Color();
        }
        else{
          std::cout << "not supported" << std::endl;
        }
        if(ros_message->message){
          cdr_deserializer_->deserialize(serialized_message, type_support, ros_message);


No branches or pull requests


[ 30  stars ](/ros-tooling/rosbag2_storage_mcap/stargazers) [ 5  forks ](/ros-
tooling/rosbag2_storage_mcap/forks) [ Branches  ](/ros-
tooling/rosbag2_storage_mcap/branches) [ Tags  ](/ros-
tooling/rosbag2_storage_mcap/tags) [ Activity  ](/ros-
tooling/rosbag2_storage_mcap/activity)


[ about ](/about/) |  [ faq ](/faq/) |  [ help ](/help/ "help") |  [ privacy
policy ](/privacy/) |  [ terms of service ](/terms/)


[ API Docs ](http://docs.ros.org/en/galactic/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [ Browse Code ](https://github.com/ros-
tooling/rosbag2_storage_mcap/tree/main/rosbag2_storage_mcap "View source code
on repository")


#  Changelog for package rosbag2_storage_mcap


  * Add all lz4 sources to fix undefined symbols at runtime ( [ #46 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/46) )
  * Contributors: Emerson Knapp


##  0.15.5 (2023-04-25)


It's a pretty frequent use case here that we run a mix of ROS and Ubuntu
distributions, and frequently exchange data between the different systems. In
some cases, we have vehicle hardware running specific versions of ROS that are
extremely difficult or impossible to change. Not being able to open bag files
generated from newer versions of ROS on an older version is going to cause us
a lot of headaches.

---

All reactions


####  Maintainers


I'd like to figure out how to make a differentiation between


##  0.6.0 (2022-11-28)


  * Fix build for Foxy ( [ #34 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/34) )
  * Contributors: Jacob Bandes-Storch


Configures the MCAP writer to use chunk compression with [ zstd
](http://facebook.github.io/zstd/) . Chunk compression yields file sizes
comparable to bags compressed with file-level compression, but allows tools to
efficiently read messages without decompressing the entire bag. This preset
uses the lowest compression ratio and disables CRC calculation, to achieve
high throughput while conserving disk space.


> I was referring to the invoked rosbag2's current implementation version for
> ` Bag Metadata Version ` and ` Storage Implementation Version ` \- by
> "current format" i meant "the thing that happens by default when you write a
> bag with rosbag2", or "the version of metadata and storage that is
> implemented by my installed version of rosbag2"


Toggle navigation


Collaborator


For example: do you anticipate that you want to generate J-turtle bags on your
development/testing station, then copy those bag files over to a device that
is pinned to H-turtle and play them back on the device? Or is the anticipated
use case really that you want to play messages on a networked computer running
J-turtle, so that the H-turtle device receives the messages? If it's the
latter case, that's a different feature entirely that would need to be
implemented in RMW.


_No plugins found._


Whenever a ROS 2 distribution reaches EOL, search for comments marked
COMPATIBILITY - which may no longer be needed when no new releases will be
made for that distro.


Sorry, something went wrong.


edited


|

View all files

##  Repository files navigation


_No additional authors._


###  [ rosbag2_storage_mcap ](/p/rosbag2_storage_mcap) package from [
rosbag2_storage_mcap ](/r/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap) repo


**[ jhdcs ](/jhdcs) ** commented  Apr 6, 2021


Closed


**Tags** |  _No category tags._
---|---
**Version** |  0.22.6
**License** |  Apache-2.0
**Build type** |  AMENT_CMAKE
**Use** |  RECOMMENDED

###  Repository Summary


[ Notifications ](/login?return_to=%2Fros-tooling%2Frosbag2_storage_mcap)


    compression: "Zstd"
    compressionLevel: "Slowest"
    chunkSize: 4194304 # 4 * 1024 * 1024


**Have a question about this project?** Sign up for a free GitHub account to
open an issue and contact its maintainers and the community.


    $ ros2 bag record -s mcap /topic1 /topic2 ...

    $ ros2 bag play -s mcap path/to/your_recording.mcap

    $ ros2 bag info -s mcap path/to/your_recording.mcap


[ ![@danthony06](https://avatars.githubusercontent.com/u/4430620?s=80&v=4)
](/danthony06)


###  Wiki Tutorials


[ ![cc-by-sa](/m/default/media/images/cc-by-sa.png?v=28)
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) ROS Answers is
licensed under Creative Commons Attribution 3.0 Content on this site is
licensed under a [ Creative Commons Attribution Share Alike 3.0
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) license.


> Definitions


###  Dependant Packages


    * [ Enterprise ](/enterprise)
    * [ Teams ](/team)
    * [ Startups ](/enterprise/startups)
    * [ Education  ](https://education.github.com)


**[ jhdcs ](/jhdcs) ** commented  Apr 7, 2021


rosbag2 storage plugin using the MCAP file format


Using MCAPs written with ` fastwrite ` as a long-term storage format is not
recommended. Some features will not work when reading MCAP files without a
message index, such as reading messages from a subset of topics or seeking.
When recording MCAPs on your robot with ` fastwrite ` , it is a good idea to
post-process these files afterwards, to restore the message index and also
save storage space:


  * mcap_storage: \'none\' is a valid storage preset profile ( [ #86 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/86) )
  * mcap_storage: handle update_metadata call ( [ #83 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/83) )
  * Update clang-format rules to fit ROS 2 style guide ( [ #80 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/80) )
  * Revert \"read_order: throw exception from set_read_order for unsupported orders\" This reverts commit aef9b9a65293f9e5d80a858ef84e485a8655a0c0.
  * read_order: throw exception from set_read_order for unsupported orders
  * Fix compile flags to work on rosbag_storage:0.17.x ( [ #78 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/78) ) This fixes the compile flags for rolling, which has two versions -- one that does not support read order (0.17.x) and one that does support read order (0.18.x).
  * Fix Windows build ( [ #73 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/73) ) Update mcap version to newest windows-compatible release. Add visibility macros for tests. Add clang-format preprocessor indentation for visibility_control to be readable.
  * Contributors: Andrew Symington, Emerson Knapp, James Smith, james-rms


[
![@emersonknapp](https://avatars.githubusercontent.com/u/537409?s=80&u=df10fea87305edde062008566721a9968483fa56&v=4)
](/emersonknapp)


No milestone


  * [ github-ros2-rosbag2 ](/p/rosbag2_storage_mcap/github-ros2-rosbag2)
  * [ github-ros-tooling-rosbag2_storage_mcap ](/p/rosbag2_storage_mcap/github-ros-tooling-rosbag2_storage_mcap)


Lines 324 to 341 in [ 687f19d
](/ros2/rosbag2/commit/687f19d2b3e7a1d0ca1d221fe730f216b8715873)


* Open Source


Sorry, something went wrong.


[ ![@amacneil](https://avatars.githubusercontent.com/u/637671?s=80&v=4)
](/amacneil)


Use MCAP files with regular [ ` ros2 bag ` commands
](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Recording-And-
Playing-Back-Data/Recording-And-Playing-Back-Data.html) by adding the `
--storage mcap ` option (abbreviated as ` -s mcap ` ):


Copy link


  * Upgrade mcap to fix LZ4 error and segfault ( [ #42 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/42) ) Incorporates fixes from [ https://github.com/foxglove/mcap/pull/478 ](https://github.com/foxglove/mcap/pull/478) and [ https://github.com/foxglove/mcap/pull/482 ](https://github.com/foxglove/mcap/pull/482)
  * Contributors: Jacob Bandes-Storch


###  Package Dependencies


CHANGELOG


[ ![ROS Foxy
version](https://camo.githubusercontent.com/4563a5793c57f3688418a11904cd3471cf95e6afb78fa41576b33aae811237ac/68747470733a2f2f696d672e736869656c64732e696f2f726f732f762f666f78792f726f73626167325f73746f726167655f6d636170)
](https://index.ros.org/p/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap/#foxy) [ ![ROS Galactic
version](https://camo.githubusercontent.com/2ef67f99780517bc969d5190e49019690c78f34de35d3a91576867bb8c1bb215/68747470733a2f2f696d672e736869656c64732e696f2f726f732f762f67616c61637469632f726f73626167325f73746f726167655f6d636170)
](https://index.ros.org/p/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap/#galactic) [ ![ROS Humble
version](https://camo.githubusercontent.com/1b15650f62c345ee5a030d9ccf240d3ad7e3b01fd9ed027eeedc25c5650315a0/68747470733a2f2f696d672e736869656c64732e696f2f726f732f762f68756d626c652f726f73626167325f73746f726167655f6d636170)
](https://index.ros.org/p/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap/#humble) [ ![ROS Rolling
version](https://camo.githubusercontent.com/4547e9b4b63f9c6c425bd78ecd57ef8e83348e480671016b4bcaaac7fdd7982f/68747470733a2f2f696d672e736869656c64732e696f2f726f732f762f726f6c6c696e672f726f73626167325f73746f726167655f6d636170)
](https://index.ros.org/p/rosbag2_storage_mcap/github-ros-tooling-
rosbag2_storage_mcap/#rolling)


###  Launch files


The "old bag" question was related to the ` Storage Implementation Version `
\- or, is the storage implementation allowed to update its schema over time,
and if so how does it read those older schemas?


[ ROS2 Run __params not affecting node ](/question/335016/ros2-run-__params-
not-affecting-node/)


    noChunking: true
    noSummaryCRC: true


There's two really common use cases I can think of.


Thank you for your help.


* Some minor improvements in rosbag2_storage_mcap after review ( [ #58 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/58) )


##  0.1.5 (2022-04-25)


#  Provide feedback


* [ serialization ](/questions/scope:all/sort:activity-desc/tags:serialization/page:1/)


Equivalent to this storage configuration:


_No additional authors._


![](/assets/package.png) |


---

[
API Docs ](http://docs.ros.org/en/iron/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [
Browse Code ](https://github.com/ros2/rosbag2/tree/iron/rosbag2_storage_mcap
"View source code on repository")


Contributor  Author


##  Folders and files


Sorry, something went wrong.


[ rosbag2_storage_mcap/README.md
](https://github.com/ros2/rosbag2/tree/rolling/rosbag2_storage_mcap/README.md
"Open in git repository")


  * [ About ](/about)
  * Index
    * [ Package List ](/packages/page/1/time/)
    * [ Repository List ](/repos/page/1/time/)
    *     * [ Nodes ](/srvs/)
    * [ Messages ](/msgs/)
    * [ Services ](/srvs/)
    * [ Plugins ](/srvs/)
    *     * [ System Dependencies ](/deps/)
  * [ Contribute ](/contribute)
  * [ Stats ](/stats)


  * Overview
  * 0  Assets
  * 13  Dependencies
  * 0  Tutorials
  * 0  Q & A


##  0.1.2 (2022-04-20)


[ API Docs ](http://docs.ros.org/en/foxy/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [ Browse Code ](https://github.com/ros-
tooling/rosbag2_storage_mcap/tree/main/rosbag2_storage_mcap "View source code
on repository")


First, a couple definitions so that I don't confuse anyone (like myself) with
what I'm talking about. We have ` Storage Types ` , which indicate what the
underlying storage mechanism of the bag is/will be. This is like SQLite, ROS1
bags, etc. Within each ` Storage Type ` , we would have a ` Storage Format ` .
This is HOW the data is stored within that type - i.e: What data gets put in,
and in what order. A ` Storage Version ` is some sort of identifier that we
apply to a ` Storage Format ` to keep track of what we expect should be there.


  Read and write MCAP

If you're starting from scratch, you can write code that allows you to **write
your ROS 2 data to MCAP files** and subsequently **read your ROS 2 data from
your MCAP files** .


Is there a simpler way to convert ROS2 Bag files into csv/text without
changing the current version of Dashing?


installing) also
supports converting ROS 2 ` .db3 ` files into MCAP files directly.

    $ mcap convert multiple_files_1.db3 demo.mcap

The ` mcap ` CLI conversion support for SQLite bags works by emulating the
behavior of the ROS 2 resource discovery mechanism. This may produce different
results from recording the bag directly in MCAP using the [ rosbag2 MCAP
storage plugin ](https://github.com/ros-tooling/rosbag2_storage_mcap) . If you
have difficulty converting bags successfully using the CLI, consider using the
` ros2 bag convert ` method described above.

` mcap convert ` will search the path stored in your $AMENT_PREFIX_PATH
environment variable to locate the ROS message definitions on your hard drive.

Alternatively, you can specify a colon-separated list of directories for the
CLI tool to search using the ament-prefix-path flag:

    $ mcap convert ros2_input.db3 ros1_output.mcap --ament-prefix-path=/your/first/directory;/your/second/directory

You can also use the mcap CLI tool to inspect MCAP files, validate them, and
even echo their messages to ` stdout ` . For a full list of possible commands,
check out the [ mcap GitHub repo
](https://github.com/foxglove/mcap/tree/main/go/cli/mcap) .


  * [ Notifications ](/login?return_to=%2Fros2%2Frosbag2)
  * [ Fork  226  ](/login?return_to=%2Fros2%2Frosbag2)
  * [ Star  241  ](/login?return_to=%2Fros2%2Frosbag2)


Name  |  Repo  |  Deps  |  [ rosbag2_storage_default_plugins
](/p/rosbag2_storage_default_plugins/github-ros2-rosbag2#rolling) |  [ github-
ros2-rosbag2 ](/r/rosbag2/github-ros2-rosbag2) |  [
](/p/rosbag2_storage_default_plugins/github-ros2-rosbag2#rolling-deps)
---|---|---

###  Launch files


[
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=80&u=e790a8959c895c919401b76e17bb58b6814b9e9a&v=4)
](/jhdcs)


[ [Ros2] Package Binaries ](/question/331971/ros2-package-binaries/)


**Tags** |  _No category tags._
---|---
**Version** |  0.6.0
**License** |  Apache-2.0
**Build type** |  AMENT_CMAKE
**Use** |  RECOMMENDED

###  Repository Summary


###  License


Follow


2. On single board computers or embedded systems like Nvidia's Jetson platforms, we might want to do hardware in the loop testing, using data recorded from a different computer, that is running a newer version of ROS. We may not have the network connectivity to stream data to these platforms, in the cases where they're operating in a big region, or are a small UAV.


[ State of ROS2 on embedded MCUs ](/question/326687/state-of-ros2-on-embedded-
mcus/)


[ none ](/questions/scope:all/sort:activity-desc/tags:none/page:1/) ×


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/rosbag2_storage_mcap+iron)
.


###  Plugins


Thinking about this some more, I think I incidentally hit on my real
expectation, which is I want to use bags between any currently supported
version of ROS. It's probably unreasonable to expect in the future that the B
release of ROS be able to read things I generated in the T release, but if R,
S, and T ROS releases are all currently supported, then I should be able to
utilize all of them in a system, and exchange bags between them. There might
even be a reasonable way of then warning users that when a distribution goes
EOL, that it will not be able to read bags generated in future releases.

---

All reactions


  * [humble] Don\'t crash when type definition cannot be found, and find srv defs if available ( [ #1398 ](https://github.com/ros2/rosbag2/issues/1398) )
  * [humble] Add ROS_DISTRO metadata record to mcap file when opening for writing (backport [ #1371 ](https://github.com/ros2/rosbag2/issues/1371) ) ( [ #1393 ](https://github.com/ros2/rosbag2/issues/1393) )
  * Contributors: Emerson Knapp, Michael Orlov, mergify[bot]


  * [ ![@jtbandes](https://avatars.githubusercontent.com/u/14237?s=64&v=4) ](https://github.com/jtbandes)
  * [ ![@james-rms](https://avatars.githubusercontent.com/u/18162835?s=64&v=4) ](https://github.com/james-rms)
  * [ ![@jhurliman](https://avatars.githubusercontent.com/u/195374?s=64&v=4) ](https://github.com/jhurliman)
  * [ ![@wep21](https://avatars.githubusercontent.com/u/42202095?s=64&v=4) ](https://github.com/wep21)
  * [ ![@emersonknapp](https://avatars.githubusercontent.com/u/537409?s=64&v=4) ](https://github.com/emersonknapp)
  * [ ![@MichaelOrlov](https://avatars.githubusercontent.com/u/7294722?s=64&v=4) ](https://github.com/MichaelOrlov)
  * [ ![@clalancette](https://avatars.githubusercontent.com/u/163000?s=64&v=4) ](https://github.com/clalancette)
  * [ ![@asymingt](https://avatars.githubusercontent.com/u/37671?s=64&v=4) ](https://github.com/asymingt)
  * [ ![@cottsay](https://avatars.githubusercontent.com/u/1144588?s=64&v=4) ](https://github.com/cottsay)


##  Installation


Some ideas:
Changing storage version -> ` re-version `
Changing storage implementation (ex: from ` sqlite ` to ` ros1bag ` ) -> `
transmute `

---

All reactions


* [ dashing ](/questions/scope:all/sort:activity-desc/tags:dashing/page:1/)


####  Maintainers


Explore


When you say "keys" here, can you clarify what you mean?


_No plugins found._


####  ` zstd_small `


[ Gerbert ](/users/72796/gerbert/)
1


Include my email address so I can be contacted


All reactions


Using MCAPs written with ` fastwrite ` as a long-term storage format is not
recommended. Some features will not work when reading MCAP files without a
message index, such as reading messages from a subset of topics or seeking.
When recording MCAPs on your robot with ` fastwrite ` , it is a good idea to
post-process these files afterwards, to restore the message index and also
save storage space:


##  0.5.0 (2022-11-02)


**[ jhdcs ](/jhdcs) ** commented  Apr 7, 2021


Equivalent to this storage configuration:


####  ` fastwrite `


Pick a username


[ API Docs ](http://docs.ros.org/en/rolling/p/rosbag2_storage_mcap "View API
documentation on docs.ros.org") [ Browse Code
](https://github.com/ros2/rosbag2/tree/rolling/rosbag2_storage_mcap "View
source code on repository")


edited


It would be more helpful to provide an enumeration of actual use cases that
can help inform a design, rather than dictating feature requirements or
implementations. I am not saying that the requirement is wrong, just that the
flow of information is backwards.


Sort by »  [ oldest  ](/question/369573/deserializing-multiple-topics-from-a-
ros2-bag-sqlite3/?sort=oldest#sort-top) [ newest
](/question/369573/deserializing-multiple-topics-from-a-ros2-bag-
sqlite3/?sort=latest#sort-top) [ most voted  ](/question/369573/deserializing-
multiple-topics-from-a-ros2-bag-sqlite3/?sort=votes#sort-top)


  * Upgrade mcap to fix LZ4 error and segfault ( [ #42 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/42) ) Incorporates fixes from [ https://github.com/foxglove/mcap/pull/478 ](https://github.com/foxglove/mcap/pull/478) and [ https://github.com/foxglove/mcap/pull/482 ](https://github.com/foxglove/mcap/pull/482)
  * Contributors: Jacob Bandes-Storch


  * Support timestamp-ordered playback ( [ #50 ](https://github.com/ros-tooling/rosbag2_storage_mcap/issues/50) )
  * Support regex topic filtering
  * Contributors: James Smith


    compression: "Zstd"
    compressionLevel: "Fastest"
    noChunkCRC: true


Sorry, something went wrong.


###  Recent questions tagged ` rosbag2_storage_mcap ` at **[ Robotics Stack
Exchange ](https://robotics.stackexchange.com/) **


[ edit ](/s/answers/375199/edit/) flag offensive  delete  [ link
](/question/369573/deserializing-multiple-topics-from-a-ros2-bag-
sqlite3/?answer=375199#post-id-375199 "permanent link") more


  * fix: minor issues ( [ #31 ](https://github.com/wep21/rosbag2_storage_mcap/issues/31) )
    * remove unnecessary block
    * use target_link_libraries instead of ament_target_dependencies
    * remove ros environment
    * add prefix to compile definition
  * Update email address for Foxglove maintainers ( [ #32 ](https://github.com/wep21/rosbag2_storage_mcap/issues/32) )
  * Contributors: Daisuke Nishimatsu, Jacob Bandes-Storch


Contributor  Author


Go to file


##  0.25.0 (2024-03-27)


That's what I was suggesting. It's what I have often experienced in software
data file versioning. Nothing's final, of course, if there's a strong argument
and design to the contrary. If we used a library like Protobuf (just an
example) for these schemas - then maybe we could offer both forward-and-
backward compatibility.

---

All reactions


Repositories


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/rosbag2_storage_mcap+galactic)
.


Already on GitHub? [ Sign in
](/login?return_to=%2Fros2%2Frosbag2%2Fissues%2Fnew%2Fchoose) to your account


    SerializedBagMessageV1();
    SerializedBagMessageV2(SerializedBagMessageV1);
    SerializedBagMessageV3(SerializedBagMessageV2);
    // etc...


**[ jhdcs ](/jhdcs) ** commented  Jul 30, 2021


###  Messages


[ ![@emersonknapp](https://avatars.githubusercontent.com/u/537409?s=52&v=4)
](/emersonknapp) [
![@amacneil](https://avatars.githubusercontent.com/u/637671?s=52&v=4)
](/amacneil) [
![@danthony06](https://avatars.githubusercontent.com/u/4430620?s=52&v=4)
](/danthony06) [
![@jhdcs](https://avatars.githubusercontent.com/u/48914066?s=52&v=4) ](/jhdcs)


You signed in with another tab or window. [ Reload ]() to refresh your
session.  You signed out in another tab or window. [ Reload ]() to refresh
your session.  You switched accounts on another tab or window. [ Reload ]() to
refresh your session.  Dismiss alert


The way I'm seeing it, this functionality is as flexible as it gets, and
assuming the ` Reader ` is capable of reading the input bag, then the
implementation looks like:


[ Sign up for free ](/join?source=comment-repo) **to join this conversation on
GitHub** . Already have an account? [ Sign in to comment
](/login?return_to=https%3A%2F%2Fgithub.com%2Fros2%2Frosbag2%2Fissues%2F717)


#  Saved searches


  * Foxglove
  * Michael Orlov
  * ROS Tooling Working Group


![](/assets/package.png) |


Field  |  Type / Values  |  Description
---|---|---
noChunkCRC  |  bool  |  Disable CRC calculation for Chunks. Ignored if `
noChunking=true ` .
noAttachmentCRC  |  bool  |  Disable CRC calculation for Attachments.
enableDataCRC  |  bool  |  Enables CRC calculation for the entire Data
section. Useful when ` noChunking=True ` .
noSummaryCRC  |  bool  |  Disable CRC calculation for the Summary section.
noChunking  |  bool  |  Do not write Chunks to the file, instead writing
Schema, Channel, and Message records directly into the Data section.
noMessageIndex  |  bool  |  Do not write Message Index records to the file. If
` noSummary=true ` and ` noChunkIndex=false ` , Chunk Index records will still
be written to the Summary section, providing a coarse message index.
noSummary  |  bool  |  Do not write Summary or Summary Offset sections to the
file, placing the Footer record immediately after DataEnd. This can provide
some speed boost to file writing and produce smaller files, at the expense of
requiring a conversion process later if fast summarization or indexed access
is desired.
chunkSize  |  unsigned int  |  Target uncompressed Chunk payload size in
bytes. Once a Chunk's uncompressed data meets or exceeds this size, the Chunk
will be compressed (if compression is enabled) and written to disk. Note that
smaller Chunks may be written, such as the last Chunk in the Data section.
This option is ignored if ` noChunking=true ` .
compression  |  "None", "Lz4", "Zstd"  |  Compression algorithm to use when
writing Chunks. This option is ignored if ` noChunking=true ` .
compressionLevel  |  "Fastest", "Fast", "Default", "Slow", "Slowest"  |
Compression level to use when writing Chunks. Slower generally produces
smaller files, at the expense of more CPU time. These levels map to different
internal settings for each compression algorithm.
forceCompression  |  bool  |  By default, Chunks that do not benefit from
compression will be written uncompressed. This option can be used to force
compression on all Chunks. This option is ignored if ` noChunking=true ` .
noRepeatedSchemas  |  bool  |  Advanced option.
noRepeatedChannels  |  bool  |  Advanced option.
noMetadataIndex  |  bool  |  Advanced option.
noChunkIndex  |  bool  |  Advanced option.
noStatistics  |  bool  |  Advanced option.
noSummaryOffsets  |  bool  |  Advanced option.

Example:


Then make sure to map the topic name to the type by initially retrieving the
topic and types from the ros2bag by


  * Overview
  * 0  Assets
  * 15  Dependencies
  * 0  Tutorials
  * 0  Q & A


You can also use one of the preset profiles described below, for example:


* [ deserialization ](/questions/scope:all/sort:activity-desc/tags:deserialization/page:1/)


[ LICENSE ](/ros-tooling/rosbag2_storage_mcap/blob/main/LICENSE "LICENSE")


#  rosbag2_storage_mcap


I'm using ROS 2 Dashing, Ubuntu 18.04.


##  0.5.0 (2022-11-02)


  * [ Code  ](/ros2/rosbag2)
  * [ Issues  93  ](/ros2/rosbag2/issues)
  * [ Pull requests  19  ](/ros2/rosbag2/pulls)
  * [ Actions  ](/ros2/rosbag2/actions)
  * [ Projects  2  ](/ros2/rosbag2/projects)
  * [ Security  ](/ros2/rosbag2/security)
  * [ Insights  ](/ros2/rosbag2/pulse)


_No direct system dependencies._


The error message is common if one tries to deserialize with the wrong message
type.