pycram.datastructures.dataclasses
=================================

.. py:module:: pycram.datastructures.dataclasses


Attributes
----------

.. autoapisummary::

   pycram.datastructures.dataclasses.VisualShapeUnion
   pycram.datastructures.dataclasses.ClosestPoint
   pycram.datastructures.dataclasses.ClosestPointsList


Classes
-------

.. autoapisummary::

   pycram.datastructures.dataclasses.ManipulatorData
   pycram.datastructures.dataclasses.Color
   pycram.datastructures.dataclasses.Colors
   pycram.datastructures.dataclasses.BoundingBox
   pycram.datastructures.dataclasses.AxisAlignedBoundingBox
   pycram.datastructures.dataclasses.RotatedBoundingBox
   pycram.datastructures.dataclasses.CollisionCallbacks
   pycram.datastructures.dataclasses.MultiBody
   pycram.datastructures.dataclasses.VisualShape
   pycram.datastructures.dataclasses.BoxVisualShape
   pycram.datastructures.dataclasses.SphereVisualShape
   pycram.datastructures.dataclasses.CapsuleVisualShape
   pycram.datastructures.dataclasses.CylinderVisualShape
   pycram.datastructures.dataclasses.MeshVisualShape
   pycram.datastructures.dataclasses.PlaneVisualShape
   pycram.datastructures.dataclasses.State
   pycram.datastructures.dataclasses.PhysicalBodyState
   pycram.datastructures.dataclasses.LinkState
   pycram.datastructures.dataclasses.JointState
   pycram.datastructures.dataclasses.ObjectState
   pycram.datastructures.dataclasses.WorldState
   pycram.datastructures.dataclasses.LateralFriction
   pycram.datastructures.dataclasses.ContactPoint
   pycram.datastructures.dataclasses.ContactPointsList
   pycram.datastructures.dataclasses.TextAnnotation
   pycram.datastructures.dataclasses.VirtualJoint
   pycram.datastructures.dataclasses.Rotations
   pycram.datastructures.dataclasses.VirtualMobileBaseJoints
   pycram.datastructures.dataclasses.MultiverseMetaData
   pycram.datastructures.dataclasses.RayResult
   pycram.datastructures.dataclasses.MultiverseRayResult
   pycram.datastructures.dataclasses.MultiverseContactPoint
   pycram.datastructures.dataclasses.ReasoningResult
   pycram.datastructures.dataclasses.FrozenObject
   pycram.datastructures.dataclasses.FrozenLink
   pycram.datastructures.dataclasses.FrozenJoint


Functions
---------

.. autoapisummary::

   pycram.datastructures.dataclasses.get_point_as_list


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

.. py:class:: ManipulatorData

   A dataclass for storing the information of a manipulator that is used for creating a robot description for that
   manipulator. A manipulator is an Arm with an end-effector that can be used to interact with the environment.


   .. py:attribute:: name
      :type:  str

      Name of the Manipulator.



   .. py:attribute:: base_link
      :type:  str

      Manipulator's base link.



   .. py:attribute:: arm_end_link
      :type:  str

      Manipulator's arm end link.



   .. py:attribute:: joint_names
      :type:  typing_extensions.List[str]

      List of joint names.



   .. py:attribute:: home_joint_values
      :type:  typing_extensions.List[float]

      List of joint values for the home position. (default position)



   .. py:attribute:: gripper_name
      :type:  str

      Name of the gripper at the end of the arm.



   .. py:attribute:: gripper_tool_frame
      :type:  str

      Name of the frame of the gripper tool.



   .. py:attribute:: gripper_joint_names
      :type:  typing_extensions.List[str]

      List of gripper joint names.



   .. py:attribute:: closed_joint_values
      :type:  typing_extensions.List[float]

      List of joint values for the gripper in the closed position.



   .. py:attribute:: open_joint_values
      :type:  typing_extensions.List[float]

      List of joint values for the gripper in the open position.



   .. py:attribute:: opening_distance
      :type:  float

      The opening distance of the gripper.



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


      List of link names for the fingers of the gripper.



   .. py:attribute:: relative_dir
      :type:  str
      :value: ''


      Relative directory of the manipulator description file in the resources directory.



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


      Gripper command topic in ROS if it has one.



   .. py:attribute:: gripper_open_cmd_value
      :type:  typing_extensions.Optional[float]
      :value: None


      Grip open command value.



   .. py:attribute:: gripper_close_cmd_value
      :type:  typing_extensions.Optional[float]
      :value: None


      Grip close command value.



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


      Relative directory of the gripper description file in the resources directory if it has one and is not part of the
       manipulator description file.



.. py:function:: get_point_as_list(point: pycram.datastructures.pose.Point) -> typing_extensions.List[float]

   Return the point as a list.

   :param point: The point.
   :return: The point as a list


.. py:class:: Color

   Dataclass for storing rgba_color as an RGBA value.
   The values are stored as floats between 0 and 1.
   The default rgba_color is white. 'A' stands for the opacity.


   .. py:attribute:: R
      :type:  float
      :value: 1



   .. py:attribute:: G
      :type:  float
      :value: 1



   .. py:attribute:: B
      :type:  float
      :value: 1



   .. py:attribute:: A
      :type:  float
      :value: 1



   .. py:method:: from_list(color: typing_extensions.List[float])
      :classmethod:


      Set the rgba_color from a list of RGBA values.

      :param color: The list of RGBA values



   .. py:method:: from_rgb(rgb: typing_extensions.List[float])
      :classmethod:


      Set the rgba_color from a list of RGB values.

      :param rgb: The list of RGB values



   .. py:method:: from_rgba(rgba: typing_extensions.List[float])
      :classmethod:


      Set the rgba_color from a list of RGBA values.

      :param rgba: The list of RGBA values



   .. py:method:: get_rgba() -> typing_extensions.List[float]

      Return the rgba_color as a list of RGBA values.

      :return: The rgba_color as a list of RGBA values



   .. py:method:: get_rgb() -> typing_extensions.List[float]

      Return the rgba_color as a list of RGB values.

      :return: The rgba_color as a list of RGB values



.. py:class:: Colors

   Bases: :py:obj:`Color`, :py:obj:`enum.Enum`


   Enum for easy access to some common colors.


   .. py:attribute:: PINK
      :value: (1, 0, 1, 1)



   .. py:attribute:: BLACK
      :value: (0, 0, 0, 1)



   .. py:attribute:: WHITE
      :value: (1, 1, 1, 1)



   .. py:attribute:: RED
      :value: (1, 0, 0, 1)



   .. py:attribute:: GREEN
      :value: (0, 1, 0, 1)



   .. py:attribute:: BLUE
      :value: (0, 0, 1, 1)



   .. py:attribute:: YELLOW
      :value: (1, 1, 0, 1)



   .. py:attribute:: CYAN
      :value: (0, 1, 1, 1)



   .. py:attribute:: MAGENTA
      :value: (1, 0, 1, 1)



   .. py:attribute:: GREY
      :value: (0.5, 0.5, 0.5, 1)



   .. py:method:: from_string(color: str) -> Color
      :classmethod:


      Set the rgba_color from a string. If the string is not a valid color, it will return the color WHITE.

      :param color: The string of the color



.. py:class:: BoundingBox

   Dataclass for storing an axis-aligned bounding box.

   An axis aligned bounding box is the cartesian product of the three closed intervals
   [min_x, max_x] x [min_y, max_y] x [min_z, max_z].

   Depth is the distance between the min_x and max_x, and should always be the long side (excluding height).
   Width is the distance between the min_y and max_y, and should always be the short side (excluding height).
   Height is the distance between the min_z and max_z, "up" is according to how the object would stand on a table.

   Set-Algebraic operations are possible by converting the bounding box to a random event.


   .. py:attribute:: min_x
      :type:  float

      The minimum x-coordinate of the bounding box.



   .. py:attribute:: min_y
      :type:  float

      The minimum y-coordinate of the bounding box.



   .. py:attribute:: min_z
      :type:  float

      The minimum z-coordinate of the bounding box.



   .. py:attribute:: max_x
      :type:  float

      The maximum x-coordinate of the bounding box.



   .. py:attribute:: max_y
      :type:  float

      The maximum y-coordinate of the bounding box.



   .. py:attribute:: max_z
      :type:  float

      The maximum z-coordinate of the bounding box.



   .. py:attribute:: x_variable

      The x variable for the random-events interface.



   .. py:attribute:: y_variable

      The y variable for the random-events interface.



   .. py:attribute:: z_variable

      The z variable for the random-events interface.



   .. py:method:: __hash__()


   .. py:property:: x_interval
      :type: random_events.interval.SimpleInterval


      :return: The x interval of the bounding box.



   .. py:property:: y_interval
      :type: random_events.interval.SimpleInterval


      :return: The y interval of the bounding box.



   .. py:property:: z_interval
      :type: random_events.interval.SimpleInterval


      :return: The z interval of the bounding box.



   .. py:property:: simple_event
      :type: random_events.product_algebra.SimpleEvent


      :return: The bounding box as a random event.



   .. py:method:: from_simple_event(simple_event: random_events.product_algebra.SimpleEvent)
      :classmethod:


      Create a list of bounding boxes from a simple random event.

      :param simple_event: The random event.
      :return: The list of bounding boxes.



   .. py:method:: from_event(event: random_events.product_algebra.Event) -> typing_extensions.List[typing_extensions.Self]
      :classmethod:


      Create a list of bounding boxes from a random event.

      :param event: The random event.
      :return: The list of bounding boxes.



   .. py:method:: intersection_with(other: BoundingBox) -> typing_extensions.Optional[BoundingBox]

      Compute the intersection of two bounding boxes.

      :param other: The other bounding box.
      :return: The intersection of the two bounding boxes or None if they do not intersect.



   .. py:method:: contains(x: float, y: float, z: float)

      Check if the bounding box contains a point.

      :param x: The x-coordinate of the point.
      :param y: The y-coordinate of the point.
      :param z: The z-coordinate of the point.
      :return: True if the bounding box contains the point, False otherwise.



   .. py:method:: contains_box(other: BoundingBox)

      Check if the bounding box contains another bounding box.

      :param other: The other bounding box.
      :return: True if the bounding box contains the other bounding box, False otherwise.



   .. py:method:: merge_multiple_bounding_boxes_into_mesh(bounding_boxes: typing_extensions.List[BoundingBox], save_mesh_to: typing_extensions.Optional[str] = None, use_random_events: bool = True, plot: bool = False) -> trimesh.Trimesh
      :classmethod:


      Merge multiple axis-aligned bounding boxes into a single mesh.

      :param bounding_boxes: The list of axis-aligned bounding boxes.
      :param save_mesh_to: The file path to save the mesh to.
      :param use_random_events: If True, use random events to compute the new shape, otherwise use pyvista.
      :param plot: If True, plot the mesh.
      :return: The mesh of the merged bounding boxes.



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

      :abstractmethod:


      Get the transformation of the bounding box.



   .. py:method:: extents() -> numpy.ndarray

      :return: The size of the bounding box in each dimension.



   .. py:method:: get_mesh_from_boxes(boxes: typing_extensions.List[BoundingBox]) -> trimesh.Trimesh
      :staticmethod:


      Get the mesh from the boxes

      :param boxes: The list of boxes
      :return: The mesh.



   .. py:property:: as_mesh
      :type: trimesh.Trimesh


      :return: The mesh of the bounding box.



   .. py:method:: get_mesh_from_event(event: random_events.product_algebra.Event) -> trimesh.Trimesh
      :staticmethod:


      Get the mesh from the event.

      :param event: The event.
      :return: The mesh.



   .. py:method:: get_box_faces() -> typing_extensions.List[typing_extensions.List[int]]
      :staticmethod:



   .. py:method:: from_min_max(min_point: typing_extensions.Sequence[float], max_point: typing_extensions.Sequence[float])
      :classmethod:


      Set the axis-aligned bounding box from a minimum and maximum point.

      :param min_point: The minimum point
      :param max_point: The maximum point



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



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



   .. py:property:: origin_point
      :type: pycram.datastructures.pose.Point



   .. py:method:: get_points_list() -> typing_extensions.List[typing_extensions.List[float]]

      :return: The points of the bounding box as a list of lists of floats.



   .. py:method:: get_points() -> typing_extensions.List[pycram.datastructures.pose.Point]

      :return: The points of the bounding box as a list of Point instances.



   .. py:method:: get_min_max_points() -> typing_extensions.Tuple[pycram.datastructures.pose.Point, pycram.datastructures.pose.Point]

      :return: The axis-aligned bounding box as a tuple of minimum and maximum points



   .. py:method:: get_min_point() -> pycram.datastructures.pose.Point

      :return: The axis-aligned bounding box as a minimum point



   .. py:method:: get_max_point() -> pycram.datastructures.pose.Point

      :return: The axis-aligned bounding box as a maximum point



   .. py:method:: get_min_max() -> typing_extensions.Tuple[typing_extensions.List[float], typing_extensions.List[float]]

      :return: The axis-aligned bounding box as a tuple of minimum and maximum points



   .. py:method:: get_min() -> typing_extensions.List[float]

      :return: The minimum point of the axis-aligned bounding box



   .. py:method:: get_max() -> typing_extensions.List[float]

      :return: The maximum point of the axis-aligned bounding box



   .. py:method:: enlarge(min_x: float = 0.0, min_y: float = 0, min_z: float = 0, max_x: float = 0.0, max_y: float = 0.0, max_z: float = 0.0)

      Enlarge the axis-aligned bounding box by a given amount in-place.
      :param min_x: The amount to enlarge the minimum x-coordinate
      :param min_y: The amount to enlarge the minimum y-coordinate
      :param min_z: The amount to enlarge the minimum z-coordinate
      :param max_x: The amount to enlarge the maximum x-coordinate
      :param max_y: The amount to enlarge the maximum y-coordinate
      :param max_z: The amount to enlarge the maximum z-coordinate



   .. py:method:: enlarge_all(amount: float)

      Enlarge the axis-aligned bounding box in all dimensions by a given amount in-place.

      :param amount: The amount to enlarge the bounding box



   .. py:property:: depth
      :type: float



   .. py:property:: height
      :type: float



   .. py:property:: width
      :type: float



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


      According to the IAI conventions, found at https://ai.uni-bremen.de/wiki/3dmodeling/items
      1. z is height, according to how the object would stand on a table
      2. x is depth, representing the long side of the object
      3. y is width, representing the remaining dimension



   .. py:method:: plot_3d_points(list_of_points: typing_extensions.List[numpy.ndarray])
      :staticmethod:



.. py:class:: AxisAlignedBoundingBox

   Bases: :py:obj:`BoundingBox`


   Dataclass for storing an axis-aligned bounding box.

   An axis aligned bounding box is the cartesian product of the three closed intervals
   [min_x, max_x] x [min_y, max_y] x [min_z, max_z].

   Depth is the distance between the min_x and max_x, and should always be the long side (excluding height).
   Width is the distance between the min_y and max_y, and should always be the short side (excluding height).
   Height is the distance between the min_z and max_z, "up" is according to how the object would stand on a table.

   Set-Algebraic operations are possible by converting the bounding box to a random event.


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


      Get the transformation of the bounding box.



   .. py:method:: get_rotated_box(transform: pycram.datastructures.pose.TransformStamped) -> RotatedBoundingBox

      Apply a transformation to the axis-aligned bounding box and return the transformed axis-aligned bounding box.

      :return: The transformed axis-aligned bounding box



   .. py:method:: from_origin_and_half_extents(origin: pycram.datastructures.pose.Point, half_extents: pycram.datastructures.pose.Point)
      :classmethod:


      Set the axis-aligned bounding box from the origin of the body and half the size.

      :param origin: The origin point
      :param half_extents: The half size of the bounding box.



   .. py:method:: from_multiple_bounding_boxes(bounding_boxes: typing_extensions.List[AxisAlignedBoundingBox]) -> AxisAlignedBoundingBox
      :classmethod:


      Set the axis-aligned bounding box from multiple axis-aligned bounding boxes.

      :param bounding_boxes: The list of axis-aligned bounding boxes.



   .. py:method:: shift_by(shift: pycram.datastructures.pose.Point) -> AxisAlignedBoundingBox

      Shift the axis-aligned bounding box by a given shift.

      :param shift: The shift to apply
      :return: The shifted axis-aligned bounding box



.. py:class:: RotatedBoundingBox(min_x: float, min_y: float, min_z: float, max_x: float, max_y: float, max_z: float, transform: typing_extensions.Optional[pycram.datastructures.pose.TransformStamped] = None, points: typing_extensions.Optional[typing_extensions.List[pycram.datastructures.pose.Point]] = None)

   Bases: :py:obj:`BoundingBox`


   Dataclass for storing a rotated bounding box.


   .. py:attribute:: _transform
      :type:  typing_extensions.Optional[pycram.datastructures.pose.TransformStamped]
      :value: None



   .. py:attribute:: _points
      :type:  typing_extensions.Optional[typing_extensions.List[pycram.datastructures.pose.Point]]
      :value: None



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


      Get the transformation of the bounding box.



   .. py:method:: from_min_max(min_point: typing_extensions.Sequence[float], max_point: typing_extensions.Sequence[float], transform: typing_extensions.Optional[pycram.datastructures.pose.TransformStamped] = None)
      :classmethod:


      Set the rotated bounding box from a minimum, maximum point, and a transformation.

      :param min_point: The minimum point
      :param max_point: The maximum point
      :param transform: The transformation



   .. py:method:: get_points() -> typing_extensions.List[pycram.datastructures.pose.Point]

      :return: The points of the rotated bounding box.



.. py:class:: CollisionCallbacks

   Dataclass for storing the collision callbacks which are callables that get called when there is a collision
   or when a collision is no longer there.


   .. py:attribute:: on_collision_cb
      :type:  typing_extensions.Callable


   .. py:attribute:: no_collision_cb
      :type:  typing_extensions.Optional[typing_extensions.Callable]
      :value: None



.. py:class:: MultiBody

   Dataclass for storing the information of a multibody which consists of a base and multiple links with joints.


   .. py:attribute:: base_visual_shape_index
      :type:  int


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


   .. py:attribute:: link_visual_shape_indices
      :type:  typing_extensions.List[int]


   .. py:attribute:: link_poses
      :type:  typing_extensions.List[pycram.datastructures.pose.PoseStamped]


   .. py:attribute:: link_masses
      :type:  typing_extensions.List[float]


   .. py:attribute:: link_inertial_frame_poses
      :type:  typing_extensions.List[pycram.datastructures.pose.PoseStamped]


   .. py:attribute:: link_parent_indices
      :type:  typing_extensions.List[int]


   .. py:attribute:: link_joint_types
      :type:  typing_extensions.List[pycram.datastructures.enums.JointType]


   .. py:attribute:: link_joint_axis
      :type:  typing_extensions.List[pycram.datastructures.pose.Point]


   .. py:attribute:: link_collision_shape_indices
      :type:  typing_extensions.List[int]


.. py:class:: VisualShape

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


   Abstract dataclass for storing the information of a visual shape.


   .. py:attribute:: rgba_color
      :type:  Color


   .. py:attribute:: visual_frame_position
      :type:  typing_extensions.List[float]


   .. py:method:: shape_data() -> typing_extensions.Dict[str, typing_extensions.Any]
      :abstractmethod:


      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape

      :abstractmethod:


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



   .. py:method:: get_axis_aligned_bounding_box() -> AxisAlignedBoundingBox
      :abstractmethod:


      :return: The axis-aligned bounding box of the visual shape.



.. py:class:: BoxVisualShape

   Bases: :py:obj:`VisualShape`


   Dataclass for storing the information of a box visual shape


   .. py:attribute:: half_extents
      :type:  typing_extensions.List[float]


   .. py:method:: shape_data() -> typing_extensions.Dict[str, typing_extensions.List[float]]

      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



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



   .. py:method:: get_axis_aligned_bounding_box() -> AxisAlignedBoundingBox

      :return: The axis-aligned bounding box of the box visual shape.



.. py:class:: SphereVisualShape

   Bases: :py:obj:`VisualShape`


   Dataclass for storing the information of a sphere visual shape


   .. py:attribute:: radius
      :type:  float


   .. py:method:: shape_data() -> typing_extensions.Dict[str, float]

      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



   .. py:method:: get_axis_aligned_bounding_box() -> AxisAlignedBoundingBox

      :return: The axis-aligned bounding box of the sphere visual shape.



.. py:class:: CapsuleVisualShape

   Bases: :py:obj:`VisualShape`


   Dataclass for storing the information of a capsule visual shape


   .. py:attribute:: radius
      :type:  float


   .. py:attribute:: length
      :type:  float


   .. py:method:: shape_data() -> typing_extensions.Dict[str, float]

      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



   .. py:method:: get_axis_aligned_bounding_box() -> AxisAlignedBoundingBox

      :return: The axis-aligned bounding box of the capsule visual shape.



.. py:class:: CylinderVisualShape

   Bases: :py:obj:`CapsuleVisualShape`


   Dataclass for storing the information of a cylinder visual shape


   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



.. py:class:: MeshVisualShape

   Bases: :py:obj:`VisualShape`


   Dataclass for storing the information of a mesh visual shape


   .. py:attribute:: scale
      :type:  typing_extensions.List[float]


   .. py:attribute:: file_name
      :type:  str


   .. py:method:: shape_data() -> typing_extensions.Dict[str, typing_extensions.Union[typing_extensions.List[float], str]]

      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



   .. py:method:: get_axis_aligned_bounding_box(file_path: typing_extensions.Optional[str] = None) -> AxisAlignedBoundingBox

      :param file_path: An alternative file path.
      :return: The axis-aligned bounding box of the mesh visual shape.



.. py:class:: PlaneVisualShape

   Bases: :py:obj:`VisualShape`


   Dataclass for storing the information of a plane visual shape


   .. py:attribute:: normal
      :type:  typing_extensions.List[float]


   .. py:method:: shape_data() -> typing_extensions.Dict[str, typing_extensions.List[float]]

      :return: the shape data of the visual shape (e.g. half extents for a box, radius for a sphere) as a dictionary.



   .. py:property:: visual_geometry_type
      :type: pycram.datastructures.enums.Shape


      :return: The visual geometry type of the visual shape (e.g. box, sphere) as a Shape object.



.. py:data:: VisualShapeUnion

.. py:class:: State

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


   Abstract dataclass for storing the state of an entity (e.g. world, object, link, joint).


.. py:class:: PhysicalBodyState

   Bases: :py:obj:`State`


   Dataclass for storing the state of a physical body.


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


   .. py:attribute:: is_translating
      :type:  bool


   .. py:attribute:: is_rotating
      :type:  bool


   .. py:attribute:: velocity
      :type:  typing_extensions.List[float]


   .. py:attribute:: acceptable_pose_error
      :type:  typing_extensions.Tuple[float, float]
      :value: (0.001, 0.001)



   .. py:attribute:: acceptable_velocity_error
      :type:  typing_extensions.Tuple[float, float]
      :value: (0.001, 0.001)



   .. py:method:: __eq__(other: PhysicalBodyState)


   .. py:method:: pose_is_almost_equal(other: PhysicalBodyState) -> bool

      Check if the pose of the object is almost equal to the pose of another object.

      :param other: The state of the other object.
      :return: True if the poses are almost equal, False otherwise.



   .. py:method:: velocity_is_almost_equal(other: PhysicalBodyState) -> bool

      Check if the velocity of the object is almost equal to the velocity of another object.

      :param other: The state of the other object.
      :return: True if the velocities are almost equal, False otherwise.



   .. py:method:: vector_is_almost_equal(vector1: typing_extensions.List[float], vector2: typing_extensions.List[float], acceptable_error: float) -> bool
      :staticmethod:


      Check if the vector is almost equal to another vector.

      :param vector1: The first vector.
      :param vector2: The second vector.
      :param acceptable_error: The acceptable error.
      :return: True if the vectors are almost equal, False otherwise.



   .. py:method:: __copy__()


.. py:class:: LinkState

   Bases: :py:obj:`State`


   Dataclass for storing the state of a link.


   .. py:attribute:: body_state
      :type:  PhysicalBodyState


   .. py:attribute:: constraint_ids
      :type:  typing_extensions.Dict[pycram.description.Link, int]


   .. py:method:: __eq__(other: LinkState)


   .. py:method:: all_constraints_exist(other: LinkState) -> bool

      Check if all constraints exist in the other link state.

      :param other: The state of the other link.
      :return: True if all constraints exist, False otherwise.



   .. py:method:: all_constraints_are_equal(other: LinkState) -> bool

      Check if all constraints are equal to the ones in the other link state.

      :param other: The state of the other link.
      :return: True if all constraints are equal, False otherwise.



   .. py:method:: __copy__()


.. py:class:: JointState

   Bases: :py:obj:`State`


   Dataclass for storing the state of a joint.


   .. py:attribute:: position
      :type:  float


   .. py:attribute:: acceptable_error
      :type:  float


   .. py:method:: __eq__(other: JointState)


   .. py:method:: __copy__()


.. py:class:: ObjectState

   Bases: :py:obj:`State`


   Dataclass for storing the state of an object.


   .. py:attribute:: body_state
      :type:  PhysicalBodyState


   .. py:attribute:: attachments
      :type:  typing_extensions.Dict[pycram.world_concepts.world_object.Object, pycram.world_concepts.constraints.Attachment]


   .. py:attribute:: link_states
      :type:  typing_extensions.Dict[int, LinkState]


   .. py:attribute:: joint_states
      :type:  typing_extensions.Dict[int, JointState]


   .. py:method:: __eq__(other: ObjectState)


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



   .. py:method:: all_attachments_exist(other: ObjectState) -> bool

      Check if all attachments exist in the other object state.

      :param other: The state of the other object.
      :return: True if all attachments exist, False otherwise.



   .. py:method:: all_attachments_are_equal(other: ObjectState) -> bool

      Check if all attachments are equal to the ones in the other object state.

      :param other: The state of the other object.
      :return: True if all attachments are equal, False otherwise



   .. py:method:: __copy__()


.. py:class:: WorldState

   Bases: :py:obj:`State`


   Dataclass for storing the state of the world.


   .. py:attribute:: object_states
      :type:  typing_extensions.Dict[str, ObjectState]


   .. py:attribute:: simulator_state_id
      :type:  typing_extensions.Optional[int]
      :value: None



   .. py:method:: __eq__(other: WorldState)


   .. py:method:: simulator_state_is_equal(other: WorldState) -> bool

      Check if the simulator state is equal to the simulator state of another world state.

      :param other: The state of the other world.
      :return: True if the simulator states are equal, False otherwise.



   .. py:method:: all_objects_exist(other: WorldState) -> bool

      Check if all objects exist in the other world state.

      :param other: The state of the other world.
      :return: True if all objects exist, False otherwise.



   .. py:method:: all_objects_states_are_equal(other: WorldState) -> bool

      Check if all object states are equal to the ones in the other world state.

      :param other: The state of the other world.
      :return: True if all object states are equal, False otherwise.



   .. py:method:: __copy__()


.. py:class:: LateralFriction

   Dataclass for storing the information of the lateral friction.


   .. py:attribute:: lateral_friction
      :type:  float


   .. py:attribute:: lateral_friction_direction
      :type:  typing_extensions.List[float]


.. py:class:: ContactPoint

   Dataclass for storing the information of a contact point between two bodies.


   .. py:attribute:: body_a
      :type:  pycram.datastructures.world_entity.PhysicalBody


   .. py:attribute:: body_b
      :type:  pycram.datastructures.world_entity.PhysicalBody


   .. py:attribute:: position_on_body_a
      :type:  typing_extensions.Optional[typing_extensions.List[float]]
      :value: None



   .. py:attribute:: position_on_body_b
      :type:  typing_extensions.Optional[typing_extensions.List[float]]
      :value: None



   .. py:attribute:: normal_on_body_b
      :type:  typing_extensions.Optional[typing_extensions.List[float]]
      :value: None



   .. py:attribute:: distance
      :type:  typing_extensions.Optional[float]
      :value: None



   .. py:attribute:: normal_force
      :type:  typing_extensions.Optional[float]
      :value: None



   .. py:attribute:: lateral_friction_1
      :type:  typing_extensions.Optional[LateralFriction]
      :value: None



   .. py:attribute:: lateral_friction_2
      :type:  typing_extensions.Optional[LateralFriction]
      :value: None



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



   .. py:property:: bodies
      :type: typing_extensions.Tuple[pycram.datastructures.world_entity.PhysicalBody, pycram.datastructures.world_entity.PhysicalBody]



   .. py:method:: __str__()


   .. py:method:: __repr__()


.. py:data:: ClosestPoint

   The closest point between two objects which has the same structure as ContactPoint.


.. py:class:: ContactPointsList

   Bases: :py:obj:`list`


   A list of contact points.


   .. py:method:: get_bodies_that_got_removed(previous_points: ContactPointsList) -> typing_extensions.List[pycram.datastructures.world_entity.PhysicalBody]

      Return the bodies that are not in the current points list but were in the initial points list.

      :param previous_points: The initial points list.
      :return: A list of bodies that got removed.



   .. py:method:: get_all_bodies(excluded: typing_extensions.List[pycram.datastructures.world_entity.PhysicalBody] = None) -> typing_extensions.List[pycram.datastructures.world_entity.PhysicalBody]

      :return: A list of all involved bodies in the points.



   .. py:method:: check_if_two_objects_are_in_contact(obj_a: pycram.world_concepts.world_object.Object, obj_b: pycram.world_concepts.world_object.Object) -> bool

      Check if two objects are in contact.

      :param obj_a: An instance of the Object class that represents the first object.
      :param obj_b: An instance of the Object class that represents the second object.
      :return: True if the objects are in contact, False otherwise.



   .. py:method:: is_body_in_object(body: pycram.datastructures.world_entity.PhysicalBody, obj: pycram.world_concepts.world_object.Object) -> bool
      :staticmethod:


      Check if the body belongs to the object.

      :param body: The body.
      :param obj: The object.
      :return: True if the body belongs to the object, False otherwise.



   .. py:method:: get_normals_of_object(obj: pycram.world_concepts.world_object.Object) -> typing_extensions.List[typing_extensions.List[float]]

      Get the normals of the object.

      :param obj: An instance of the Object class that represents the object.
      :return: A list of float vectors that represent the normals of the object.



   .. py:method:: get_normals() -> typing_extensions.List[typing_extensions.List[float]]

      Get the normals of the points.

      :return: A list of float vectors that represent the normals of the contact points.



   .. py:method:: get_links_in_contact_of_object(obj: pycram.world_concepts.world_object.Object) -> typing_extensions.List[pycram.datastructures.world_entity.PhysicalBody]

      Get the links in contact of the object.

      :param obj: An instance of the Object class that represents the object.
      :return: A list of Link instances that represent the links in contact of the object.



   .. py:method:: get_points_of_object(obj: pycram.world_concepts.world_object.Object) -> ContactPointsList

      Get the points of the object.

      :param obj: An instance of the Object class that represents the object that the points are related to.
      :return: A ContactPointsList instance that represents the contact points of the object.



   .. py:method:: get_points_of_link(link: pycram.description.Link) -> ContactPointsList

      Get the points of the link.

      :param link: An instance of the Link class that represents the link that the points are related to.
      :return: A ContactPointsList instance that represents the contact points of the link.



   .. py:method:: get_points_of_body(body: pycram.datastructures.world_entity.PhysicalBody) -> ContactPointsList

      Get the points of the body.

      :param body: An instance of the PhysicalBody class that represents the body that the points are related to.
      :return: A ContactPointsList instance that represents the contact points of the body.



   .. py:method:: get_objects_that_got_removed(previous_points: ContactPointsList) -> typing_extensions.List[pycram.world_concepts.world_object.Object]

      Return the object that is not in the current points list but was in the initial points list.

      :param previous_points: The initial points list.
      :return: A list of Object instances that represent the objects that got removed.



   .. py:method:: get_new_objects(previous_points: ContactPointsList) -> typing_extensions.List[pycram.world_concepts.world_object.Object]

      Return the object that is not in the initial points list but is in the current points list.

      :param previous_points: The initial points list.
      :return: A list of Object instances that represent the new objects.



   .. py:method:: is_object_in_the_list(obj: pycram.world_concepts.world_object.Object) -> bool

      Check if the object is one of the objects that have points in the list.

      :param obj: An instance of the Object class that represents the object.
      :return: True if the object is in the list, False otherwise.



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

      Return the names of the objects that have points in the list.

      :return: A list of strings that represent the names of the objects that have points in the list.



   .. py:method:: get_objects_that_have_points() -> typing_extensions.List[pycram.world_concepts.world_object.Object]

      Return the objects that have points in the list.

      :return: A list of Object instances that represent the objects that have points in the list.



   .. py:method:: __str__()

      Return str(self).



   .. py:method:: __repr__()

      Return repr(self).



.. py:data:: ClosestPointsList

   The list of closest points which has same structure as ContactPointsList.


.. py:class:: TextAnnotation

   Dataclass for storing text annotations that can be displayed in the simulation.


   .. py:attribute:: text
      :type:  str


   .. py:attribute:: position
      :type:  typing_extensions.List[float]


   .. py:attribute:: id
      :type:  int


   .. py:attribute:: color
      :type:  Color


   .. py:attribute:: size
      :type:  float
      :value: 0.1



.. py:class:: VirtualJoint

   A virtual (not real) joint that is most likely used for simulation purposes.


   .. py:attribute:: name
      :type:  str


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


   .. py:attribute:: axes
      :type:  typing_extensions.Optional[pycram.datastructures.pose.Point]
      :value: None



   .. py:property:: type


   .. py:property:: is_virtual


   .. py:method:: __hash__()


.. py:class:: Rotations

   Bases: :py:obj:`typing_extensions.Dict`\ [\ :py:obj:`typing_extensions.Optional`\ [\ :py:obj:`typing_extensions.Union`\ [\ :py:obj:`pycram.datastructures.enums.Grasp`\ , :py:obj:`bool`\ ]\ ]\ , :py:obj:`typing_extensions.List`\ [\ :py:obj:`float`\ ]\ ]


   A dictionary that defines standard quaternions for different grasps and orientations. This is mainly used
   to automatically calculate all grasp descriptions of a robot gripper for the robot description.

   SIDE_ROTATIONS: The quaternions for the different approach directions (front, back, left, right)
   VERTICAL_ROTATIONS: The quaternions for the different vertical alignments, in case the object requires for
   example a top grasp
   HORIZONTAL_ROTATIONS: The quaternions for the different horizontal alignments, in case the gripper needs to roll
   90°


   .. py:attribute:: SIDE_ROTATIONS


   .. py:attribute:: VERTICAL_ROTATIONS


   .. py:attribute:: HORIZONTAL_ROTATIONS


.. py:class:: VirtualMobileBaseJoints

   Dataclass for storing the names, types and axes of the virtual mobile base joints of a mobile robot.


   .. py:attribute:: translation_x
      :type:  typing_extensions.Optional[VirtualJoint]


   .. py:attribute:: translation_y
      :type:  typing_extensions.Optional[VirtualJoint]


   .. py:attribute:: angular_z
      :type:  typing_extensions.Optional[VirtualJoint]


   .. py:property:: names
      :type: typing_extensions.List[str]


      Return the names of the virtual mobile base joints.



   .. py:method:: get_types() -> typing_extensions.Dict[str, pycram.datastructures.enums.JointType]

      Return the joint types of the virtual mobile base joints.



   .. py:method:: get_axes() -> typing_extensions.Dict[str, pycram.datastructures.pose.Point]

      Return the axes (i.e. The axis on which the joint moves) of the virtual mobile base joints.



.. py:class:: MultiverseMetaData

   Meta data for the Multiverse Client, the simulation_name should be non-empty and unique for each simulation


   .. py:attribute:: world_name
      :type:  str
      :value: 'world'



   .. py:attribute:: simulation_name
      :type:  str
      :value: 'cram'



   .. py:attribute:: length_unit
      :type:  str
      :value: 'm'



   .. py:attribute:: angle_unit
      :type:  str
      :value: 'rad'



   .. py:attribute:: mass_unit
      :type:  str
      :value: 'kg'



   .. py:attribute:: time_unit
      :type:  str
      :value: 's'



   .. py:attribute:: handedness
      :type:  str
      :value: 'rhs'



.. py:class:: RayResult

   A dataclass to store the ray result. The ray result contains the body name that the ray intersects with and the
   distance from the ray origin to the intersection point.


   .. py:attribute:: obj_id
      :type:  int

      The object id of the body that the ray intersects with.



   .. py:attribute:: link_id
      :type:  int
      :value: -1


      The link id of the body that the ray intersects with, -1 if root link or None.



   .. py:attribute:: _hit_fraction
      :type:  typing_extensions.Optional[float]
      :value: None


      The fraction of the ray length at which the intersection point is located a range in [0, 1].



   .. py:attribute:: hit_position
      :type:  typing_extensions.Optional[typing_extensions.List[float]]
      :value: None


      The intersection point in cartesian world coordinates.



   .. py:attribute:: hit_normal
      :type:  typing_extensions.Optional[typing_extensions.List[float]]
      :value: None


      The normal at the intersection point in cartesian world coordinates.



   .. py:attribute:: distance
      :type:  typing_extensions.Optional[float]
      :value: None


      The distance from the ray origin to the intersection point.



   .. py:property:: intersected
      :type: bool


      Check if the ray intersects with a body.
      return: Whether the ray intersects with a body.



   .. py:property:: hit_fraction
      :type: typing_extensions.Optional[float]



   .. py:method:: update_distance(from_position: typing_extensions.List[float], to_position: typing_extensions.Optional[typing_extensions.List[float]] = None) -> float

      The distance from the ray origin to the intersection point.



.. py:class:: MultiverseRayResult

   A dataclass to store the ray result. The ray result contains the body name that the ray intersects with and the
   distance from the ray origin to the intersection point.


   .. py:attribute:: body_name
      :type:  str


   .. py:attribute:: distance
      :type:  float


   .. py:method:: intersected() -> bool

      Check if the ray intersects with a body.
      return: Whether the ray intersects with a body.



.. py:class:: MultiverseContactPoint

   A dataclass to store all the contact data returned from Multiverse for a single object.


   .. py:attribute:: body_1
      :type:  str


   .. py:attribute:: body_2
      :type:  str


   .. py:attribute:: position
      :type:  typing_extensions.List[float]


   .. py:attribute:: normal
      :type:  typing_extensions.List[float]


.. py:class:: ReasoningResult

   Result of a reasoning result of knowledge source


   .. py:attribute:: success
      :type:  bool


   .. py:attribute:: reasoned_parameter
      :type:  typing_extensions.Dict[str, typing_extensions.Any]


.. py:class:: FrozenObject

   .. py:attribute:: name
      :type:  str

      Name of this Object



   .. py:attribute:: concept
      :type:  typing_extensions.Type[pycrap.ontologies.PhysicalObject]

      The Concept of the Object as the PyCRAP concept



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


      The path to the source file



   .. py:attribute:: description
      :type:  typing_extensions.Optional[pycram.description.ObjectDescription]
      :value: None


      The description of the object, this is a combination of links and joints



   .. py:attribute:: pose
      :type:  typing_extensions.Optional[pycram.datastructures.pose.PoseStamped]

      The pose at which this object is placed



   .. py:attribute:: links
      :type:  typing_extensions.Optional[typing_extensions.Dict[str, FrozenLink]]
      :value: None


      A dictionary with the link name as key and the link object as value



   .. py:attribute:: joints
      :type:  typing_extensions.Optional[typing_extensions.Dict[str, FrozenJoint]]
      :value: None


      A dictionary of all joints, with the joint name as key and the joint object as value



.. py:class:: FrozenLink

   .. py:attribute:: name
      :type:  str

      Name of this FrozenLink



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

      Pose of this Link in the world frame



   .. py:attribute:: geometry
      :type:  typing_extensions.Union[VisualShape, typing_extensions.List[VisualShape]]

      The geometry of this link



.. py:class:: FrozenJoint

   .. py:attribute:: name
      :type:  str

      Name of this FrozenJoints



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

      The type of this joint



   .. py:attribute:: children
      :type:  typing_extensions.Sequence[str]

      A sequence of the names of all children



   .. py:attribute:: parent
      :type:  typing_extensions.Optional[str]

      The name of the parent joint or None if there is no parent joint



   .. py:attribute:: state
      :type:  float

      State of the joint



