Skip to content

Commit 58dde90

Browse files
committed
ReplayEkf: correctly add all subscriptions
Logged data and subscription messages can be mixed, so don't stop adding subscriptions after finding the first logged message
1 parent f51ea99 commit 58dde90

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/modules/replay/Replay.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ Replay::run()
902902

903903
PX4_INFO("Replay in progress...");
904904

905+
// Find and add all subscriptions
905906
ulog_message_header_s message_header;
906907
replay_file.seekg(_data_section_start);
907908

@@ -910,22 +911,23 @@ Replay::run()
910911
replay_file.read((char *)&message_header, ULOG_MSG_HEADER_LEN);
911912

912913
if (!replay_file) {
914+
// end of file
913915
break;
914916
}
915917

916918
if (message_header.msg_type == (int)ULogMessageType::ADD_LOGGED_MSG) {
917919
readAndAddSubscription(replay_file, message_header.msg_size);
918920

919-
} else if (message_header.msg_type == (int)ULogMessageType::DATA) {
920-
// End of Definition & Data Section Message Header section
921-
break;
922-
923921
} else {
924922
// Not important for now, skip
925923
replay_file.seekg(message_header.msg_size, ios::cur);
926924
}
927925
}
928926

927+
// Rewind back to the begining of the data section
928+
replay_file.seekg(_data_section_start);
929+
replay_file.clear();
930+
929931
const uint64_t timestamp_offset = getTimestampOffset();
930932
uint32_t nr_published_messages = 0;
931933
streampos last_additional_message_pos = _data_section_start;

src/modules/replay/Replay.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ class Replay : public ModuleBase<Replay>
201201
/**
202202
* Find next data message for this subscription, starting with the stored file offset.
203203
* Skip the first message, and if found, read the timestamp and store the new file offset.
204-
* This also takes care of new subscriptions and parameter updates. When reaching EOF,
205-
* the subscription is set to invalid.
204+
* When reaching EOF, the subscription is set to invalid.
206205
* File seek position is arbitrary after this call.
207206
* @return false on file error
208207
*/

0 commit comments

Comments
 (0)