From 3106c49076560db198cdd6862a236ee625be13cd Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Mon, 4 Nov 2024 13:38:10 +0100 Subject: [PATCH 1/6] Add support for unsupported serialization formats in a log file. Log files are scanned for the first support format. All other topics are ignored and the user is informed. Signed-off-by: Jesper Smith --- .../rosbag2_cpp/readers/sequential_reader.hpp | 2 + .../rosbag2_cpp/readers/sequential_reader.cpp | 86 ++++++++++++++++--- 2 files changed, 75 insertions(+), 13 deletions(-) diff --git a/rosbag2_cpp/include/rosbag2_cpp/readers/sequential_reader.hpp b/rosbag2_cpp/include/rosbag2_cpp/readers/sequential_reader.hpp index f056c79021..ea07f9bf37 100644 --- a/rosbag2_cpp/include/rosbag2_cpp/readers/sequential_reader.hpp +++ b/rosbag2_cpp/include/rosbag2_cpp/readers/sequential_reader.hpp @@ -187,6 +187,8 @@ class ROSBAG2_CPP_PUBLIC SequentialReader std::shared_ptr converter_factory_{}; bag_events::EventCallbackManager callback_manager_; + + std::string storage_serialization_format; }; } // namespace readers diff --git a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp index 042966358c..3076483149 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp @@ -119,13 +119,22 @@ void SequentialReader::open( ROSBAG2_CPP_LOG_WARN("No topics were listed in metadata."); return; } - fill_topics_metadata(); + + // Set the current storage serialization format to the output serialization format + storage_serialization_format = converter_options.output_serialization_format; // Currently a bag file can only be played if all topics have the same serialization format. check_topics_serialization_formats(topics); check_converter_serialization_format( converter_options.output_serialization_format, - topics[0].topic_metadata.serialization_format); + storage_serialization_format); + + // Fill topics metadata. The storage serialization format is known by this point, so only supported + // topics will be added + fill_topics_metadata(); + + // Set initial filter to read all supported topics. + set_filter({}); } bool SequentialReader::has_next() @@ -175,7 +184,28 @@ std::vector SequentialReader::get_all_topics_and void SequentialReader::set_filter( const rosbag2_storage::StorageFilter & storage_filter) { - topics_filter_ = storage_filter; + // Clear the current topics_filter + topics_filter_ = {}; + + // Create a new filter that is the intersection of the storage filter and the topics metadata. + if(storage_filter.topics.empty()) { // Empty filter. Add all topics with a supported serialization format. + for(const auto & topic : topics_metadata_) { + if (topic.serialization_format != storage_serialization_format) { + topics_filter_.topics.push_back(topic.name); + } + } + } else { // Non-empty filter. Add all requested topics with a supported serialization format. + for (const auto& topic : storage_filter.topics) { + auto it = std::find_if(topics_metadata_.begin(), topics_metadata_.end(), + [&topic](const auto& topic_metadata) { return topic_metadata.name == topic; }); + if (it != topics_metadata_.end()) { + topics_filter_.topics.push_back(topic); + } else { + ROSBAG2_CPP_LOG_WARN("Requested topic %s not found or has unsupported serialization format.", topic.c_str()); + } + } + } + if (storage_) { storage_->set_filter(topics_filter_); return; @@ -249,17 +279,39 @@ std::string SequentialReader::get_current_uri() const return current_uri.string(); } + void SequentialReader::check_topics_serialization_formats( const std::vector & topics) { - auto storage_serialization_format = topics[0].topic_metadata.serialization_format; - for (const auto & topic : topics) { - if (topic.topic_metadata.serialization_format != storage_serialization_format) { - throw std::runtime_error( - "Topics with different rwm serialization format have been found. " - "All topics must have the same serialization format."); + + // Check if we have any messages stored in the output serialization format. If that's the case, we don't need to check all converter plugins. + bool need_topic_conversion = true; + for (const auto & topic: topics) { + if(topic.topic_metadata.serialization_format == storage_serialization_format) { + need_topic_conversion = false; + break; + } + } + + // If we haven't found any messages in the output serialization format, lets see if we have any serialization format we can convert from. + if(need_topic_conversion) { + bool found_topic_to_convert = false; + storage_serialization_format = ""; // Clarify that we haven't found any serialization format to convert from. + for (const auto& topic : topics) { + if (converter_factory_->load_deserializer(topic.topic_metadata.serialization_format) != nullptr) { + storage_serialization_format = topic.topic_metadata.serialization_format; + found_topic_to_convert = true; + break; + } + } + + // If we cannot convert, fail. + if (!found_topic_to_convert) { + throw std::runtime_error("No topics with a known serialization format have been found. "); } } + + // User is warned of non-supported topics in set_filter } void SequentialReader::check_converter_serialization_format( @@ -280,13 +332,21 @@ void SequentialReader::check_converter_serialization_format( } } -void SequentialReader::fill_topics_metadata() -{ +void SequentialReader::fill_topics_metadata() { rcpputils::check_true(storage_ != nullptr, "Bag is not open. Call open() before reading."); + + // Add only topics with the same serialization format as the storage serialization format topics_metadata_.clear(); topics_metadata_.reserve(metadata_.topics_with_message_count.size()); - for (const auto & topic_information : metadata_.topics_with_message_count) { - topics_metadata_.push_back(topic_information.topic_metadata); + for (const auto& topic_information : metadata_.topics_with_message_count) { + if (topic_information.topic_metadata.serialization_format == storage_serialization_format) { + topics_metadata_.push_back(topic_information.topic_metadata); + } else { + ROSBAG2_CPP_LOG_WARN("Topic %s with serialization format %s doesn't match the storage format %s.", + topic_information.topic_metadata.name.c_str(), + topic_information.topic_metadata.serialization_format.c_str(), + storage_serialization_format.c_str()); + } } } From d01b2c358eefeacd4f85299ef7ec0f55cc646176 Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Mon, 4 Nov 2024 14:07:41 +0100 Subject: [PATCH 2/6] Avoid publishing all topics if no matching topics are found Signed-off-by: Jesper Smith --- rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp index 3076483149..4f58512466 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp @@ -203,6 +203,11 @@ void SequentialReader::set_filter( } else { ROSBAG2_CPP_LOG_WARN("Requested topic %s not found or has unsupported serialization format.", topic.c_str()); } + + // Edge case: we cannot find any supported topic. To avoid reading all messages, throw an error. + if (topics_filter_.topics.empty()) { + throw std::runtime_error("No topics found that match the filter."); + } } } From f453fdf1763447a841d6883aac3d0936a1e50097 Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Thu, 14 Nov 2024 11:09:49 +0100 Subject: [PATCH 3/6] Towards fixing tests Signed-off-by: Jesper Smith --- .../rosbag2_cpp/readers/sequential_reader.cpp | 112 +++++++++--------- .../rosbag2_cpp/test_sequential_reader.cpp | 13 +- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp index 4f58512466..fd579ccb85 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "rosbag2_cpp/readers/sequential_reader.hpp" + #include #include #include @@ -20,10 +22,7 @@ #include "rcpputils/asserts.hpp" #include "rcpputils/filesystem_helper.hpp" - #include "rosbag2_cpp/logging.hpp" -#include "rosbag2_cpp/readers/sequential_reader.hpp" - namespace rosbag2_cpp { @@ -40,8 +39,7 @@ std::vector resolve_relative_paths( base_path = rcpputils::fs::path(base_folder).parent_path(); } - rcpputils::require_true( - base_path.exists(), "base folder does not exist: " + base_folder); + rcpputils::require_true(base_path.exists(), "base folder does not exist: " + base_folder); rcpputils::require_true( base_path.is_directory(), "base folder has to be a directory: " + base_folder); @@ -65,13 +63,11 @@ SequentialReader::SequentialReader( converter_(nullptr), metadata_io_(std::move(metadata_io)), converter_factory_(std::move(converter_factory)) -{} - -SequentialReader::~SequentialReader() { - close(); } +SequentialReader::~SequentialReader() {close();} + void SequentialReader::close() { if (storage_) { @@ -123,14 +119,12 @@ void SequentialReader::open( // Set the current storage serialization format to the output serialization format storage_serialization_format = converter_options.output_serialization_format; - // Currently a bag file can only be played if all topics have the same serialization format. check_topics_serialization_formats(topics); check_converter_serialization_format( - converter_options.output_serialization_format, - storage_serialization_format); + converter_options.output_serialization_format, storage_serialization_format); - // Fill topics metadata. The storage serialization format is known by this point, so only supported - // topics will be added + // Fill topics metadata. The storage serialization format is known by this point, + // so only supported topics will be added fill_topics_metadata(); // Set initial filter to read all supported topics. @@ -181,30 +175,35 @@ std::vector SequentialReader::get_all_topics_and return topics_metadata_; } -void SequentialReader::set_filter( - const rosbag2_storage::StorageFilter & storage_filter) +void SequentialReader::set_filter(const rosbag2_storage::StorageFilter & storage_filter) { // Clear the current topics_filter topics_filter_ = {}; // Create a new filter that is the intersection of the storage filter and the topics metadata. - if(storage_filter.topics.empty()) { // Empty filter. Add all topics with a supported serialization format. - for(const auto & topic : topics_metadata_) { + if (storage_filter.topics.empty()) + { + // Empty filter. Add all topics with a supported serialization format. + for (const auto & topic : topics_metadata_) { if (topic.serialization_format != storage_serialization_format) { topics_filter_.topics.push_back(topic.name); } } - } else { // Non-empty filter. Add all requested topics with a supported serialization format. - for (const auto& topic : storage_filter.topics) { - auto it = std::find_if(topics_metadata_.begin(), topics_metadata_.end(), - [&topic](const auto& topic_metadata) { return topic_metadata.name == topic; }); + } else { + // Non-empty filter. Add all requested topics with a supported serialization format. + for (const auto & topic : storage_filter.topics) { + auto it = std::find_if( + topics_metadata_.begin(), topics_metadata_.end(), + [&topic](const auto & topic_metadata) {return topic_metadata.name == topic;}); if (it != topics_metadata_.end()) { topics_filter_.topics.push_back(topic); } else { - ROSBAG2_CPP_LOG_WARN("Requested topic %s not found or has unsupported serialization format.", topic.c_str()); + ROSBAG2_CPP_LOG_WARN( + "Requested topic %s not found or has unsupported serialization format.", topic.c_str()); } - // Edge case: we cannot find any supported topic. To avoid reading all messages, throw an error. + // Edge case: we cannot find any supported topic. + // To avoid reading all messages, throw an error. if (topics_filter_.topics.empty()) { throw std::runtime_error("No topics found that match the filter."); } @@ -215,14 +214,10 @@ void SequentialReader::set_filter( storage_->set_filter(topics_filter_); return; } - throw std::runtime_error( - "Bag is not open. Call open() before setting filter."); + throw std::runtime_error("Bag is not open. Call open() before setting filter."); } -void SequentialReader::reset_filter() -{ - set_filter(rosbag2_storage::StorageFilter()); -} +void SequentialReader::reset_filter() {set_filter(rosbag2_storage::StorageFilter());} void SequentialReader::seek(const rcutils_time_point_value_t & timestamp) { @@ -233,8 +228,7 @@ void SequentialReader::seek(const rcutils_time_point_value_t & timestamp) load_current_file(); return; } - throw std::runtime_error( - "Bag is not open. Call open() before seeking time."); + throw std::runtime_error("Bag is not open. Call open() before seeking time."); } bool SequentialReader::has_next_file() const @@ -272,10 +266,7 @@ void SequentialReader::load_next_file() callback_manager_.execute_callbacks(bag_events::BagEvent::READ_SPLIT, info); } -std::string SequentialReader::get_current_file() const -{ - return *current_file_iterator_; -} +std::string SequentialReader::get_current_file() const {return *current_file_iterator_;} std::string SequentialReader::get_current_uri() const { @@ -284,26 +275,30 @@ std::string SequentialReader::get_current_uri() const return current_uri.string(); } - void SequentialReader::check_topics_serialization_formats( const std::vector & topics) { - - // Check if we have any messages stored in the output serialization format. If that's the case, we don't need to check all converter plugins. + // Check if we have any messages stored in the output serialization format. + // If that's the case, we don't need to check all converter plugins. bool need_topic_conversion = true; - for (const auto & topic: topics) { - if(topic.topic_metadata.serialization_format == storage_serialization_format) { + for (const auto & topic : topics) { + if (topic.topic_metadata.serialization_format == storage_serialization_format) { need_topic_conversion = false; break; } } - // If we haven't found any messages in the output serialization format, lets see if we have any serialization format we can convert from. - if(need_topic_conversion) { + // If we haven't found any messages in the output serialization format, + // lets see if we have any serialization format we can convert from. + if (need_topic_conversion) { bool found_topic_to_convert = false; - storage_serialization_format = ""; // Clarify that we haven't found any serialization format to convert from. - for (const auto& topic : topics) { - if (converter_factory_->load_deserializer(topic.topic_metadata.serialization_format) != nullptr) { + // Clarify that we haven't found any serialization format to convert from. + storage_serialization_format = ""; + for (const auto & topic : topics) { + if ( + converter_factory_->load_deserializer(topic.topic_metadata.serialization_format) != + nullptr) + { storage_serialization_format = topic.topic_metadata.serialization_format; found_topic_to_convert = true; break; @@ -323,13 +318,13 @@ void SequentialReader::check_converter_serialization_format( const std::string & converter_serialization_format, const std::string & storage_serialization_format) { - if (converter_serialization_format.empty()) {return;} + if (converter_serialization_format.empty()) { + return; + } if (converter_serialization_format != storage_serialization_format) { converter_ = std::make_unique( - storage_serialization_format, - converter_serialization_format, - converter_factory_); + storage_serialization_format, converter_serialization_format, converter_factory_); auto topics = storage_->get_all_topics_and_types(); for (const auto & topic_with_type : topics) { converter_->add_topic(topic_with_type.name, topic_with_type.type); @@ -337,20 +332,22 @@ void SequentialReader::check_converter_serialization_format( } } -void SequentialReader::fill_topics_metadata() { +void SequentialReader::fill_topics_metadata() +{ rcpputils::check_true(storage_ != nullptr, "Bag is not open. Call open() before reading."); // Add only topics with the same serialization format as the storage serialization format topics_metadata_.clear(); topics_metadata_.reserve(metadata_.topics_with_message_count.size()); - for (const auto& topic_information : metadata_.topics_with_message_count) { + for (const auto & topic_information : metadata_.topics_with_message_count) { if (topic_information.topic_metadata.serialization_format == storage_serialization_format) { topics_metadata_.push_back(topic_information.topic_metadata); } else { - ROSBAG2_CPP_LOG_WARN("Topic %s with serialization format %s doesn't match the storage format %s.", - topic_information.topic_metadata.name.c_str(), - topic_information.topic_metadata.serialization_format.c_str(), - storage_serialization_format.c_str()); + ROSBAG2_CPP_LOG_WARN( + "Topic %s with serialization format %s doesn't match the storage format %s.", + topic_information.topic_metadata.name.c_str(), + topic_information.topic_metadata.serialization_format.c_str(), + storage_serialization_format.c_str()); } } } @@ -359,8 +356,7 @@ void SequentialReader::add_event_callbacks(const bag_events::ReaderEventCallback { if (callbacks.read_split_callback) { callback_manager_.add_event_callback( - callbacks.read_split_callback, - bag_events::BagEvent::READ_SPLIT); + callbacks.read_split_callback, bag_events::BagEvent::READ_SPLIT); } } diff --git a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp index 26fc09b330..ac5b7dcf31 100644 --- a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp +++ b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp @@ -128,13 +128,14 @@ class SequentialReaderTest : public Test TEST_F(SequentialReaderTest, read_next_uses_converters_to_convert_serialization_format) { std::string output_format = "rmw2_format"; - auto format1_converter = std::make_unique>(); auto format2_converter = std::make_unique>(); - EXPECT_CALL(*format1_converter, deserialize(_, _, _)).Times(1); EXPECT_CALL(*format2_converter, serialize(_, _, _)).Times(1); EXPECT_CALL(*converter_factory_, load_deserializer(storage_serialization_format_)) - .WillOnce(Return(ByMove(std::move(format1_converter)))); + .WillRepeatedly( + [](const std::string &) { + return std::make_unique>(); + }); EXPECT_CALL(*converter_factory_, load_serializer(output_format)) .WillOnce(Return(ByMove(std::move(format2_converter)))); @@ -145,9 +146,11 @@ TEST_F(SequentialReaderTest, read_next_uses_converters_to_convert_serialization_ TEST_F(SequentialReaderTest, open_throws_error_if_converter_plugin_does_not_exist) { std::string output_format = "rmw2_format"; - auto format1_converter = std::make_unique>(); EXPECT_CALL(*converter_factory_, load_deserializer(storage_serialization_format_)) - .WillOnce(Return(ByMove(std::move(format1_converter)))); + .WillRepeatedly( + [](const std::string &) { + return std::make_unique>(); + }); EXPECT_CALL(*converter_factory_, load_serializer(output_format)) .WillOnce(Return(ByMove(nullptr))); From bff7ed4fc908eeea2814e9ca5250ef8586e20ee0 Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Thu, 14 Nov 2024 11:15:06 +0100 Subject: [PATCH 4/6] Expect an optional call to deserialize Signed-off-by: Jesper Smith --- rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp index ac5b7dcf31..6e6331a1e3 100644 --- a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp +++ b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp @@ -134,7 +134,9 @@ TEST_F(SequentialReaderTest, read_next_uses_converters_to_convert_serialization_ EXPECT_CALL(*converter_factory_, load_deserializer(storage_serialization_format_)) .WillRepeatedly( [](const std::string &) { - return std::make_unique>(); + auto deserializer = std::make_unique>(); + EXPECT_CALL(*deserializer, deserialize(_, _, _)).Times(AtMost(1)); + return deserializer; }); EXPECT_CALL(*converter_factory_, load_serializer(output_format)) .WillOnce(Return(ByMove(std::move(format2_converter)))); From 6e506558a5185bde19c69878ae5f2dc287dac1f2 Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Thu, 14 Nov 2024 11:44:02 +0100 Subject: [PATCH 5/6] Fix set_topic_filter Signed-off-by: Jesper Smith --- .../src/rosbag2_cpp/readers/sequential_reader.cpp | 15 ++++++--------- .../test/rosbag2_cpp/test_sequential_reader.cpp | 8 +++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp index fd579ccb85..1f0e473eea 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp @@ -185,9 +185,7 @@ void SequentialReader::set_filter(const rosbag2_storage::StorageFilter & storage { // Empty filter. Add all topics with a supported serialization format. for (const auto & topic : topics_metadata_) { - if (topic.serialization_format != storage_serialization_format) { - topics_filter_.topics.push_back(topic.name); - } + topics_filter_.topics.push_back(topic.name); } } else { // Non-empty filter. Add all requested topics with a supported serialization format. @@ -201,12 +199,12 @@ void SequentialReader::set_filter(const rosbag2_storage::StorageFilter & storage ROSBAG2_CPP_LOG_WARN( "Requested topic %s not found or has unsupported serialization format.", topic.c_str()); } + } - // Edge case: we cannot find any supported topic. - // To avoid reading all messages, throw an error. - if (topics_filter_.topics.empty()) { - throw std::runtime_error("No topics found that match the filter."); - } + // Edge case: we cannot find any supported topic. + // To avoid reading all messages, throw an error. + if (topics_filter_.topics.empty()) { + throw std::runtime_error("No topics found that match the filter."); } } @@ -252,7 +250,6 @@ void SequentialReader::load_current_file() } // set filters storage_->seek(seek_time_); - set_filter(topics_filter_); } void SequentialReader::load_next_file() diff --git a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp index 6e6331a1e3..4c5eac976a 100644 --- a/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp +++ b/rosbag2_cpp/test/rosbag2_cpp/test_sequential_reader.cpp @@ -58,7 +58,12 @@ class SequentialReaderTest : public Test topic_with_type.name = "topic"; topic_with_type.type = "test_msgs/BasicTypes"; topic_with_type.serialization_format = storage_serialization_format_; - auto topics_and_types = std::vector{topic_with_type}; + rosbag2_storage::TopicMetadata topic2_with_type; + topic2_with_type.name = "topic2"; + topic2_with_type.type = "test_msgs/BasicTypes"; + topic2_with_type.serialization_format = storage_serialization_format_; + auto topics_and_types = + std::vector{topic_with_type, topic2_with_type}; auto message = std::make_shared(); message->topic_name = topic_with_type.name; @@ -72,6 +77,7 @@ class SequentialReaderTest : public Test metadata_.relative_file_paths = {bag_file_1_path_.string(), bag_file_2_path_.string()}; metadata_.version = 4; metadata_.topics_with_message_count.push_back({{topic_with_type}, 6}); + metadata_.topics_with_message_count.push_back({{topic2_with_type}, 1}); metadata_.storage_identifier = "mock_storage"; EXPECT_CALL(*metadata_io, read_metadata(_)).WillRepeatedly(Return(metadata_)); From fe89c2539db570d177fc0d238addbde1c3201674 Mon Sep 17 00:00:00 2001 From: Jesper Smith Date: Thu, 14 Nov 2024 12:28:36 +0100 Subject: [PATCH 6/6] Reformat sequential_reader Signed-off-by: Jesper Smith --- rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp index 1f0e473eea..1748e89bf1 100644 --- a/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp +++ b/rosbag2_cpp/src/rosbag2_cpp/readers/sequential_reader.cpp @@ -181,8 +181,7 @@ void SequentialReader::set_filter(const rosbag2_storage::StorageFilter & storage topics_filter_ = {}; // Create a new filter that is the intersection of the storage filter and the topics metadata. - if (storage_filter.topics.empty()) - { + if (storage_filter.topics.empty()) { // Empty filter. Add all topics with a supported serialization format. for (const auto & topic : topics_metadata_) { topics_filter_.topics.push_back(topic.name);