Skip to content

Commit

Permalink
Show dataset replay progress percent
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jan 9, 2024
1 parent e153479 commit df792f8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class EurocDataset : public RawDataSourceBase
std::array<mrpt::math::TPose3D, 2> cam_poses_; //!< wrt vehicle origin
euroc_dataset_t dataset_; //!< dataset itself
euroc_dataset_t::iterator dataset_next_; //!< next item to publish
size_t dataset_cur_idx_ = 0;

// double replay_time_{.0};
std::string seq_dir_;
Expand Down
12 changes: 11 additions & 1 deletion mola_input_euroc_dataset/src/EurocDataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ void EurocDataset::initialize(const Yaml& c)
}

// Start at the dataset begin:
dataset_next_ = dataset_.begin();
dataset_next_ = dataset_.begin();
dataset_cur_idx_ = 0;

MRPT_END
} // end initialize()
Expand Down Expand Up @@ -245,6 +246,14 @@ void EurocDataset::spinOnce()
"End of dataset reached! Nothing else to publish (CTRL+C to quit)");
return;
}
else
{
MRPT_LOG_THROTTLE_INFO_FMT(
5.0, "Dataset replay progress: %lu / %lu (%4.02f%%)",
static_cast<unsigned long>(dataset_cur_idx_),
static_cast<unsigned long>(dataset_.size()),
(100.0 * dataset_cur_idx_) / (dataset_.size()));
}

// We have to publish all observations until "t":
while (dataset_next_ != dataset_.end() && tim >= dataset_next_->first)
Expand Down Expand Up @@ -274,6 +283,7 @@ void EurocDataset::spinOnce()

// Advance:
++dataset_next_;
++dataset_cur_idx_;
}

// Read ahead to save delays in the next iteration:
Expand Down
8 changes: 8 additions & 0 deletions mola_input_rawlog/src/RawlogDataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ void RawlogDataset::spinOnce()
"End of dataset reached! Nothing else to publish (CTRL+C to quit)");
return;
}
else if (read_all_first_)
{
MRPT_LOG_THROTTLE_INFO_FMT(
5.0, "Dataset replay progress: %lu / %lu (%4.02f%%)",
static_cast<unsigned long>(rawlog_next_idx_),
static_cast<unsigned long>(rawlog_entire_.size()),
(100.0 * rawlog_next_idx_) / (rawlog_entire_.size()));
}

// First rawlog timestamp?
if (rawlog_begin_time_ == INVALID_TIMESTAMP)
Expand Down
8 changes: 8 additions & 0 deletions mola_input_rosbag2/src/Rosbag2Dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ void Rosbag2Dataset::spinOnce()
"quit)");
return;
}
else
{
MRPT_LOG_THROTTLE_INFO_FMT(
5.0, "Dataset replay progress: %lu / %lu (%4.02f%%)",
static_cast<unsigned long>(rosbag_next_idx_),
static_cast<unsigned long>(bagMessageCount_),
(100.0 * rosbag_next_idx_) / bagMessageCount_);
}

// Publish observations up to current time:
for (;;)
Expand Down

0 comments on commit df792f8

Please sign in to comment.