feat: rotate frame timestamp CSV files

This commit is contained in:
slz
2026-08-11 10:29:35 +08:00
parent 8679784600
commit 7c5e26f13b
2 changed files with 84 additions and 13 deletions
@@ -10,6 +10,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <unordered_map>
#include <vector>
@@ -139,18 +140,22 @@ class FrameTimestampCsvLogger {
static std::string csvHeader();
void writerThreadMain();
void openCsvIfNeeded();
std::string csvFilePathForIndex(uint64_t file_index) const;
bool openCsvFile(uint64_t file_index);
bool rotateCsvFile();
rclcpp::Logger logger_;
bool enabled_ = false;
bool csv_enabled_ = false;
bool drop_log_enabled_ = false;
std::atomic_bool shutdown_requested_{false};
bool csv_writer_failed_ = false;
std::atomic_bool csv_writer_failed_{false};
bool queue_warning_active_ = false;
std::string csv_file_path_;
std::ofstream csv_stream_;
std::thread writer_thread_;
uint64_t csv_file_index_ = 0;
uint64_t csv_rows_written_ = 0;
uint64_t next_row_id_ = 1;
std::unordered_map<uint64_t, PendingRow> pending_rows_;