predicates#
Classes#
Base class for predicates that check the gripper occupancy. |
|
Checks if the gripper is holding something. |
|
Checks if the gripper is free at the moment, so it can be used to grab something. |
Module Contents#
- class predicates.GripperOccupancy#
Base class for predicates that check the gripper occupancy.
- end_effector: semantic_digital_twin.robots.robot_parts.EndEffector#
Semantic annotation for the gripper that should be evaluated.
- check_man_occupancy(condition: Callable[List[semantic_digital_twin.world_description.world_entity.Body], bool]) bool#
Checks the occupancy of the gripper against a condition.
The condition get the list of bodies that are under the TCP in the kinematic structure and returns a boolean.
- Parameters:
condition – The condition that should be evaluated.
- Returns:
True if the condition is satisfied, False otherwise.
- class predicates.GripperIsFree#
Bases:
GripperOccupancy,krrood.entity_query_language.predicate.PredicateChecks if the gripper is holding something.
Checks this by looking at the kinematic structure of the end_effector.
- __call__() bool#
Evaluate the predicate for the supplied values.
- classmethod _verbalization_fragment_(fields)#
Structured verbalization for this predicate — a required clause (no string fallback).
Build the clause from the typed part-of-speech vocabulary (
clause()withNoun/Verb/Copula/Prepositions/Adjective), composing the already-rendered field fragments in fields (keyed by field name). State only the affirmative, present-tense form: aVerbis given as its lemma, and the realisation passes inflect it (“work” → “works”) and agree its number. Returning a typed clause rather than a string keeps the predicate composable — a wrappingNotnegates it automatically (a verb with do-support, “does not love”; a copula with suppletion, “is not reachable”) and coreference still reduces the operands.- ..note:: Abstract, so every concrete predicate must supply a clause; a missing implementation
fails at (concrete) instantiation rather than only when the predicate is verbalized.
Example:
@dataclass(eq=False) class Loves(Predicate): person_1: Person person_2: Person @classmethod def _verbalization_fragment_(cls, fields): return clause(Noun(fields["person_1"]), Verb("love"), Noun(fields["person_2"]))
- Parameters:
fields – The rendered fragment for each predicate field, keyed by field name.
- Returns:
The predicate’s verbalization fragment.
- class predicates.GripperIsNotFree#
Bases:
GripperOccupancy,krrood.entity_query_language.predicate.PredicateChecks if the gripper is free at the moment, so it can be used to grab something.
This is checked by looking at the kinematic structure.
- __call__() bool#
Evaluate the predicate for the supplied values.
- classmethod _verbalization_fragment_(fields)#
Structured verbalization for this predicate — a required clause (no string fallback).
Build the clause from the typed part-of-speech vocabulary (
clause()withNoun/Verb/Copula/Prepositions/Adjective), composing the already-rendered field fragments in fields (keyed by field name). State only the affirmative, present-tense form: aVerbis given as its lemma, and the realisation passes inflect it (“work” → “works”) and agree its number. Returning a typed clause rather than a string keeps the predicate composable — a wrappingNotnegates it automatically (a verb with do-support, “does not love”; a copula with suppletion, “is not reachable”) and coreference still reduces the operands.- ..note:: Abstract, so every concrete predicate must supply a clause; a missing implementation
fails at (concrete) instantiation rather than only when the predicate is verbalized.
Example:
@dataclass(eq=False) class Loves(Predicate): person_1: Person person_2: Person @classmethod def _verbalization_fragment_(cls, fields): return clause(Noun(fields["person_1"]), Verb("love"), Noun(fields["person_2"]))
- Parameters:
fields – The rendered fragment for each predicate field, keyed by field name.
- Returns:
The predicate’s verbalization fragment.