mcap_ros2.decoder module

Decoder class for decoding ROS2 messages from MCAP files.

class mcap_ros2.decoder.Decoder[source]

Bases: object

Decodes ROS 2 messages.

Deprecated since version 0.5.0: Use DecoderFactory with McapReader instead.

decode(schema: Schema, message: Message) Any[source]
class mcap_ros2.decoder.DecoderFactory[source]

Bases: DecoderFactory

Provides functionality to an McapReader to decode CDR-encoded messages. Requires valid ros2msg schema to decode messages. Schemas written in IDL are not currently supported.

decoder_for(message_encoding: str, schema: Schema | None) Callable[[bytes], SimpleNamespace] | None[source]

If the message encoding and schema arguments can be decoded by this decoder factory, returns a callable to decode message bytes.

exception mcap_ros2.decoder.McapROS2DecodeError[source]

Bases: McapError

Raised if a MCAP message record cannot be decoded as a ROS2 message.