mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 12:13:33 +08:00
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
This commit is contained in:
committed by
Mathieu Bresciani
parent
30a6a854c1
commit
fa0ba69083
@@ -902,6 +902,7 @@ Replay::run()
|
|||||||
|
|
||||||
PX4_INFO("Replay in progress...");
|
PX4_INFO("Replay in progress...");
|
||||||
|
|
||||||
|
// Find and add all subscriptions
|
||||||
ulog_message_header_s message_header;
|
ulog_message_header_s message_header;
|
||||||
replay_file.seekg(_data_section_start);
|
replay_file.seekg(_data_section_start);
|
||||||
|
|
||||||
@@ -910,22 +911,23 @@ Replay::run()
|
|||||||
replay_file.read((char *)&message_header, ULOG_MSG_HEADER_LEN);
|
replay_file.read((char *)&message_header, ULOG_MSG_HEADER_LEN);
|
||||||
|
|
||||||
if (!replay_file) {
|
if (!replay_file) {
|
||||||
|
// end of file
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message_header.msg_type == (int)ULogMessageType::ADD_LOGGED_MSG) {
|
if (message_header.msg_type == (int)ULogMessageType::ADD_LOGGED_MSG) {
|
||||||
readAndAddSubscription(replay_file, message_header.msg_size);
|
readAndAddSubscription(replay_file, message_header.msg_size);
|
||||||
|
|
||||||
} else if (message_header.msg_type == (int)ULogMessageType::DATA) {
|
|
||||||
// End of Definition & Data Section Message Header section
|
|
||||||
break;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Not important for now, skip
|
// Not important for now, skip
|
||||||
replay_file.seekg(message_header.msg_size, ios::cur);
|
replay_file.seekg(message_header.msg_size, ios::cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rewind back to the begining of the data section
|
||||||
|
replay_file.seekg(_data_section_start);
|
||||||
|
replay_file.clear();
|
||||||
|
|
||||||
const uint64_t timestamp_offset = getTimestampOffset();
|
const uint64_t timestamp_offset = getTimestampOffset();
|
||||||
uint32_t nr_published_messages = 0;
|
uint32_t nr_published_messages = 0;
|
||||||
streampos last_additional_message_pos = _data_section_start;
|
streampos last_additional_message_pos = _data_section_start;
|
||||||
|
|||||||
@@ -201,8 +201,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Find next data message for this subscription, starting with the stored file offset.
|
* Find next data message for this subscription, starting with the stored file offset.
|
||||||
* Skip the first message, and if found, read the timestamp and store the new file offset.
|
* Skip the first message, and if found, read the timestamp and store the new file offset.
|
||||||
* This also takes care of new subscriptions and parameter updates. When reaching EOF,
|
* When reaching EOF, the subscription is set to invalid.
|
||||||
* the subscription is set to invalid.
|
|
||||||
* File seek position is arbitrary after this call.
|
* File seek position is arbitrary after this call.
|
||||||
* @return false on file error
|
* @return false on file error
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user