File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 3131import sys
3232import time
3333import unittest
34+ import logging
3435
3536import pytest
3637
@@ -131,10 +132,20 @@ def test_deactivate_controller_aborts_action(self):
131132 deactivate_controllers = ["tool_contact_controller" ],
132133 ).ok
133134 )
134- # Wait for action to finish
135- self ._tool_contact_interface .get_result (goal_handle , 5 )
136- # Check status of goal handle, as result does not contain information about the status of the action. Only the empty result definition.
137- self .assertEqual (goal_handle ._status , GoalStatus .STATUS_ABORTED )
135+ future_res = goal_handle .get_result_async ()
136+
137+ timeout = 5.0
138+ logging .info ("Waiting for action result from controller with timeout %fs" , timeout )
139+ rclpy .spin_until_future_complete (self .node , future_res , timeout_sec = timeout )
140+
141+ if future_res .result () is not None :
142+ logging .info (" Received result: %s" , future_res .result ().result )
143+ # Check status of goal handle, as result does not contain information about the status of the action. Only the empty result definition.
144+ self .assertEqual (future_res .result ().status , GoalStatus .STATUS_ABORTED )
145+ else :
146+ raise Exception (
147+ f"Exception while calling action '{ self .__action_name } ': { future_res .exception ()} "
148+ )
138149
139150 def test_inactive_controller_rejects_actions (self ):
140151 self .assertTrue (
You can’t perform that action at this time.
0 commit comments