From ed0278012fda03b9fc46bb880886f44d91091547 Mon Sep 17 00:00:00 2001 From: ktyang512 Date: Mon, 17 Aug 2026 19:04:19 +0900 Subject: [PATCH] Fix execution test setup and preemption Pass the controller configuration through the spawner, reuse the executor that already owns the action client node while canceling, and only assert the test process exit code. --- capabilities/test/test_execution.launch.py | 7 ++++--- core/src/task.cpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/capabilities/test/test_execution.launch.py b/capabilities/test/test_execution.launch.py index d6e619b3c..efd7ad7ca 100644 --- a/capabilities/test/test_execution.launch.py +++ b/capabilities/test/test_execution.launch.py @@ -73,6 +73,8 @@ def generate_test_description(): arguments=[ "panda_arm_controller", "joint_state_broadcaster", + "--param-file", + ros2_controllers_path, "--controller-manager", "/controller_manager", ], @@ -119,6 +121,5 @@ def test_gtest_run_complete(self, proc_info, test_exec): @launch_testing.post_shutdown_test() class TaskModelTestAfterShutdown(unittest.TestCase): - def test_exit_code(self, proc_info): - # Check that all processes in the launch exit with code 0 - launch_testing.asserts.assertExitCodes(proc_info) + def test_exit_code(self, proc_info, test_exec): + launch_testing.asserts.assertExitCodes(proc_info, process=test_exec) diff --git a/core/src/task.cpp b/core/src/task.cpp index c319c78ca..7dc14fb1e 100644 --- a/core/src/task.cpp +++ b/core/src/task.cpp @@ -318,8 +318,7 @@ moveit::core::MoveItErrorCode Task::execute(const SolutionBase& s) { if (pimpl()->preempt_requested_) { auto cancel_future = execute_ac_->async_cancel_goal(goal_handle); this->resetPreemptRequest(); - if (rclcpp::spin_until_future_complete(execute_solution_node_, cancel_future) != - rclcpp::FutureReturnCode::SUCCESS) { + if (executor.spin_until_future_complete(cancel_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(execute_solution_node_->get_logger(), "Could not preempt execution"); return error_code; } else {