McapFile
McapFile is a File holding an MCAP robotics log.
McapFile and McapSlice rows are created by
read_mcap.
McapFile
Bases: File
File holding an MCAP robotics log (ROS 2, Foxglove).
Source code in datachain/lib/file.py
messages
Yield messages in log-time order, logged in [start, end) nanoseconds.
Only the chunks that may hold matching messages are read. With
decoder_factories (e.g. mcap_protobuf.decoder.DecoderFactory()), each
message also carries its decoded object.
Source code in datachain/lib/mcap.py
summary
Read the summary section only, optionally counting just topics.
Source code in datachain/lib/mcap.py
McapSlice
Bases: DataModel
A [start, end) log-time window of an MCAP file, in nanoseconds.
Attributes:
-
mcap(McapFile) –The MCAP file.
-
start(int) –Window start, inclusive.
-
end(int) –Window end, exclusive.
-
topics(list[str]) –Topics
messages()returns by default; empty means all.
messages
Yield the window's messages, of topics or else of self.topics.
Source code in datachain/lib/mcap.py
McapSummary
Bases: DataModel
Totals from the summary section of an MCAP file.
Attributes:
-
topics(list[McapTopic]) –One entry per channel.
-
messages(int) –Message count over
topics. -
start(int) –Log time of the first message in the file, in nanoseconds.
-
end(int) –Log time of the last message in the file, in nanoseconds.
-
duration(float) –end - start, in seconds.
McapTopic
McapMessage
Bases: DataModel
An MCAP message; times are in nanoseconds.
decoded holds the decoded message when messages() got decoder_factories;
it isn't saved with the dataset.