pycram.graph_of_convex_sets
===========================

.. py:module:: pycram.graph_of_convex_sets


Classes
-------

.. autoapisummary::

   pycram.graph_of_convex_sets.PoseOccupiedError
   pycram.graph_of_convex_sets.GraphOfConvexSets


Functions
---------

.. autoapisummary::

   pycram.graph_of_convex_sets.plot_path_in_rviz


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

.. py:class:: PoseOccupiedError(pose: pycram.datastructures.pose.PoseStamped)

   Bases: :py:obj:`pycram.failures.PlanFailure`


   Error that is raised when a pose is occupied or not in the search space of a Connectivity Graphs.


   .. py:attribute:: pose


.. py:class:: GraphOfConvexSets(search_space: typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox] = None)

   Bases: :py:obj:`networkx.Graph`


   A graph that represents the connectivity between convex sets.

   Every node in this graph represents a convex set.
   Every edge represents an adjacency between two convex sets.
   Furthermore, the adjacency is saved in and edge attribute called "intersection".


   .. py:attribute:: search_space
      :type:  pycram.datastructures.dataclasses.BoundingBox

      The bounding box of the search space. Defaults to the entire three dimensional space.



   .. py:method:: calculate_connectivity(tolerance=0.001)

      Generate the edges for this graph.

      :param tolerance: The tolerance for the intersection.
      This value enlarges the boxes before the intersection to account for numeric imprecision.



   .. py:method:: plot_free_space() -> typing_extensions.List[plotly.graph_objects.Mesh3d]

      Plot the free space of the environment in blue.
      :return: A list of traces that can be put into a plotly figure.



   .. py:method:: plot_occupied_space() -> typing_extensions.List[plotly.graph_objects.Mesh3d]

      Plot the occupied space of the environment in red.
      :return: A list of traces that can be put into a plotly figure.



   .. py:method:: node_of_pose(x, y, z) -> typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox]

      Find the node that contains a point.

      :param x: The x-coordinate.
      :param y: The y-coordinate.
      :param z: The z-coordinate.
      :return: The node that contains the point or None if no node contains the point.



   .. py:method:: path_from_to(start: pycram.datastructures.pose.PoseStamped, goal: pycram.datastructures.pose.PoseStamped) -> typing_extensions.Optional[typing_extensions.List[pycram.datastructures.pose.PoseStamped]]

      Calculate a connected path from a start pose to a goal pose.

      :param start: The start pose.
      :param goal: The goal pose.
      :return: The path as a sequence of points to navigate to or None if no path exists.



   .. py:method:: _make_search_space(search_space: typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox] = None)
      :classmethod:


      Create the default search space if it is not given.



   .. py:method:: obstacles_of_world(world: pycram.datastructures.world.World, search_space: typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox] = None) -> random_events.product_algebra.Event
      :classmethod:


      Get all obstacles of the world besides the robot as a random event.



   .. py:method:: free_space_from_world(world: pycram.datastructures.world.World, tolerance=0.001, search_space: typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox] = None) -> typing_extensions.Self
      :classmethod:


      Create a connectivity graph from the free space in the belief state of the robot.

      :param world: The belief state.
      :param tolerance: The tolerance for the intersection when calculating the connectivity.
      :param search_space: The search space for the connectivity graph.
      :return: The connectivity graph.



   .. py:method:: navigation_map_from_world(world: pycram.datastructures.world.World, tolerance=0.001, search_space: typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox] = None) -> typing_extensions.Self
      :classmethod:


      Create a GCS from the free space in the belief state of the robot for navigation.
      The resulting GCS describes the paths for navigation, meaning that changing the z-axis position is not
      possible.
      Furthermore, it is taken into account that the robot has to fit through the entire space and not just
      through the floor level obstacles.

      TODO: i think explicitly 2d boxes would help here.

      :param world: The belief state.
      :param tolerance: The tolerance for the intersection when calculating the connectivity.
      :param search_space: The search space for the connectivity graph.
      :return: The connectivity graph.



.. py:function:: plot_path_in_rviz(path: typing_extensions.List[pycram.datastructures.pose.PoseStamped])

   Plot a path in rviz.

   :param path: The path to plot.


