Skip to content

Latest commit

 

History

History
30 lines (17 loc) · 1.43 KB

File metadata and controls

30 lines (17 loc) · 1.43 KB
title Convert .mat files to MCAP
short_description Visualize Matlab files for NASA Valkyrie box pickup task

Introduction

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

  1. 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

  1. Using Octave, save box_pickup_ihmc.mat as CSV. The script mat_to_csv.m will load the .mat file and generate .csv files without headers.

  2. Run the script csv_header.py to add the header to each CSV file.

Generate MCAP

  1. Generate one .mcap file per .csv file using the scripts csv_to_mcap.py or csv_to_ros2_mcap.py for ROS 2 type messages.

Merge the MCAP files

  1. Using ros2 bag convert tool, merge all the .mcap files into one with the help of the script rosbag.bash and the configuration file merge_mcap.yaml.

ros2 bag convert $(bash rosbag.bash) -o merge_mcap.yaml