Class McapSink

Inheritance Relationships

Base Type

  • public DataTamer::DataSinkBase

Class Documentation

class McapSink : public DataTamer::DataSinkBase

Public Types

enum Compression

Values:

enumerator None
enumerator Lz4
enumerator Zstd
enum class Format

Values:

enumerator Json
enumerator Protobuf
using SharedPtr = std::shared_ptr<McapSink>

Public Functions

McapSink(std::string const &filepath, const mcap::McapWriterOptions &options, Format fmt = Format::Protobuf, bool append_timestamp = false)

mcap sink with explicit writer options. Default format = Protobuf.

McapSink(const rclcpp::Node::SharedPtr &n, std::string const &filepath, const mcap::McapWriterOptions &options, Format fmt = Format::Protobuf, bool append_timestamp = false)
McapSink(std::string const &filepath, Format fmt = Format::Protobuf, Compression compression = Compression::Zstd, std::optional<uint64_t> chunk_size = std::nullopt, bool append_timestamp = false)

mcap sink convenience ctor (compression/chunk). Default format = Protobuf.

Parameters:
  • filepath – file path of the new file (should be “.mcap” extension)

  • fmt – format of the data to write

  • compression – compression algorithm to use

  • chunk_size – optional chunk size to use, default is mcap::DefaultChunkSize

McapSink(const rclcpp::Node::SharedPtr &n, std::string const &filepath, Format fmt = Format::Protobuf, Compression compression = Compression::Zstd, std::optional<uint64_t> chunk_size = std::nullopt, bool append_timestamp = false)

mcap sink convenience ctor (compression/chunk). Default format = Protobuf.

Parameters:
  • node – for subscribing to log rotation topic

  • filepath – file path of the new file (should be “.mcap” extension)

  • fmt – format of the data to write

  • compression – compression algorithm to use

  • chunk_size – optional chunk size to use, default is mcap::DefaultChunkSize

~McapSink() override
void addChannel(std::string const &channel_name, DataTamer::Schema const &schema) override
bool storeSnapshot(const DataTamer::Snapshot &snapshot) override
void stopRecording()

Stop recording and save the file.

void restartRecording(std::string const &filepath, const mcap::McapWriterOptions &options)
Parameters:
  • filepath – file path of the new file (should be “.mcap” extension)

  • options – mcap writer options struct

void rotateToDirectory(const std::string &new_dir)

Public Static Functions

static mcap::McapWriterOptions makeOptions(Format fmt, Compression compression, std::optional<uint64_t> chunk_size = std::nullopt)