Skip to content

Main API

High-level functions for converting tabular data to MCAP format.

Architecture

The conversion process uses three main components:

  1. loader - Loads data and configuration files
  2. schemas - Manages and writes message schemas to MCAP
  3. converter - Transforms data into the target message format (JSON or ROS2)

tabular2mcap.convert_tabular_to_mcap(input_path, output_path, config_path, topic_prefix, converter_functions_path, test_mode=False, best_effort=False, strip_file_suffix=False)

Convert tabular and multimedia data to MCAP format.

This is a convenience wrapper around the McapConverter class. For more control, use McapConverter directly.

Parameters:

Name Type Description Default
input_path Path

Path to the input directory containing tabular data files

required
output_path Path

Path to the output MCAP file

required
config_path Path

Path to the config file

required
topic_prefix str

Optional prefix to prepend to all topic names in the generated MCAP file

required
converter_functions_path Path

Path to the converter functions YAML file

required
test_mode bool

Test mode: only process the first 5 rows of each CSV file

False
best_effort bool

Continue converting even if errors occur (logs errors but doesn't stop)

False
strip_file_suffix bool

If True, removes file extensions from topic names

False

Returns:

Type Description
None

None

tabular2mcap.McapConverter

Main class for converting tabular and multimedia data to MCAP format.

__init__(config_path=None, converter_functions_path=None)

Initialize the MCAP converter.

Parameters:

Name Type Description Default
config_path Path | None

Path to the configuration file or McapConversionConfig object

None
converter_functions_path Path | None

Path to the converter functions file

None

convert(input_path, output_path, topic_prefix='', test_mode=False, best_effort=False, strip_file_suffix=False)

Convert tabular and multimedia data to MCAP format.

Parameters:

Name Type Description Default
input_path Path

Path to the input directory

required
output_path Path

Path to the output MCAP file

required
topic_prefix str

Prefix for topic names

''
test_mode bool

If True, limits data processing for testing

False
best_effort bool

If True, continues converting even if errors occur (logs errors)

False
strip_file_suffix bool

If True, removes file extensions from topic names

False