feat: split image timestamp CSV files when frame sync is disabled

This commit is contained in:
slz
2026-08-25 14:57:51 +08:00
parent 077afd1fff
commit a5a093fc79
4 changed files with 133 additions and 47 deletions
@@ -21,8 +21,10 @@ namespace orbbec_camera {
class FrameTimestampCsvLogger {
public:
enum class OutputMode { SYNCED, COLOR, DEPTH };
FrameTimestampCsvLogger(bool drop_log_enabled, const std::string &csv_file_path,
rclcpp::Logger logger);
OutputMode output_mode, rclcpp::Logger logger);
~FrameTimestampCsvLogger() noexcept;
@@ -137,7 +139,7 @@ class FrameTimestampCsvLogger {
std::string serializeStreamColumns(const StreamState &state) const;
static std::string formatSecondsColumn(int64_t time_us);
static std::string formatOptionalIntColumn(const std::optional<int64_t> &value);
static std::string csvHeader();
std::string csvHeader() const;
void writerThreadMain();
std::string csvFilePathForIndex(uint64_t file_index) const;
@@ -152,6 +154,7 @@ class FrameTimestampCsvLogger {
std::atomic_bool csv_writer_failed_{false};
bool queue_warning_active_ = false;
std::string csv_file_path_;
OutputMode output_mode_;
std::ofstream csv_stream_;
std::thread writer_thread_;
uint64_t csv_file_index_ = 0;
@@ -1024,6 +1024,8 @@ class OBCameraNode {
bool enable_frame_drop_log_ = false;
std::string frame_timestamp_csv_file_;
std::unique_ptr<FrameTimestampCsvLogger> frame_timestamp_csv_logger_;
std::unique_ptr<FrameTimestampCsvLogger> color_timestamp_csv_logger_;
std::unique_ptr<FrameTimestampCsvLogger> depth_timestamp_csv_logger_;
std::unique_ptr<ImuTimestampCsvLogger> imu_timestamp_csv_logger_;
std::unique_ptr<ImuTimestampCsvLogger> accel_timestamp_csv_logger_;
std::unique_ptr<ImuTimestampCsvLogger> gyro_timestamp_csv_logger_;