replay: fix issue when original logfile had topics with zero timstamps #11708
+3
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe problem solved by the proposed pull request
If the original logfile contained a topic which at some point was logged with a zero timestamp
next_file_time
would be set to zero and in the next iteration of the for loopnext_file_time
is updated to the timestamp of the next topic in the_subscriptions
list.The result was that the topics which were before the zero timestamp topic in the
_subscriptions
list would never be published until the end. This was not visible in most log analysis software since the timestamp would still be correct but the order and timing of the published topics would be wrong.Additional context
Another thing which makes replay not work as expected is the fact that the logger only tries to subscribe to a topic once a second. So e.g. when a VTOL transitions to cruise flight there will be a time right after transition when the fw_pos_controller publishes the virtual attitude setpoint but it is not logged for up to one second