Anygrasp

class Perception.Grasp_Pose_Estimation.Anygrasp(cfgs)[source]

A class for grasp pose estimation using AnyGrasp model.

cfgs

Configuration settings.

grasping_model

Instance of AnyGrasp model.

cam

Camera parameters.

__init__(cfgs)[source]

Initialize Anygrasp class with configurations.

Parameters:

cfgs – Configuration settings.

Grasp_Pose_Estimation(camera: Camera, seg_mask: ndarray, bbox: Tuple[int, int, int, int], crop_flag: bool = False)[source]

Calculate the optimal grasping pose.

Parameters:
  • cam (CameraParameters) – Camera internal parameters.

  • points (np.ndarray) – 3D point cloud data.

  • seg_mask (np.ndarray) – Object Mask.

  • bbox (Bbox) – Object bounding box.

  • crop_flag (bool, optional) – If point cloud has been crop by seg mask. Defaults to False.

Returns:

Status and best grasp pose.

Return type:

Tuple[bool, Pose]

print_filter_gg(filter_gg)[source]

print grasp pose and score, Descending.

Parameters:

() (filter_gg) – anygrasp grasp pose info

Perception.Grasp_Pose_Estimation.AnyGrasp.utils.sample_points(points, sampling_rate=1)[source]

Randomly sample some points from a given set of points at a specified sampling rate.

Parameters:
  • points (np.ndarray) – Array of points to sample from.

  • sampling_rate (float, optional) – Rate at which to sample points. Defaults to 1.

Returns:

Sampled points and their indices.

Return type:

Tuple[np.ndarray, np.ndarray]

Perception.Grasp_Pose_Estimation.AnyGrasp.utils.draw_rectangle(image, bbox, width=5)[source]

Draw a green rectangle on the given image.

Parameters:
  • image (ImageDraw) – Image on which to draw the rectangle.

  • bbox (Bbox) – Bounding box coordinates as a tuple (x1, y1, x2, y2).

  • width (int, optional) – Width of the rectangle outline. Defaults to 5.

Returns:

Image with the rectangle drawn.

Return type:

ImageDraw

Perception.Grasp_Pose_Estimation.AnyGrasp.utils.visualize_cloud_geometries(cloud, geometries, translation=None, rotation=None, visualize=True, save_file=None)[source]

Visualize point cloud with additional geometries.

Parameters:
  • cloud (o3d.geometry.PointCloud) – Point cloud of points.

  • geometries (list) – List of geometries to visualize with the point cloud.

  • translation (np.ndarray, optional) – Translation vector. Defaults to None.

  • rotation (np.ndarray, optional) – Rotation matrix. Defaults to None.

  • visualize (bool, optional) – Flag to show the visualization window. Defaults to True.

  • save_file (str, optional) – File name to save the visualization. Defaults to None.