Skip to content

Commit 7ab525a

Browse files
committed
Log sensor meta data as text
1 parent 140c75f commit 7ab525a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/FramePlayer.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,37 @@ namespace rerun_vrs {
3131
};
3232

3333
RerunFramePlayer::RerunFramePlayer(vrs::StreamId id, rerun::RecordingStream& rec)
34-
: id_{id}, rec_{rec} {}
34+
: id_{id}, rec_{rec}, entityPath_{add_quotes(id.getName())} {}
3535

3636
bool RerunFramePlayer::onDataLayoutRead(
3737
const vrs::CurrentRecord& record, size_t blockIndex, vrs::DataLayout& layout
3838
) {
3939
if (!enabled_)
4040
return false;
4141

42+
std::ostringstream buffer;
43+
layout.printLayoutCompact(buffer);
44+
const auto& layout_str = buffer.str();
45+
4246
rec_.set_time_seconds("timestamp", record.timestamp);
47+
48+
if (record.recordType == vrs::Record::Type::CONFIGURATION)
49+
// NOTE this is meta data from the sensor that doesn't change over time and only comes
50+
// in once in the beginning
51+
rec_.log_timeless(
52+
(entityPath_ + "/configuration").c_str(),
53+
rerun::TextDocument(layout_str)
54+
);
55+
4356
if (record.recordType == vrs::Record::Type::DATA) {
4457
auto& config = getExpectedLayout<FrameNumberDataLayout>(layout, blockIndex);
4558
uint64_t frame_number;
4659
if (config.frameNumber.get(frame_number))
4760
rec_.set_time_sequence("frame_number", frame_number);
48-
}
4961

50-
// TODO write this information to a markdown file
51-
/* std::ostringstream buffer; */
52-
/* layout.printLayoutCompact(buffer); */
53-
/* std::cout << buffer.str() << std::endl; */
62+
// this is meta data per record and changes over time
63+
rec_.log((entityPath_ + "/data").c_str(), rerun::TextDocument(layout_str));
64+
}
5465

5566
return true; // read next blocks, if any
5667
}

src/FramePlayer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ namespace rerun_vrs {
6161
rerun::RecordingStream& rec_;
6262
bool needsConvertedFrame_{false};
6363
vrs::StreamId id_;
64+
std::string entityPath_;
6465
/* MetaDataCollector descriptions_; */
6566
bool blankMode_{true};
6667
bool enabled_{true};

0 commit comments

Comments
 (0)