async def _execute_get_result_request(self, request_header_and_message): request_header, result_request = request_header_and_message goal_uuid = result_request.goal_id.uuid self._node.get_logger().debug( 'Result request received for goal with ID: {0}'.format(goal_uuid)) # If no goal with the requested ID exists, then return UNKNOWN status if bytes(goal_uuid) not in self._goal_handles: self._node.get_logger().debug( 'Sending result response for unknown goal ID: {0}'.format( goal_uuid)) result_response = self._action_type.Impl.GetResultService.Response( ) result_response.status = GoalStatus.STATUS_UNKNOWN _rclpy_action.rclpy_action_send_result_response( self._handle, request_header, result_response, ) return # There is an accepted goal matching the goal ID, register a callback to send the # response as soon as it's ready self._goal_handles[bytes(goal_uuid)]._result_future.add_done_callback( functools.partial(self._send_result_response, request_header))
def _send_result_response(self, request_header, future): _rclpy_action.rclpy_action_send_result_response( self._handle, request_header, future.result(), )