From 2e8ee92104bbd4fcadd0f3d2449aa0d8c39e16a7 Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Sat, 11 Jul 2026 14:28:18 +0800 Subject: [PATCH] Fix excluded action filtering in player The action-interface branch checked whether the topic exclusion list was empty before consulting the action exclusion list. Use the owning action list and extend the existing playback test to cover include/exclude precedence and client creation. Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com> --- rosbag2_transport/src/rosbag2_transport/player.cpp | 2 +- rosbag2_transport/test/rosbag2_transport/test_play.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rosbag2_transport/src/rosbag2_transport/player.cpp b/rosbag2_transport/src/rosbag2_transport/player.cpp index b15ca4dd7..25c30716d 100644 --- a/rosbag2_transport/src/rosbag2_transport/player.cpp +++ b/rosbag2_transport/src/rosbag2_transport/player.cpp @@ -1405,7 +1405,7 @@ bool allow_topic( } case TopicKind::ACTION_INTERFACE_TOPIC: { - if (!exclude_topics.empty()) { + if (!exclude_actions.empty()) { auto it = std::find(exclude_actions.begin(), exclude_actions.end(), topic_name); if (it != exclude_actions.end()) { return false; diff --git a/rosbag2_transport/test/rosbag2_transport/test_play.cpp b/rosbag2_transport/test/rosbag2_transport/test_play.cpp index e40a1bc4c..b2a9a454c 100644 --- a/rosbag2_transport/test/rosbag2_transport/test_play.cpp +++ b/rosbag2_transport/test/rosbag2_transport/test_play.cpp @@ -1774,7 +1774,8 @@ TEST_F(RosBag2PlayTestFixture, recorded_messages_are_played_for_filtered_actions }; // send actions as client - play_options_.actions_to_filter = {action_name2}; + play_options_.actions_to_filter = {action_name1, action_name2}; + play_options_.exclude_actions_to_filter = {action_name1}; play_options_.send_actions_as_client = true; auto prepared_mock_reader = std::make_unique(); prepared_mock_reader->prepare(messages, actions_types); @@ -1803,6 +1804,7 @@ TEST_F(RosBag2PlayTestFixture, recorded_messages_are_played_for_filtered_actions EXPECT_EQ(action1_cancel_count, 0); ASSERT_EQ(action2_request_count, 1); EXPECT_EQ(action2_cancel_count, 0); + EXPECT_THAT(player->get_list_of_action_clients(), SizeIs(1)); // There is no direct interface to confirm that rosbag2 received the get_result response. // Here, the logic of handling actions in rosbag2 is used to make this determination. If