21 #include "glog/logging.h" 22 #include "tf2_msgs/TFMessage.h" 27 const std::string& bag_filename,
const int bag_id,
35 view_iterator_(view_->begin()),
38 bag_filename_(bag_filename),
40 (view_->getEndTime() - view_->getBeginTime()).toSec()),
42 buffer_delay_(buffer_delay),
43 filtering_early_message_handler_(
44 std::
move(filtering_early_message_handler)) {
54 return std::make_tuple(
view_->getBeginTime(),
view_->getEndTime());
63 LOG(INFO) <<
"Processed " << (msg.
getTime() -
view_->getBeginTime()).toSec()
102 playable_bags_.push_back(std::move(playable_bag));
103 CHECK(playable_bags_.back().IsMessageAvailable());
104 next_message_queue_.emplace(
106 static_cast<int>(playable_bags_.size() - 1)});
110 return !next_message_queue_.empty();
113 std::tuple<rosbag::MessageInstance, int, bool>
116 const int current_bag_index = next_message_queue_.top().bag_index;
117 PlayableBag& current_bag = playable_bags_.at(current_bag_index);
119 CHECK_EQ(msg.
getTime(), next_message_queue_.top().message_timestamp);
120 next_message_queue_.pop();
122 next_message_queue_.emplace(
125 return std::make_tuple(std::move(msg), current_bag.
bag_id(),
131 return next_message_queue_.top().message_timestamp;
const std::string bag_filename_
_Unique_if< T >::_Single_object make_unique(Args &&... args)
ros::Time const & getTime() const
std::unique_ptr< rosbag::View > view_
const double duration_in_seconds_
std::tuple< ros::Time, ros::Time > GetBeginEndTime() const
const ::ros::Duration buffer_delay_
std::deque< rosbag::MessageInstance > buffered_messages_
FilteringEarlyMessageHandler filtering_early_message_handler_
std::tuple< rosbag::MessageInstance, int, bool > GetNextMessage()
PlayableBag(const std::string &bag_filename, int bag_id, ros::Time start_time, ros::Time end_time, ros::Duration buffer_delay, FilteringEarlyMessageHandler filtering_early_message_handler)
bool IsMessageAvailable() const
void AddPlayableBag(PlayableBag playable_bag)
void AdvanceUntilMessageAvailable()
rosbag::View::const_iterator view_iterator_
ros::Time PeekMessageTime() const
rosbag::MessageInstance GetNextMessage()
std::function< bool(const rosbag::MessageInstance &)> FilteringEarlyMessageHandler
ros::Time PeekMessageTime() const
void move(std::vector< T > &a, std::vector< T > &b)
bool IsMessageAvailable() const