robokudo.utils.query ==================== .. py:module:: robokudo.utils.query Classes ------- .. autoapisummary:: robokudo.utils.query.QueryAttributeMatcher robokudo.utils.query.ObjectHypothesisQueryMatcher robokudo.utils.query.QueryHandler Module Contents --------------- .. py:class:: QueryAttributeMatcher Connect an ObjectDesignator field extractor with its matcher. .. py:attribute:: requested_values :type: collections.abc.Callable[[robokudo_msgs.msg.ObjectDesignator], typing_extensions.Any] Function that extracts requested values from an ObjectDesignator. .. py:attribute:: matches :type: collections.abc.Callable[[robokudo.types.scene.ObjectHypothesis, typing_extensions.Any], bool] Function that checks if an ObjectHypothesis satisfies the requested values. .. py:class:: ObjectHypothesisQueryMatcher Match ObjectHypotheses against requested ObjectDesignator attributes. .. py:attribute:: query_matchers .. py:method:: normalize_query_value(value: typing_extensions.Any) -> str :staticmethod: Normalize string-like query values for robust comparisons. .. py:method:: normalized_values(values: typing_extensions.Any) -> set[str] :classmethod: Return normalized, non-empty string values from scalar or sequence input. .. py:method:: value_variants(value: typing_extensions.Any) -> list[typing_extensions.Any] :staticmethod: Return common string-like representations for semantic names. .. py:method:: any_requested_value_matches(requested_values: typing_extensions.Any, candidate_values: list[typing_extensions.Any]) -> bool :classmethod: Return true if any requested value matches any candidate value. .. py:method:: matches(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_object: robokudo_msgs.msg.ObjectDesignator) -> bool Return true if an object hypothesis satisfies all supported query fields. .. py:method:: matches_uid(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match an ObjectDesignator uid request against the object hypothesis id. .. py:method:: matches_type(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match requested object type against Classification annotations. .. py:method:: matches_shape(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match requested shapes against shape annotations. .. py:method:: matches_color(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match requested colors against SemanticColor annotations. .. py:method:: matches_location(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match requested location against LocationAnnotation annotations. .. py:method:: matches_attribute(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match generic requested attributes against known annotation fields. .. py:method:: matches_size(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match semantic size requests against bounding-box dimensions. .. py:method:: matches_description(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) -> bool Match generic requested descriptions against classification labels. .. py:class:: QueryHandler Bases: :py:obj:`object` QueryHandler provides an interface to interact with the ROS Action-based query interface. This wrapper eases the use of the various Blackboard variables devoted to the communication with the query interface. .. py:method:: init_feedback_queue() -> None :staticmethod: Initializes the feedback queue on the Blackboard. .. py:method:: get_feedback_queue() -> queue.Queue :staticmethod: Retrieves and returns the feedback queue from the Blackboard. .. py:method:: send_feedback(feedback: robokudo_msgs.action.Query.Feedback) -> None :staticmethod: Add a feedback part of the Query msg to the feedback queue, ready to be sent. :param feedback: The feedback message to send. .. py:method:: send_feedback_str(feedback_str: str) -> None :staticmethod: Add a simple string to the feedback to the feedback queue, ready to be sent. :param feedback_str: The string to send as feedback. .. py:method:: send_answer(result: robokudo_msgs.action.Query.Result) -> None :staticmethod: Raise a standard RoboKudo Query Result as a query answer to the blackboard. :param result: The result to raise to the blackboard. .. py:method:: send_arbitrary_answer(result: typing_extensions.Any) -> None :staticmethod: Raise any data as a query answer to the blackboard. :param result: The data to raise to the blackboard. .. py:method:: preempt_requested() -> bool :staticmethod: Checks whether a preempt request is pending on the blackboard. :return: True if a preempt request is pending, False otherwise. .. py:method:: acknowledge_preempt_request() -> None :staticmethod: Acknowledges the preempt request on the blackboard.