From 2a694a4005944cd55c377557d36244f4a9cfd2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:42:01 +0100 Subject: [PATCH 1/7] Change to EventsExecutor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- plansys2_bringup/src/plansys2_node.cpp | 2 +- plansys2_bt_actions/test/unit/bt_action_test.cpp | 4 ++-- plansys2_domain_expert/src/domain_expert_node.cpp | 2 +- .../test/unit/domain_expert_node_test.cpp | 4 ++-- plansys2_executor/src/plansys2_executor/ComputeBT.cpp | 2 +- plansys2_executor/test/unit/action_execution_test.cpp | 4 ++-- plansys2_executor/test/unit/bt_node_test.cpp | 10 +++++----- plansys2_executor/test/unit/bt_node_test_charging.cpp | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plansys2_bringup/src/plansys2_node.cpp b/plansys2_bringup/src/plansys2_node.cpp index b0c0bce2..a0b8c9d4 100644 --- a/plansys2_bringup/src/plansys2_node.cpp +++ b/plansys2_bringup/src/plansys2_node.cpp @@ -32,7 +32,7 @@ int main(int argc, char ** argv) rclcpp::init(argc, argv); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; auto domain_node = std::make_shared(); auto problem_node = std::make_shared(); diff --git a/plansys2_bt_actions/test/unit/bt_action_test.cpp b/plansys2_bt_actions/test/unit/bt_action_test.cpp index a81987be..d80edf41 100644 --- a/plansys2_bt_actions/test/unit/bt_action_test.cpp +++ b/plansys2_bt_actions/test/unit/bt_action_test.cpp @@ -245,7 +245,7 @@ TEST(bt_actions, bt_action) bt_action->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); - rclcpp::executors::MultiThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(bt_action->get_node_base_interface()); exe.add_node(lc_node->get_node_base_interface()); @@ -282,7 +282,7 @@ TEST(bt_actions, cancel_bt_action) bt_action->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); - rclcpp::executors::MultiThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(bt_action->get_node_base_interface()); exe.add_node(lc_node->get_node_base_interface()); diff --git a/plansys2_domain_expert/src/domain_expert_node.cpp b/plansys2_domain_expert/src/domain_expert_node.cpp index 25b20abf..f0c2eae5 100644 --- a/plansys2_domain_expert/src/domain_expert_node.cpp +++ b/plansys2_domain_expert/src/domain_expert_node.cpp @@ -22,7 +22,7 @@ int main(int argc, char ** argv) rclcpp::init(argc, argv); auto node = std::make_shared(); - rclcpp::executors::MultiThreadedExecutor executor; + rclcpp::experimental::executors::EventsExecutor executor; executor.add_node(node->get_node_base_interface()); executor.spin(); executor.remove_node(node->get_node_base_interface()); diff --git a/plansys2_domain_expert/test/unit/domain_expert_node_test.cpp b/plansys2_domain_expert/test/unit/domain_expert_node_test.cpp index beb1dd2a..60974e41 100644 --- a/plansys2_domain_expert/test/unit/domain_expert_node_test.cpp +++ b/plansys2_domain_expert/test/unit/domain_expert_node_test.cpp @@ -38,7 +38,7 @@ TEST(domain_expert, lifecycle) std::string pkgpath = ament_index_cpp::get_package_share_directory("plansys2_domain_expert"); domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); @@ -105,7 +105,7 @@ TEST(domain_expert, lifecycle_error) std::string pkgpath = ament_index_cpp::get_package_share_directory("plansys2_domain_expert"); domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_2_error.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); diff --git a/plansys2_executor/src/plansys2_executor/ComputeBT.cpp b/plansys2_executor/src/plansys2_executor/ComputeBT.cpp index e8bed028..ce6ddd70 100644 --- a/plansys2_executor/src/plansys2_executor/ComputeBT.cpp +++ b/plansys2_executor/src/plansys2_executor/ComputeBT.cpp @@ -219,7 +219,7 @@ ComputeBT::computeBTCallback( domain_node_->set_parameter({"model_file", domain_filename}); problem_node_->set_parameter({"model_file", domain_filename}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node_->get_node_base_interface()); exe.add_node(problem_node_->get_node_base_interface()); diff --git a/plansys2_executor/test/unit/action_execution_test.cpp b/plansys2_executor/test/unit/action_execution_test.cpp index 74d2b24b..55907596 100644 --- a/plansys2_executor/test/unit/action_execution_test.cpp +++ b/plansys2_executor/test/unit/action_execution_test.cpp @@ -125,7 +125,7 @@ TEST(action_execution, protocol_basic) move_action_node->set_parameter({"action_name", "move"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(test_node); exe.add_node(test_lf_node->get_node_base_interface()); @@ -240,7 +240,7 @@ TEST(action_execution, protocol_cancelation) move_action_node->set_parameter({"action_name", "move"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(test_node); exe.add_node(test_lf_node->get_node_base_interface()); diff --git a/plansys2_executor/test/unit/bt_node_test.cpp b/plansys2_executor/test/unit/bt_node_test.cpp index 4f477239..aed1ac31 100644 --- a/plansys2_executor/test/unit/bt_node_test.cpp +++ b/plansys2_executor/test/unit/bt_node_test.cpp @@ -72,7 +72,7 @@ TEST(problem_expert, wait_overall_req_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -186,7 +186,7 @@ TEST(problem_expert, wait_atstart_req_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -302,7 +302,7 @@ TEST(problem_expert, wait_atend_req_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -416,7 +416,7 @@ TEST(problem_expert, at_start_effect_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -535,7 +535,7 @@ TEST(problem_expert, at_end_effect_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_executor/test/unit/bt_node_test_charging.cpp b/plansys2_executor/test/unit/bt_node_test_charging.cpp index 38b63b54..23e0cd66 100644 --- a/plansys2_executor/test/unit/bt_node_test_charging.cpp +++ b/plansys2_executor/test/unit/bt_node_test_charging.cpp @@ -67,7 +67,7 @@ TEST(problem_expert, wait_atstart_req_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -192,7 +192,7 @@ TEST(problem_expert, apply_atstart_effect_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -319,7 +319,7 @@ TEST(problem_expert, apply_atend_effect_test) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); From 5140b1e18d7f087a4b96b606fca270a92e1dd424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:43:04 +0100 Subject: [PATCH 2/7] Change to EventsExecutor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- plansys2_executor/test/unit/executor_test.cpp | 20 +++++++++---------- .../test/unit/simple_btbuilder_tests.cpp | 12 +++++------ .../src/lifecycle_manager_node.cpp | 2 +- plansys2_planner/test/unit/planner_test.cpp | 4 ++-- .../test/unit/problem_expert_node_test.cpp | 4 ++-- plansys2_terminal/test/terminal_test.cpp | 14 +++++-------- plansys2_tests/test_1/test_1.cpp | 2 +- plansys2_tests/test_2/test_2.cpp | 2 +- plansys2_tests/test_3/test_3.cpp | 2 +- 9 files changed, 29 insertions(+), 33 deletions(-) diff --git a/plansys2_executor/test/unit/executor_test.cpp b/plansys2_executor/test/unit/executor_test.cpp index e4491a12..42ffe7eb 100644 --- a/plansys2_executor/test/unit/executor_test.cpp +++ b/plansys2_executor/test/unit/executor_test.cpp @@ -225,7 +225,7 @@ TEST(executor, action_executor_client) test_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); aux_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(test_node->get_node_base_interface()); exe.add_node(aux_node->get_node_base_interface()); @@ -314,7 +314,7 @@ TEST(executor, action_executor) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -641,7 +641,7 @@ TEST(executor, action_real_action_1) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -896,7 +896,7 @@ TEST(executor, action_real_action_2) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory4.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory4.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1151,7 +1151,7 @@ TEST(executor, cancel_bt_execution) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1353,7 +1353,7 @@ TEST(executor, executor_client_execute_plan) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1503,7 +1503,7 @@ TEST(executor, executor_client_execute_plan_2) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory4.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory4.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1701,7 +1701,7 @@ TEST(executor, executor_client_ordered_sub_goals) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1844,7 +1844,7 @@ TEST(executor, executor_client_cancel_plan) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory3.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -1987,7 +1987,7 @@ TEST(executor, action_timeout) "action_timeouts.move.duration_overrun_percentage", 1.0); executor_node->set_parameter({"action_timeouts.move.duration_overrun_percentage", 1.0}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_executor/test/unit/simple_btbuilder_tests.cpp b/plansys2_executor/test/unit/simple_btbuilder_tests.cpp index a42abaaf..4a5aa644 100644 --- a/plansys2_executor/test/unit/simple_btbuilder_tests.cpp +++ b/plansys2_executor/test/unit/simple_btbuilder_tests.cpp @@ -153,7 +153,7 @@ TEST(simple_btbuilder_tests, test_plan_1) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -393,7 +393,7 @@ TEST(simple_btbuilder_tests, test_plan_2) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -599,7 +599,7 @@ TEST(simple_btbuilder_tests, test_plan_3) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -690,7 +690,7 @@ TEST(simple_btbuilder_tests, test_plan_4) domain_node->set_parameter({"model_file", pkgpath + "/pddl/cooking_domain.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/cooking_domain.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -807,7 +807,7 @@ TEST(simple_btbuilder_tests, test_plan_5) domain_node->set_parameter({"model_file", pkgpath + "/pddl/road_trip_domain.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/road_trip_domain.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -919,7 +919,7 @@ TEST(simple_btbuilder_tests, test_plan_6) domain_node->set_parameter({"model_file", pkgpath + "/pddl/elevator_domain.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/elevator_domain.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_lifecycle_manager/src/lifecycle_manager_node.cpp b/plansys2_lifecycle_manager/src/lifecycle_manager_node.cpp index f95f8cca..4bdc7b1c 100644 --- a/plansys2_lifecycle_manager/src/lifecycle_manager_node.cpp +++ b/plansys2_lifecycle_manager/src/lifecycle_manager_node.cpp @@ -37,7 +37,7 @@ int main(int argc, char ** argv) manager_nodes["executor"] = std::make_shared( "executor_lc_mngr", "executor"); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; for (auto & manager_node : manager_nodes) { manager_node.second->init(); exe.add_node(manager_node.second); diff --git a/plansys2_planner/test/unit/planner_test.cpp b/plansys2_planner/test/unit/planner_test.cpp index 30fa75bd..1e2a59da 100644 --- a/plansys2_planner/test/unit/planner_test.cpp +++ b/plansys2_planner/test/unit/planner_test.cpp @@ -51,7 +51,7 @@ TEST(planner_expert, generate_plan_good) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -130,7 +130,7 @@ TEST(planner_expert, generate_plan_with_domain_constants) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_constants.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_simple_constants.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_problem_expert/test/unit/problem_expert_node_test.cpp b/plansys2_problem_expert/test/unit/problem_expert_node_test.cpp index a52465b6..db2fafb0 100644 --- a/plansys2_problem_expert/test/unit/problem_expert_node_test.cpp +++ b/plansys2_problem_expert/test/unit/problem_expert_node_test.cpp @@ -52,7 +52,7 @@ TEST(problem_expert_node, addget_instances) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -592,7 +592,7 @@ TEST(problem_expert_node, addget_goal_is_satisfied) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_terminal/test/terminal_test.cpp b/plansys2_terminal/test/terminal_test.cpp index 51c1c382..5732564a 100644 --- a/plansys2_terminal/test/terminal_test.cpp +++ b/plansys2_terminal/test/terminal_test.cpp @@ -277,8 +277,7 @@ TEST_F(TerminalTestCase, load_popf_plugin) domain_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 16, true); - ASSERT_GT(exe.get_number_of_threads(), 15u); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -606,8 +605,7 @@ TEST_F(TerminalTestCase, add_problem) domain_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 16, true); - ASSERT_GT(exe.get_number_of_threads(), 15u); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -721,8 +719,7 @@ TEST_F(TerminalTestCase, add_problem_empty_domain) domain_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 16, true); - ASSERT_GT(exe.get_number_of_threads(), 15u); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -829,7 +826,7 @@ TEST_F(TerminalTestCase, check_actors) domain_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/simple_example.pddl"}); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -977,8 +974,7 @@ TEST_F(TerminalTestCase, source_run_plan) std::string cmd_file = pkgpath + "/pddl/commands"; std::string plan_file = pkgpath + "/pddl/plan"; - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 16, true); - ASSERT_GT(exe.get_number_of_threads(), 15u); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_tests/test_1/test_1.cpp b/plansys2_tests/test_1/test_1.cpp index 94031ff5..0cf19afe 100644 --- a/plansys2_tests/test_1/test_1.cpp +++ b/plansys2_tests/test_1/test_1.cpp @@ -54,7 +54,7 @@ TEST(test_1, test_1) domain_node->set_parameter({"model_file", pkgpath + "/test_1/pddl/test_1.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/test_1/pddl/test_1.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_tests/test_2/test_2.cpp b/plansys2_tests/test_2/test_2.cpp index 7ee16081..ed1ef85a 100644 --- a/plansys2_tests/test_2/test_2.cpp +++ b/plansys2_tests/test_2/test_2.cpp @@ -54,7 +54,7 @@ TEST(test_2, test_2) domain_node->set_parameter({"model_file", pkgpath + "/test_2/pddl/test_2.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/test_2/pddl/test_2.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_tests/test_3/test_3.cpp b/plansys2_tests/test_3/test_3.cpp index 97cbcfbf..7bb378ce 100644 --- a/plansys2_tests/test_3/test_3.cpp +++ b/plansys2_tests/test_3/test_3.cpp @@ -61,7 +61,7 @@ TEST(test_3, test_3) domain_node->set_parameter({"model_file", pkgpath + "/test_3/pddl/test_3.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/test_3/pddl/test_3.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); From 3e00e6b3452f1b9c64f7d70f1f84786b86495310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:43:51 +0100 Subject: [PATCH 3/7] Fix bug in xml tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- plansys2_bt_actions/test/behavior_tree/transport.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plansys2_bt_actions/test/behavior_tree/transport.xml b/plansys2_bt_actions/test/behavior_tree/transport.xml index b0ef13d5..a167117a 100644 --- a/plansys2_bt_actions/test/behavior_tree/transport.xml +++ b/plansys2_bt_actions/test/behavior_tree/transport.xml @@ -1,7 +1,7 @@ - + From f9faf477c395aa288028d43325afecf3841cf386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:44:42 +0100 Subject: [PATCH 4/7] Check if action_map_ is null or don't exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- .../plansys2_executor/behavior_tree/execute_action_node.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plansys2_executor/src/plansys2_executor/behavior_tree/execute_action_node.cpp b/plansys2_executor/src/plansys2_executor/behavior_tree/execute_action_node.cpp index 61214ce9..84ed43e6 100644 --- a/plansys2_executor/src/plansys2_executor/behavior_tree/execute_action_node.cpp +++ b/plansys2_executor/src/plansys2_executor/behavior_tree/execute_action_node.cpp @@ -41,6 +41,10 @@ ExecuteAction::halt() size_t delim = action.find(":"); auto action_expr = action.substr(0, delim); + if (action_map_ == nullptr || (*action_map_)[action].action_executor == nullptr) { + return; + } + if ((*action_map_)[action].action_executor->get_status() == BT::NodeStatus::RUNNING) { (*action_map_)[action].action_executor->cancel(); } From 86329cc6b9ee6fb920068efb2f9339298e6f1a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:45:02 +0100 Subject: [PATCH 5/7] linting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- .../include/plansys2_bt_actions/BTActionNode.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plansys2_bt_actions/include/plansys2_bt_actions/BTActionNode.hpp b/plansys2_bt_actions/include/plansys2_bt_actions/BTActionNode.hpp index d1edc4d8..04992cc8 100644 --- a/plansys2_bt_actions/include/plansys2_bt_actions/BTActionNode.hpp +++ b/plansys2_bt_actions/include/plansys2_bt_actions/BTActionNode.hpp @@ -350,7 +350,7 @@ class BtActionNode : public BT::ActionNodeBase }; send_goal_options.feedback_callback = [this](typename rclcpp_action::ClientGoalHandle::SharedPtr, - const std::shared_ptr feedback) { + const std::shared_ptr feedback) { on_feedback(feedback); }; From 4d8e61c62d95c30a5ba718d3082fcc9bf1c707cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:45:21 +0100 Subject: [PATCH 6/7] Change headers to .hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- .../include/rqt_plansys2_knowledge/RQTKnowledge.hpp | 5 +++-- .../include/rqt_plansys2_performers/RQTPerformers.hpp | 5 +++-- plansys2_tools/include/rqt_plansys2_plan/RQTPlan.hpp | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plansys2_tools/include/rqt_plansys2_knowledge/RQTKnowledge.hpp b/plansys2_tools/include/rqt_plansys2_knowledge/RQTKnowledge.hpp index 791b4b0a..67602fbb 100644 --- a/plansys2_tools/include/rqt_plansys2_knowledge/RQTKnowledge.hpp +++ b/plansys2_tools/include/rqt_plansys2_knowledge/RQTKnowledge.hpp @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. + #ifndef RQT_PLANSYS2_KNOWLEDGE__RQTKNOWLEDGE_HPP_ #define RQT_PLANSYS2_KNOWLEDGE__RQTKNOWLEDGE_HPP_ #include -#include - #include #include @@ -30,6 +29,8 @@ #include #include +#include "rqt_gui_cpp/plugin.hpp" + #include "rqt_plansys2_knowledge/KnowledgeTree.hpp" #include "plansys2_problem_expert/ProblemExpertClient.hpp" diff --git a/plansys2_tools/include/rqt_plansys2_performers/RQTPerformers.hpp b/plansys2_tools/include/rqt_plansys2_performers/RQTPerformers.hpp index 04504861..aefdc147 100644 --- a/plansys2_tools/include/rqt_plansys2_performers/RQTPerformers.hpp +++ b/plansys2_tools/include/rqt_plansys2_performers/RQTPerformers.hpp @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. + #ifndef RQT_PLANSYS2_PERFORMERS__RQTPERFORMERS_HPP_ #define RQT_PLANSYS2_PERFORMERS__RQTPERFORMERS_HPP_ #include -#include - #include #include @@ -31,6 +30,8 @@ #include #include +#include "rqt_gui_cpp/plugin.hpp" + #include "rqt_plansys2_performers/PerformersTree.hpp" #include "plansys2_problem_expert/ProblemExpertClient.hpp" diff --git a/plansys2_tools/include/rqt_plansys2_plan/RQTPlan.hpp b/plansys2_tools/include/rqt_plansys2_plan/RQTPlan.hpp index 48f22e2e..4bba7bde 100644 --- a/plansys2_tools/include/rqt_plansys2_plan/RQTPlan.hpp +++ b/plansys2_tools/include/rqt_plansys2_plan/RQTPlan.hpp @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. + #ifndef RQT_PLANSYS2_PLAN__RQTPLAN_HPP_ #define RQT_PLANSYS2_PLAN__RQTPLAN_HPP_ #include -#include - #include #include @@ -31,6 +30,8 @@ #include #include +#include "rqt_gui_cpp/plugin.hpp" + #include "rqt_plansys2_plan/PlanTree.hpp" #include "plansys2_msgs/msg/plan.hpp" From 645f44a8b4fdaa4ed8464e9f5d6201e3a6350d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 5 Nov 2024 18:45:59 +0100 Subject: [PATCH 7/7] Change to EventsExecutor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- plansys2_executor/test/unit/execution_tree_test.cpp | 6 +++--- plansys2_lifecycle_manager/test/lf_manager_test.cpp | 4 ++-- plansys2_problem_expert/test/unit/utils_test.cpp | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plansys2_executor/test/unit/execution_tree_test.cpp b/plansys2_executor/test/unit/execution_tree_test.cpp index 43cf3eaf..be3f62f6 100644 --- a/plansys2_executor/test/unit/execution_tree_test.cpp +++ b/plansys2_executor/test/unit/execution_tree_test.cpp @@ -51,7 +51,7 @@ TEST(executiotest_noden_tree, bt_builder_factory) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -192,7 +192,7 @@ TEST(executiotest_noden_tree, bt_builder_factory_2) domain_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/factory.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -332,7 +332,7 @@ TEST(executiotest_noden_tree, bt_builder_factory_3) domain_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); problem_node->set_parameter({"model_file", pkgpath + "/pddl/domain_charging.pddl"}); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); diff --git a/plansys2_lifecycle_manager/test/lf_manager_test.cpp b/plansys2_lifecycle_manager/test/lf_manager_test.cpp index 598a2ff6..4e1aa5b2 100644 --- a/plansys2_lifecycle_manager/test/lf_manager_test.cpp +++ b/plansys2_lifecycle_manager/test/lf_manager_test.cpp @@ -33,7 +33,7 @@ TEST(lifecycle_manager, lf_client) auto test_node = rclcpp_lifecycle::LifecycleNode::make_shared("test"); auto client_node = std::make_shared("mng_client", "test"); - auto exe = rclcpp::executors::SingleThreadedExecutor::make_shared(); + auto exe = rclcpp::experimental::executors::EventsExecutor::make_shared(); exe->add_node(test_node->get_node_base_interface()); exe->add_node(client_node->get_node_base_interface()); @@ -97,7 +97,7 @@ TEST(lifecycle_manager, lf_startup) manager_nodes["executor"] = std::make_shared( "domain_expert_lc_mngr", "executor"); - rclcpp::executors::SingleThreadedExecutor exe; + rclcpp::experimental::executors::EventsExecutor exe; for (auto & manager_node : manager_nodes) { manager_node.second->init(); exe.add_node(manager_node.second); diff --git a/plansys2_problem_expert/test/unit/utils_test.cpp b/plansys2_problem_expert/test/unit/utils_test.cpp index e9541476..150af56d 100644 --- a/plansys2_problem_expert/test/unit/utils_test.cpp +++ b/plansys2_problem_expert/test/unit/utils_test.cpp @@ -203,7 +203,7 @@ TEST(utils, evaluate_predicate_client) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -541,7 +541,7 @@ TEST(utils, evaluate_expression_invalid_client) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -696,7 +696,7 @@ TEST(utils, evaluate_function_mod_client) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -787,7 +787,7 @@ TEST(utils, evaluate_function_mod_invalid_client) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface()); exe.add_node(problem_node->get_node_base_interface()); @@ -905,7 +905,7 @@ TEST(utils, evaluate_exists_client) problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); problem_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(problem_node->get_node_base_interface()); @@ -990,7 +990,7 @@ TEST(utils, get_action_from_string) domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); domain_node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - rclcpp::executors::MultiThreadedExecutor exe(rclcpp::ExecutorOptions(), 8); + rclcpp::experimental::executors::EventsExecutor exe; exe.add_node(domain_node->get_node_base_interface());