diff --git a/rosbag2_transport/src/rosbag2_transport/player.cpp b/rosbag2_transport/src/rosbag2_transport/player.cpp index db814937b3..b4caed1d6a 100644 --- a/rosbag2_transport/src/rosbag2_transport/player.cpp +++ b/rosbag2_transport/src/rosbag2_transport/player.cpp @@ -215,12 +215,13 @@ void Player::play() is_in_play_ = true; float delay; - if (play_options_.delay > 0.0){ + if (play_options_.delay > 0.0) { delay = play_options_.delay; } else { - RCLCPP_WARN(this->get_logger(), - "Invalid delay value: %f. Delay is disabled.", - play_options_.delay); + RCLCPP_WARN( + this->get_logger(), + "Invalid delay value: %f. Delay is disabled.", + play_options_.delay); delay = 0.0; } diff --git a/rosbag2_transport/test/rosbag2_transport/test_play_loop.cpp b/rosbag2_transport/test/rosbag2_transport/test_play_loop.cpp index de8fdbf4b2..135fbd2a83 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_play_loop.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_play_loop.cpp @@ -67,8 +67,8 @@ TEST_F(RosBag2PlayTestFixture, play_bag_file_twice) { auto await_received_messages = sub_->spin_subscriptions(); rosbag2_transport::PlayOptions play_options = { - read_ahead_queue_size, "", rate, {}, {}, loop_playback, {}, - clock_publish_frequency, delay}; + read_ahead_queue_size, "", rate, {}, {}, loop_playback, {}, + clock_publish_frequency, delay}; auto player = std::make_shared( std::move( reader), storage_options_, play_options); @@ -103,6 +103,8 @@ TEST_F(RosBag2PlayTestFixture, messages_played_in_loop) { const size_t read_ahead_queue_size = 1000; const float rate = 1.0; const bool loop_playback = true; + const double clock_publish_frequency = 0.0; + const float delay = 1.0; auto primitive_message1 = get_messages_basic_types()[0]; primitive_message1->int32_value = test_value; @@ -125,7 +127,7 @@ TEST_F(RosBag2PlayTestFixture, messages_played_in_loop) { auto await_received_messages = sub_->spin_subscriptions(); rosbag2_transport::PlayOptions play_options{read_ahead_queue_size, "", rate, {}, {}, - loop_playback, {}}; + loop_playback, {}, clock_publish_frequency, delay}; auto player = std::make_shared( std::move( reader), storage_options_, play_options);