pycram.graph_of_convex_sets#

Classes#

PoseOccupiedError

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

GraphOfConvexSets

A graph that represents the connectivity between convex sets.

Functions#

plot_path_in_rviz(path)

Plot a path in rviz.

Module Contents#

class pycram.graph_of_convex_sets.PoseOccupiedError(pose: pycram.datastructures.pose.PoseStamped)#

Bases: pycram.failures.PlanFailure

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

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

Bases: 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”.

search_space: pycram.datastructures.dataclasses.BoundingBox#

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

calculate_connectivity(tolerance=0.001)#

Generate the edges for this graph.

Parameters:

tolerance – The tolerance for the intersection.

This value enlarges the boxes before the intersection to account for numeric imprecision.

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.

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.

node_of_pose(x, y, z) typing_extensions.Optional[pycram.datastructures.dataclasses.BoundingBox]#

Find the node that contains a point.

Parameters:
  • x – The x-coordinate.

  • y – The y-coordinate.

  • z – The z-coordinate.

Returns:

The node that contains the point or None if no node contains the point.

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.

Parameters:
  • start – The start pose.

  • goal – The goal pose.

Returns:

The path as a sequence of points to navigate to or None if no path exists.

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

Create the default search space if it is not given.

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

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

classmethod 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#

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

Parameters:
  • world – The belief state.

  • tolerance – The tolerance for the intersection when calculating the connectivity.

  • search_space – The search space for the connectivity graph.

Returns:

The connectivity graph.

classmethod 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#

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.

Parameters:
  • world – The belief state.

  • tolerance – The tolerance for the intersection when calculating the connectivity.

  • search_space – The search space for the connectivity graph.

Returns:

The connectivity graph.

pycram.graph_of_convex_sets.plot_path_in_rviz(path: typing_extensions.List[pycram.datastructures.pose.PoseStamped])#

Plot a path in rviz.

Parameters:

path – The path to plot.