Introduction
July 1, 2025 ยท View on GitHub
This folder contains an example on how to generate MCAP files from .mat files typically used in MATLAB or Octave.
In this case, each variable is treated individually, one MCAP file is generated for each variable, for the sake of the example. However, multiple channels can be written to the same MCAP file. Please see also ROSCon Spain MCAP tutorial.
Download the dataset
- The required file is already included in this repo, but if you want you can download the dataset from NASA Valkyrie Box Pickup.
Generate CSV
-
Using Octave, save
box_pickup_ihmc.matas CSV. The scriptmat_to_csv.mwill load the.matfile and generate.csvfiles without headers. -
Run the script
csv_header.pyto add the header to each CSV file.
Generate MCAP
- Generate one
.mcapfile per.csvfile using the scriptscsv_to_mcap.pyorcsv_to_ros2_mcap.pyfor ROS 2 type messages.
Merge the MCAP files
- Using
ros2 bag converttool, merge all the.mcapfiles into one with the help of the scriptrosbag.bashand the configuration filemerge_mcap.yaml.
ros2 bag convert $(bash rosbag.bash) -o merge_mcap.yaml