McapSchema

āš ļø This type is unstable and may change significantly in a way that the data won't be backwards compatible. A schema definition that describes the structure of messages in an MCAP file.

Schemas define the data types and field structures used by messages in MCAP channels. They provide the blueprint for interpreting message payloads, specifying field names, types, and organization. Each schema is referenced by channels to indicate how their messages should be decoded and understood.

See also archetypes.McapChannel for channels that reference these schemas, archetypes.McapMessage for the messages that conform to these schemas, and the MCAP specification for complete format details.

Fields fields

Required required

Can be shown in can-be-shown-in

Example example

Simple MCAP schema simple-mcap-schema

"""Log a simple MCAP schema definition."""

import rerun as rr

rr.init("rerun_example_mcap_schema", spawn=True)

# Example ROS2 message definition for a simple Point message
point_schema = """float64 x
float64 y
float64 z"""

rr.log(
    "mcap/schemas/geometry_point",
    rr.McapSchema(
        id=42,
        name="geometry_msgs/msg/Point",
        encoding="ros2msg",
        data=point_schema.encode("utf-8"),
    ),
)