Skip to main content

MCAP capture reference

roboticks.mcap_capture is a context manager that records selected ROS2 topics to an MCAP file for the duration of a with block. For a tutorial introduction, see Testing → MCAP capture; this page is the API reference.
Requires the mcap extra. Install with pip install 'roboticks[mcap]'. The bare roboticks package does not pull in the mcap or mcap-ros2-support libraries.

Signature

Parameters

Returns (as context value)

An McapHandle with:

Behaviour

Allowlist semantics

Subscriptions are created on first-seen — the recorder subscribes when a publisher appears on a matching topic, not at context entry. This avoids hangs waiting for topics that won’t appear.

Upload behaviour

The “test failed” signal is read from the pytest test status at session-end. For non-pytest contexts (e.g. raw scripts), "failure" is treated as "always".

Threading

The recorder runs in a background thread spun up at context entry. It uses a dedicated rclpy executor; subscriptions don’t interfere with the test’s main executor.

Compression

Examples

Default (allow-all, upload-on-failure)

Explicit topic allowlist

Always upload

Pytest fixture for session-scoped recording

Limits

File layout

The uploads.manifest.json is read by rbtk when correlating local artifacts to a remote run.

Next

MCAP capture tutorial

Worked examples and storage-cost guidance.

LLM triage

How the platform reads your MCAP to explain failures.

Fault injection

Pair with mcap_capture for failure forensics.

Pricing

Hot and archive storage costs.