pycram.designator#

Exceptions#

DesignatorError

Implementation of designator_description errors.

ResolutionError

Common base class for all non-exit exceptions.

Classes#

DesignatorDescription

ActionDescription

The performable designator_description with a single element for each list of possible parameter.

LocationDesignatorDescription

Parent class of location designator_description descriptions.

ObjectDesignatorDescription

Class for object designator_description descriptions.

BaseMotion

Helper class that provides a standard way to create an ABC using

Module Contents#

exception pycram.designator.DesignatorError(*args, **kwargs)#

Bases: Exception

Implementation of designator_description errors.

exception pycram.designator.ResolutionError(missing_properties: typing_extensions.List[str], wrong_type: typing_extensions.Dict, current_type: typing_extensions.Any, designator: DesignatorDescription)#

Bases: Exception

Common base class for all non-exit exceptions.

error = Multiline-String#
Show Value
"""
Some required properties where missing or had the wrong type when grounding the Designator: Uninferable.
"""
missing = Multiline-String#
Show Value
"""The missing properties where: Uninferable
"""
wrong = Multiline-String#
Show Value
"""The properties with the wrong type along with the current -and right type :
"""
head = Multiline-String#
Show Value
"""Property   |   Current Type    |     Right Type
-------------------------------------------------------------
"""
tab = ''#
message = Multiline-String#
Show Value
"""
Some required properties where missing or had the wrong type when grounding the Designator: Uninferable.
"""
class pycram.designator.DesignatorDescription#
Variables:

resolve – The specialized_designators function to use for this designator_description, defaults to self.ground

resolve()#
make_dictionary(properties: typing_extensions.List[str])#

Creates a dictionary of this description with only the given properties included.

Parameters:

properties – A list of properties that should be included in the dictionary. The given properties have to be an attribute of this description.

Returns:

A dictionary with the properties as keys.

ground() typing_extensions.Any#

Should be overwritten with an actual grounding function which infers missing properties.

get_slots() typing_extensions.List[str]#
Returns:

a list of all slots of this description. Can be used for inspecting different descriptions and debugging.

copy() DesignatorDescription#
get_optional_parameter() typing_extensions.List[str]#

Returns a list of optional parameter names of this designator_description description.

get_all_parameter() typing_extensions.List[str]#

Returns a list of all parameter names of this designator_description description.

classmethod get_type_hints() typing_extensions.Dict[str, typing_extensions.Any]#

Returns the type hints of the __init__ method of this designator_description description.

Returns:

class pycram.designator.ActionDescription#

Bases: pycram.has_parameters.HasParameters

The performable designator_description with a single element for each list of possible parameter.

robot_position: pycram.datastructures.pose.PoseStamped#

The position of the robot at the start of the action.

robot_torso_height: float#

The torso height of the robot at the start of the action.

_robot_type: typing_extensions.Type[pycrap.ontologies.Agent]#

The type of the robot at the start of the action.

_pre_perform_callbacks = []#

List of callback functions that will be called before the action is performed.

_post_perform_callbacks = []#

List of callback functions that will be called after the action is performed.

__post_init__()#
perform() typing_extensions.Any#

Executes the action with the single parameters from the description.

Returns:

The result of the action in the plan

abstract plan() typing_extensions.Any#

Plan of the action. To be overridden by subclasses.

Returns:

The result of the action, if there is any

abstract validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#

Validate the action after performing it, by checking if the action effects are as expected.

Parameters:
  • result – The result of the action if there is any

  • max_wait_time – The maximum time to wait for the action to be validated, before raising an error.

classmethod get_type_hints(localns=None) typing_extensions.Dict[str, typing_extensions.Any]#

Returns the type hints of the __init__ method of this designator_description description.

Returns:

classmethod pre_perform(func) typing_extensions.Callable#

Decorator to execute the decorated function before performing the action.

Parameters:

func – The function to be decorated.

Returns:

The decorated function.

classmethod post_perform(func) typing_extensions.Callable#

Decorator to execute the decorated function after performing the action.

Parameters:

func – The function to be decorated.

Returns:

The decorated function.

classmethod description(*args, **kwargs) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Self]#
Abstractmethod:

__str__()#
__repr__()#
_update_robot_params(action: ActionDescription)#
class pycram.designator.LocationDesignatorDescription#

Bases: DesignatorDescription, pycram.datastructures.partial_designator.PartialDesignator

Parent class of location designator_description descriptions.

abstract ground() pycram.datastructures.pose.PoseStamped#

Find a location that satisfies all constrains.

class pycram.designator.ObjectDesignatorDescription(names: typing_extensions.Optional[typing_extensions.List[str]] = None, types: typing_extensions.Optional[typing_extensions.List[typing_extensions.Type[pycrap.ontologies.PhysicalObject]]] = None)#

Bases: DesignatorDescription, pycram.datastructures.partial_designator.PartialDesignator

Class for object designator_description descriptions. Descriptions hold possible parameter ranges for object designators.

types: typing_extensions.Optional[typing_extensions.List[pycram.datastructures.enums.ObjectType]] = None#
names: typing_extensions.Optional[typing_extensions.List[str]] = None#
ground() pycram.world_concepts.world_object.Object#

Return the first object from the world that fits the description.

Returns:

A executed object designator_description

__iter__() typing_extensions.Iterator[pycram.world_concepts.world_object.Object]#

Iterate through all possible objects fitting this description

Yield:

A executed object designator_description

flatten() typing_extensions.List#
class pycram.designator.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong