Question: Why replay mode can be detected based on timestamp gap of detected obstacles in Perception module?
Dear Apollo developers,
I am studying the implementation of the perception module and find an interesting configuration parameter FLAGS_replay_timestamp_gap on line 45 of modules/prediction/container/obstacles/obstacles_container.cc. I don't quite understand the if-condition in the following code snippet. Specifically, how can we guarantee that Apollo is indeed running in replay mode if the absolute time difference is greater than FLAGS_replay_timestamp_gap, which is set as 10.0 according to modules/prediction/common/prediction_gflags.cc? What does maximum timestamp gap for rosbag replay mean?
if (std::fabs(timestamp - timestamp_) > FLAGS_replay_timestamp_gap) {
if (FLAGS_prediction_offline_mode) {
FeatureOutput::Write();
}
obstacles_.Clear();
ADEBUG << "Replay mode is enabled.";
} else if (timestamp <= timestamp_) {
AERROR << "Invalid timestamp curr [" << timestamp << "] v.s. prev ["
<< timestamp_ << "].";
return;
}
Thanks very much for your clarification!
This module is in prediction. Currently replay is set to work in 10hz.
Got it. Thanks a lot for your clarification!