pycram.designator
=================

.. py:module:: pycram.designator


Exceptions
----------

.. autoapisummary::

   pycram.designator.DesignatorError
   pycram.designator.ResolutionError


Classes
-------

.. autoapisummary::

   pycram.designator.DesignatorDescription
   pycram.designator.ActionDescription
   pycram.designator.LocationDesignatorDescription
   pycram.designator.ObjectDesignatorDescription
   pycram.designator.BaseMotion


Module Contents
---------------

.. py:exception:: DesignatorError(*args, **kwargs)

   Bases: :py:obj:`Exception`


   Implementation of designator_description errors.


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

   Bases: :py:obj:`Exception`


   Common base class for all non-exit exceptions.


   .. py:attribute:: error
      :value: Multiline-String

      .. raw:: html

         <details><summary>Show Value</summary>

      .. code-block:: python

         """
         Some required properties where missing or had the wrong type when grounding the Designator: Uninferable.
         """

      .. raw:: html

         </details>




   .. py:attribute:: missing
      :value: Multiline-String

      .. raw:: html

         <details><summary>Show Value</summary>

      .. code-block:: python

         """The missing properties where: Uninferable
         """

      .. raw:: html

         </details>




   .. py:attribute:: wrong
      :value: Multiline-String

      .. raw:: html

         <details><summary>Show Value</summary>

      .. code-block:: python

         """The properties with the wrong type along with the current -and right type :
         """

      .. raw:: html

         </details>




   .. py:attribute:: head
      :value: Multiline-String

      .. raw:: html

         <details><summary>Show Value</summary>

      .. code-block:: python

         """Property   |   Current Type    |     Right Type
         -------------------------------------------------------------
         """

      .. raw:: html

         </details>




   .. py:attribute:: tab
      :value: ''



   .. py:attribute:: message
      :value: Multiline-String

      .. raw:: html

         <details><summary>Show Value</summary>

      .. code-block:: python

         """
         Some required properties where missing or had the wrong type when grounding the Designator: Uninferable.
         """

      .. raw:: html

         </details>




.. py:class:: DesignatorDescription

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


   .. py:method:: resolve()


   .. py:method:: make_dictionary(properties: typing_extensions.List[str])

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

      :param properties: A list of properties that should be included in the dictionary.
                          The given properties have to be an attribute of this description.
      :return: A dictionary with the properties as keys.



   .. py:method:: ground() -> typing_extensions.Any

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



   .. py:method:: get_slots() -> typing_extensions.List[str]

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



   .. py:method:: copy() -> DesignatorDescription


   .. py:method:: get_optional_parameter() -> typing_extensions.List[str]

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



   .. py:method:: get_all_parameter() -> typing_extensions.List[str]

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



   .. py:method:: get_type_hints() -> typing_extensions.Dict[str, typing_extensions.Any]
      :classmethod:


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

      :return:



.. py:class:: ActionDescription

   Bases: :py:obj:`pycram.has_parameters.HasParameters`


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


   .. py:attribute:: robot_position
      :type:  pycram.datastructures.pose.PoseStamped

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



   .. py:attribute:: robot_torso_height
      :type:  float

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



   .. py:attribute:: _robot_type
      :type:  typing_extensions.Type[pycrap.ontologies.Agent]

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



   .. py:attribute:: _pre_perform_callbacks
      :value: []


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



   .. py:attribute:: _post_perform_callbacks
      :value: []


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



   .. py:method:: __post_init__()


   .. py:method:: perform() -> typing_extensions.Any

      Executes the action with the single parameters from the description.

      :return: The result of the action in the plan



   .. py:method:: plan() -> typing_extensions.Any
      :abstractmethod:


      Plan of the action. To be overridden by subclasses.

      :return: The result of the action, if there is any



   .. py:method:: validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)
      :abstractmethod:


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

      :param result: The result of the action if there is any
      :param max_wait_time: The maximum time to wait for the action to be validated, before raising an error.



   .. py:method:: get_type_hints(localns=None) -> typing_extensions.Dict[str, typing_extensions.Any]
      :classmethod:


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

      :return:



   .. py:method:: pre_perform(func) -> typing_extensions.Callable
      :classmethod:


      Decorator to execute the decorated function before performing the action.

      :param func: The function to be decorated.
      :return: The decorated function.



   .. py:method:: post_perform(func) -> typing_extensions.Callable
      :classmethod:


      Decorator to execute the decorated function after performing the action.

      :param func: The function to be decorated.
      :return: The decorated function.



   .. py:method:: description(*args, **kwargs) -> pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Self]
      :classmethod:

      :abstractmethod:



   .. py:method:: __str__()


   .. py:method:: __repr__()


   .. py:method:: _update_robot_params(action: ActionDescription)


.. py:class:: LocationDesignatorDescription

   Bases: :py:obj:`DesignatorDescription`, :py:obj:`pycram.datastructures.partial_designator.PartialDesignator`


   Parent class of location designator_description descriptions.


   .. py:method:: ground() -> pycram.datastructures.pose.PoseStamped
      :abstractmethod:


      Find a location that satisfies all constrains.



.. py:class:: 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: :py:obj:`DesignatorDescription`, :py:obj:`pycram.datastructures.partial_designator.PartialDesignator`


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


   .. py:attribute:: types
      :type:  typing_extensions.Optional[typing_extensions.List[pycram.datastructures.enums.ObjectType]]
      :value: None



   .. py:attribute:: names
      :type:  typing_extensions.Optional[typing_extensions.List[str]]
      :value: None



   .. py:method:: ground() -> pycram.world_concepts.world_object.Object

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

      :return: A executed object designator_description



   .. py:method:: __iter__() -> typing_extensions.Iterator[pycram.world_concepts.world_object.Object]

      Iterate through all possible objects fitting this description

      :yield: A executed object designator_description



   .. py:method:: flatten() -> typing_extensions.List


.. py:class:: BaseMotion

   Bases: :py:obj:`abc.ABC`


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


   .. py:method:: perform()
      :abstractmethod:


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



   .. py:method:: __post_init__()

      Checks if types are missing or wrong



