Skip to content

Schema Management

Manages JSON schemas and ROS2 message definitions.

tabular2mcap.schemas.jsonschema

Foxglove schema utilities for accessing message definitions.

get_foxglove_jsonschema(schema_name)

Get a Foxglove schema by name.

Parameters:

Name Type Description Default
schema_name str

Name of the schema (e.g., 'LocationFix', 'Pose')

required

Returns:

Type Description
bytes

Bytes containing the schema definition

tabular2mcap.schemas.ros2msg

tabular2mcap.schemas.cache

Script to download and cache ROS 2 message definitions from official repositories.

This script downloads the following repositories for a specified ROS 2 distribution: - rcl_interfaces - common_interfaces - geometry2

The downloaded files are cached in the user's cache directory to avoid re-downloading.

download_and_cache_all_repos(distro='jazzy', cache_dir=None)

Download and cache all ROS 2 message definition repositories.

Parameters:

Name Type Description Default
distro str

ROS 2 distribution name (default: "jazzy")

'jazzy'
cache_dir Path | None

Cache directory path (default: uses platformdirs cache)

None

Returns:

Type Description
bool

True if all repositories downloaded successfully, False otherwise

download_and_cache_repository(repo_name, url, distro, cache_dir)

Download and cache a single repository.

Parameters:

Name Type Description Default
repo_name str

Name of the repository

required
url str

URL template for downloading (with {distro_str} placeholder)

required
distro str

ROS 2 distribution name

required
cache_dir Path

Cache directory path

required

Returns:

Type Description
bool

True if successful, False otherwise

download_file(url, destination)

Download a file from URL to destination path.

Parameters:

Name Type Description Default
url str

URL to download from

required
destination Path

Local path to save the file

required

Returns:

Type Description
bool

True if download successful, False otherwise

extract_zip(zip_path, extract_to)

Extract a zip file to the specified directory.

Parameters:

Name Type Description Default
zip_path Path

Path to the zip file

required
extract_to Path

Directory to extract to

required

Returns:

Type Description
bool

True if extraction successful, False otherwise

is_repository_cached(repo_name, distro, cache_dir)

Check if a repository is already cached for the given distribution.

Parameters:

Name Type Description Default
repo_name str

Name of the repository

required
distro str

ROS 2 distribution name

required
cache_dir Path

Cache directory path

required

Returns:

Type Description
bool

True if repository is cached, False otherwise

list_cached_repositories(cache_dir=None)

List all cached repositories and their message file counts.

Parameters:

Name Type Description Default
cache_dir Path | None

Cache directory path (default: uses platformdirs cache)

None