From 8f8a48b5d8daabda9e0bca7e87728a66daf7b73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Wed, 27 Mar 2024 10:18:15 +0100 Subject: [PATCH] Added feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- rosbag2_py/rosbag2_py/_transport.pyi | 1 + rosbag2_transport/src/rosbag2_transport/topic_filter.cpp | 3 +-- rosbag2_transport/test/rosbag2_transport/test_topic_filter.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rosbag2_py/rosbag2_py/_transport.pyi b/rosbag2_py/rosbag2_py/_transport.pyi index 3ec90a5018..ccca998353 100644 --- a/rosbag2_py/rosbag2_py/_transport.pyi +++ b/rosbag2_py/rosbag2_py/_transport.pyi @@ -40,6 +40,7 @@ class RecordOptions: compression_threads: int exclude_regex: str exclude_service_events: List[str] + exclude_topic_types: List[str] exclude_topics: List[str] ignore_leaf_topics: bool include_hidden_topics: bool diff --git a/rosbag2_transport/src/rosbag2_transport/topic_filter.cpp b/rosbag2_transport/src/rosbag2_transport/topic_filter.cpp index 53ef2b164c..80d19c9a3e 100644 --- a/rosbag2_transport/src/rosbag2_transport/topic_filter.cpp +++ b/rosbag2_transport/src/rosbag2_transport/topic_filter.cpp @@ -170,8 +170,7 @@ bool TopicFilter::take_topic( } } - if (!record_options_.exclude_topic_types.empty() && - topic_type_in_list(topic_type, record_options_.exclude_topic_types)) + if (topic_type_in_list(topic_type, record_options_.exclude_topic_types)) { return false; } diff --git a/rosbag2_transport/test/rosbag2_transport/test_topic_filter.cpp b/rosbag2_transport/test/rosbag2_transport/test_topic_filter.cpp index 4b4a78391a..f4191384d4 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_topic_filter.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_topic_filter.cpp @@ -248,6 +248,9 @@ TEST_F(TestTopicFilter, all_topics_and_exclude_type_topics) { EXPECT_TRUE(filtered_topics.find(topic) != filtered_topics.end()) << "Expected topic:" << topic; } + + EXPECT_TRUE(filtered_topics.find("/localization") == filtered_topics.end()); + EXPECT_TRUE(filtered_topics.find("/status") == filtered_topics.end()); } TEST_F(TestTopicFilter, all_services_and_exclude_regex)