Zum Inhalt

GripperFace

An enum describing the different gripper faces including the obstructed ones (GRIPPED_X_POSITIVE and GRIPPED_X_NEGATIVE).

GRIPPED_X_NEGATIVE

The face of the gripped cube facing in negative X direction relative to the flange. This face is obstructed by a gripper finger and therfore can't be used for rotations but only for regrips.

GRIPPED_X_POSITIVE

The face of the gripped cube facing in positive X direction relative to the flange. This face is obstructed by a gripper finger and therfore can't be used for rotations but only for regrips.

MAIN

The main face of the gripped cube facing away from the flange.

Y_NEGATIVE

The face of the gripped cube facing in negative Y direction relative to the flange.

Y_POSITIVE

The face of the gripped cube facing in positive Y direction relative to the flange.

to_orientation(self)

Calculates the orientation base and rotation matrix of the gripper face.

Returns:

Type Description
Tuple[numpy.ndarray, scipy.spatial.transform.rotation.Rotation]

the base and the rotation matrix

Source code in core/grip_target_generation/GripperFace.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def to_orientation(self) -> Tuple[np.ndarray, transform.Rotation]:
    """Calculates the orientation base and rotation matrix of the gripper face.

        Returns:
            the base and the rotation matrix
    """
    if self == GripperFace.MAIN:
        mat = np.array([[0, 1, 0],
                        [1, 0, 0],
                        [0, 0, -1]])  # y x -z
        return mat, transform.Rotation.from_euler('z', -90, degrees=True)

    if self == GripperFace.Y_POSITIVE:
        mat = np.array([[0, 0, 1],
                        [-1, 0, 0],
                        [0, -1, 0]])  # -y -z +x
        return mat, transform.Rotation.from_euler('y', -90, degrees=True)

    if self == GripperFace.Y_NEGATIVE:
        mat = np.array([[0, 0, 1],
                        [1, 0, 0],
                        [0, 1, 0]])  # +y +z +x
        return mat, transform.Rotation.from_euler('y', 90, degrees=True)

    if self == GripperFace.GRIPPED_X_POSITIVE:
        mat = np.array([[0, 0, 1],
                        [0, 1, 0],
                        [-1, 0, 0]])  # -z y +x
        return mat, transform.Rotation.from_euler('x', -90, degrees=True)

    if self == GripperFace.GRIPPED_X_NEGATIVE:
        mat = np.array([[0, 0, 1],
                        [0, -1, 0],
                        [1, 0, 0]])  # z -y +x
        return mat, transform.Rotation.from_euler('x', 90, degrees=True)

to_vector(self)

Converts the gripper face to its vector representation.

Returns:

Type Description
ndarray

the vector

Source code in core/grip_target_generation/GripperFace.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def to_vector(self) -> np.ndarray:
    """Converts the gripper face to its vector representation.

        Returns:
            the vector
    """
    if self == GripperFace.MAIN:
        return np.array([0, 0, 1])

    if self == GripperFace.Y_POSITIVE:
        return np.array([0, 1, 0])

    if self == GripperFace.Y_NEGATIVE:
        return np.array([0, -1, 0])

    if self == GripperFace.GRIPPED_X_POSITIVE:
        return np.array([1, 0, 0])

    if self == GripperFace.GRIPPED_X_NEGATIVE:
        return np.array([-1, 0, 0])