struct mola::BridgeROS2::RosoutQueue

Overview

MOLA log messages waiting to be published on /rosout. Shared with our LogHub sink, which may run on any thread and outlive this module, so it only queues messages; the ROS node thread publishes them.

struct RosoutQueue
{
    // structs

    struct Item;

    // fields

    static constexpr size_t MAX_TEXT_BYTES = 16* 1024;
    static constexpr size_t MAX_SIZE = 5000;
    static constexpr size_t MAX_BYTES = 8* 1024* 1024;
    static constexpr size_t MAX_PER_DRAIN = 500;
    std::mutex mtx;
    std::deque<Item> items;
    size_t bytes = 0;
    size_t dropped = 0;
    bool closed = false;
};

Fields

static constexpr size_t MAX_TEXT_BYTES = 16* 1024

Longer message texts are truncated, which also bounds the memory that /rosout history (1000 messages) may hold.

static constexpr size_t MAX_SIZE = 5000

Bound memory if ROS is not keeping up: the oldest messages are dropped.

static constexpr size_t MAX_PER_DRAIN = 500

Messages published per spin of the ROS node thread, so a backlog does not hold up the sensor subscriptions.

size_t bytes = 0

Sum of Item::bytes() in items

bool closed = false

No more messages are accepted.