Skip to content

Commit

Permalink
publish clock after the delay is over
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola Loi <[email protected]>
  • Loading branch information
nicolaloi committed Nov 23, 2024
1 parent b5098ef commit 0323e46
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rosbag2_transport/src/rosbag2_transport/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ bool PlayerImpl::play()
reader_->seek(starting_time_);
clock_->jump(starting_time_);
}
if (clock_publish_timer_ != nullptr) {
clock_publish_timer_->reset();
}
load_storage_content_ = true;
storage_loading_future_ = std::async(
std::launch::async, [this]() {
Expand All @@ -510,6 +513,9 @@ bool PlayerImpl::play()
is_ready_to_play_from_queue_ = false;
ready_to_play_from_queue_cv_.notify_all();
}
if (clock_publish_timer_ != nullptr) {
clock_publish_timer_->cancel();
}
} while (rclcpp::ok() && !stop_playback_ && play_options_.loop);
} catch (std::runtime_error & e) {
RCLCPP_ERROR(owner_->get_logger(), "Failed to play: %s", e.what());
Expand Down Expand Up @@ -1072,7 +1078,7 @@ void PlayerImpl::prepare_publishers()
clock_publish_timer_ = owner_->create_wall_timer(
publish_period, [this]() {
publish_clock_update();
});
}, nullptr, false);
}

if (play_options_.clock_publish_on_topic_publish) {
Expand Down

0 comments on commit 0323e46

Please sign in to comment.