pycram.datastructures.grasp#
Classes#
Represents a grasp description with a side grasp, top face, and orientation alignment. |
|
Description of the preferred grasp alignment for an object. |
Module Contents#
- class pycram.datastructures.grasp.GraspDescription#
Bases:
pycram.has_parameters.HasParametersRepresents a grasp description with a side grasp, top face, and orientation alignment.
- approach_direction: pycram.datastructures.enums.ApproachDirection#
The primary approach direction.
- vertical_alignment: pycram.datastructures.enums.VerticalAlignment#
The vertical alignment when grasping the pose
- rotate_gripper: bool = False#
Indicates if the gripper should be rotated by 90°. Must be a boolean.
- __hash__()#
- as_list() typing_extensions.List[typing_extensions.Union[pycram.datastructures.enums.Grasp, typing_extensions.Optional[pycram.datastructures.enums.Grasp], bool]]#
- Returns:
A list representation of the grasp description.
- get_grasp_pose(end_effector: semantic_digital_twin.robots.abstract_robot.Manipulator, body: semantic_digital_twin.world_description.world_entity.Body, translate_rim_offset: bool = False) pycram.datastructures.pose.PoseStamped#
Translates the grasp pose of the object using the desired grasp description and object knowledge. Leaves the orientation untouched. Returns the translated grasp pose.
- Parameters:
end_effector – The end effector that will be used to grasp the object.
body – The body of the object to be grasped.
translate_rim_offset – If True, the grasp pose will be translated along the rim offset.
- Returns:
The grasp pose of the object.
- calculate_grasp_orientation(front_orientation: numpy.ndarray) typing_extensions.List[float]#
Calculates the grasp orientation based on the approach axis and the grasp description.
- Parameters:
front_orientation – The front-facing orientation of the end effector as a numpy array.
- Returns:
The calculated orientation as a quaternion.
- static calculate_grasp_descriptions(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot, pose: pycram.datastructures.pose.PoseStamped, grasp_alignment: typing_extensions.Optional[PreferredGraspAlignment] = None) typing_extensions.List[GraspDescription]#
This method determines the possible grasp configurations (approach axis and vertical alignment) of the body, taking into account the bodies orientation, position, and whether the gripper should be rotated by 90°.
- Parameters:
robot – The robot for which the grasp configurations are being calculated.
grasp_alignment – An optional PreferredGraspAlignment object that specifies preferred grasp axis,
pose – The pose of the object to be grasped.
- Returns:
A sorted list of GraspDescription instances representing all grasp permutations.
- static calculate_closest_faces(pose_to_robot_vector: pycram.datastructures.pose.Vector3, specified_grasp_axis: pycram.datastructures.enums.AxisIdentifier = AxisIdentifier.Undefined) typing_extensions.Union[Tuple[pycram.datastructures.enums.ApproachDirection, pycram.datastructures.enums.ApproachDirection], Tuple[pycram.datastructures.enums.VerticalAlignment, pycram.datastructures.enums.VerticalAlignment]]#
Determines the faces of the object based on the input vector.
If specified_grasp_axis is None, it calculates the primary and secondary faces based on the vector’s magnitude determining which sides of the object are most aligned with the robot. This will either be the x, y plane for side faces or the z axis for top/bottom faces. If specified_grasp_axis is provided, it only considers the specified axis and calculates the faces aligned with that axis.
- Parameters:
pose_to_robot_vector – A 3D vector representing one of the robot’s axes in the pose’s frame, with irrelevant components set to np.nan.
specified_grasp_axis – Specifies a specific axis (e.g., X, Y, Z) to focus on.
- Returns:
A tuple of two Grasp enums representing the primary and secondary faces.
- class pycram.datastructures.grasp.PreferredGraspAlignment#
Description of the preferred grasp alignment for an object.
- preferred_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier]#
The preferred axis, X, Y, or Z, for grasping the object, or None if not specified.
- with_vertical_alignment: bool#
Indicates if the object should be grasped with a vertical alignment.
- with_rotated_gripper: bool#
Indicates if the gripper should be rotated by 90° around X.