pycram.world_concepts.constraints
=================================

.. py:module:: pycram.world_concepts.constraints


Classes
-------

.. autoapisummary::

   pycram.world_concepts.constraints.AbstractConstraint
   pycram.world_concepts.constraints.Constraint
   pycram.world_concepts.constraints.Attachment


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

.. py:class:: AbstractConstraint(parent_link: pycram.description.Link, child_link: pycram.description.Link, _type: pycram.datastructures.enums.JointType, parent_to_constraint: pycram.datastructures.pose.TransformStamped, child_to_constraint: pycram.datastructures.pose.TransformStamped)

   Represents an abstract constraint concept, this could be used to create joints for example or any kind of constraint
   between two links in the world.


   .. py:attribute:: parent_link
      :type:  pycram.description.Link


   .. py:attribute:: child_link
      :type:  pycram.description.Link


   .. py:attribute:: type
      :type:  pycram.datastructures.enums.JointType


   .. py:attribute:: parent_to_constraint


   .. py:attribute:: child_to_constraint


   .. py:attribute:: _parent_to_child
      :value: None



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

      :return: The pose of the child object.



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

      Get the pose of the child object given the parent pose.

      :param pose: The parent object pose.
      :return: The pose of the child object.



   .. py:method:: set_child_link_pose()

      Set the target pose of the child object to the current pose of the child object in the parent object frame.



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

      :return: The target pose of the child object. (The pose of the child object in the parent object frame)



   .. py:method:: get_child_link_target_pose_given_parent(parent_pose: pycram.datastructures.pose.PoseStamped) -> pycram.datastructures.pose.PoseStamped

      Get the target pose of the child object link given the parent link pose.

      :param parent_pose: The parent link pose.
      :return: The target pose of the child object link.



   .. py:property:: parent_to_child_transform
      :type: pycram.datastructures.pose.TransformStamped


      Return the transform from the parent link to the child link of the constraint.

      :return: The transform from the parent link to the child link of the constraint.



   .. py:property:: parent_object_id
      :type: int


      :return: The id of the parent object of the constraint



   .. py:property:: child_object_id
      :type: int


      :return: The id of the child object of the constraint



   .. py:property:: parent_link_id
      :type: int


      :return: The id of the parent link of the constraint



   .. py:property:: child_link_id
      :type: int


      :return: The id of the child link of the constraint



   .. py:property:: position_wrt_parent_as_list
      :type: typing_extensions.List[float]


      :return: The constraint frame pose with respect to the parent origin as a list



   .. py:property:: orientation_wrt_parent_as_list
      :type: typing_extensions.List[float]


      :return: The constraint frame orientation with respect to the parent origin as a list



   .. py:property:: pose_wrt_parent
      :type: pycram.datastructures.pose.PoseStamped


      :return: The joint frame pose with respect to the parent origin



   .. py:property:: position_wrt_child_as_list
      :type: typing_extensions.List[float]


      :return: The constraint frame pose with respect to the child origin as a list



   .. py:property:: orientation_wrt_child_as_list
      :type: typing_extensions.List[float]


      :return: The constraint frame orientation with respect to the child origin as a list



   .. py:property:: pose_wrt_child
      :type: pycram.datastructures.pose.PoseStamped


      :return: The joint frame pose with respect to the child origin



.. py:class:: Constraint(parent_link: pycram.description.Link, child_link: pycram.description.Link, _type: pycram.datastructures.enums.JointType, axis_in_child_frame: pycram.datastructures.pose.Point, constraint_to_parent: pycram.datastructures.pose.TransformStamped, child_to_constraint: pycram.datastructures.pose.TransformStamped)

   Bases: :py:obj:`AbstractConstraint`


   Represents a constraint between two links in the World.


   .. py:attribute:: axis
      :type:  pycram.datastructures.pose.Point


   .. py:property:: axis_as_list
      :type: typing_extensions.List[float]


      :return: The axis of this constraint as a list of xyz



.. py:class:: Attachment(parent_link: pycram.description.Link, child_link: pycram.description.Link, bidirectional: bool = False, parent_to_child_transform: typing_extensions.Optional[pycram.datastructures.pose.TransformStamped] = None, constraint_id: typing_extensions.Optional[int] = None, is_inverse: bool = False)

   Bases: :py:obj:`AbstractConstraint`


   Represents an abstract constraint concept, this could be used to create joints for example or any kind of constraint
   between two links in the world.


   .. py:attribute:: id
      :value: None



   .. py:attribute:: bidirectional
      :type:  bool
      :value: False



   .. py:attribute:: _loose
      :type:  bool
      :value: False



   .. py:attribute:: is_inverse
      :type:  bool
      :value: False



   .. py:property:: parent_object


   .. py:property:: child_object


   .. py:method:: update_transform_and_constraint() -> None

      Update the transform and constraint of this attachment.



   .. py:method:: update_transform() -> None

      Update the transform of this attachment by calculating the transform from the parent link to the child link.



   .. py:method:: update_constraint() -> None

      Update the constraint of this attachment by removing the old constraint if one exists and adding a new one.



   .. py:method:: add_fixed_constraint() -> None

      Add a fixed constraint between the parent link and the child link.



   .. py:method:: calculate_transform() -> pycram.datastructures.pose.TransformStamped

      Calculate the transform from the parent link to the child link.



   .. py:method:: remove_constraint_if_exists() -> None

      Remove the constraint between the parent and the child links if one exists.



   .. py:method:: get_inverse() -> Attachment

      :return: A new Attachment object with the parent and child links swapped.



   .. py:property:: loose
      :type: bool


      If true, then the child object will not move when parent moves.



   .. py:method:: __del__() -> None

      Remove the constraint between the parent and the child links if one exists when the attachment is deleted.



   .. py:method:: __copy__()


   .. py:method:: __eq__(other)


   .. py:method:: __hash__()


