robokudo.utils.query

Classes

QueryAttributeMatcher

Connect an ObjectDesignator field extractor with its matcher.

ObjectHypothesisQueryMatcher

Match ObjectHypotheses against requested ObjectDesignator attributes.

QueryHandler

QueryHandler provides an interface to interact with the ROS Action-based query

Module Contents

class robokudo.utils.query.QueryAttributeMatcher

Connect an ObjectDesignator field extractor with its matcher.

requested_values: collections.abc.Callable[[robokudo_msgs.msg.ObjectDesignator], typing_extensions.Any]

Function that extracts requested values from an ObjectDesignator.

matches: collections.abc.Callable[[robokudo.types.scene.ObjectHypothesis, typing_extensions.Any], bool]

Function that checks if an ObjectHypothesis satisfies the requested values.

class robokudo.utils.query.ObjectHypothesisQueryMatcher

Match ObjectHypotheses against requested ObjectDesignator attributes.

query_matchers
static normalize_query_value(value: typing_extensions.Any) str

Normalize string-like query values for robust comparisons.

classmethod normalized_values(values: typing_extensions.Any) set[str]

Return normalized, non-empty string values from scalar or sequence input.

static value_variants(value: typing_extensions.Any) list[typing_extensions.Any]

Return common string-like representations for semantic names.

classmethod any_requested_value_matches(requested_values: typing_extensions.Any, candidate_values: list[typing_extensions.Any]) bool

Return true if any requested value matches any candidate value.

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.

matches_uid(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match an ObjectDesignator uid request against the object hypothesis id.

matches_type(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match requested object type against Classification annotations.

matches_shape(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match requested shapes against shape annotations.

matches_color(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match requested colors against SemanticColor annotations.

matches_location(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match requested location against LocationAnnotation annotations.

matches_attribute(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match generic requested attributes against known annotation fields.

matches_size(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match semantic size requests against bounding-box dimensions.

matches_description(object_hypothesis: robokudo.types.scene.ObjectHypothesis, requested_values: typing_extensions.Any) bool

Match generic requested descriptions against classification labels.

class robokudo.utils.query.QueryHandler

Bases: 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.

static init_feedback_queue() None

Initializes the feedback queue on the Blackboard.

static get_feedback_queue() queue.Queue

Retrieves and returns the feedback queue from the Blackboard.

static send_feedback(feedback: robokudo_msgs.action.Query.Feedback) None

Add a feedback part of the Query msg to the feedback queue, ready to be sent.

Parameters:

feedback – The feedback message to send.

static send_feedback_str(feedback_str: str) None

Add a simple string to the feedback to the feedback queue, ready to be sent.

Parameters:

feedback_str – The string to send as feedback.

static send_answer(result: robokudo_msgs.action.Query.Result) None

Raise a standard RoboKudo Query Result as a query answer to the blackboard.

Parameters:

result – The result to raise to the blackboard.

static send_arbitrary_answer(result: typing_extensions.Any) None

Raise any data as a query answer to the blackboard.

Parameters:

result – The data to raise to the blackboard.

static preempt_requested() bool

Checks whether a preempt request is pending on the blackboard.

Returns:

True if a preempt request is pending, False otherwise.

static acknowledge_preempt_request() None

Acknowledges the preempt request on the blackboard.