def euler_to_rotation_matrix(hpr):
    """
    Convert ZYX Euler angles to a rotation matrix.

    Parameters:
        hpr (array-like): [yaw (Z), pitch (Y), roll (X)] in degrees.

    Returns:
        numpy.ndarray: 3x3 rotation matrix.
    """
    hpr = np.radians(hpr)

    cz, sz = np.cos(hpr[0]), np.sin(hpr[0])  # Yaw (Z)
    cy, sy = np.cos(hpr[1]), np.sin(hpr[1])  # Pitch (Y)
    cx, sx = np.cos(hpr[2]), np.sin(hpr[2])  # Roll (X)

    rotation_matrix = np.array(
        [
            [cz * cy, cz * sy * sx - sz * cx, cz * sy * cx + sz * sx],
            [sz * cy, sz * sy * sx + cz * cx, sz * sy * cx - cz * sx], [-sy, cy * sx, cy * cx]
        ]
    )

    return rotation_matrix

    Convert ZYX Euler angles to a rotation matrix.

    Parameters:
        hpr (array-like): [yaw (Z), pitch (Y), roll (X)] in degrees.

    Returns:
        numpy.ndarray: 3x3 rotation matrix.
    
metadrive/component/sensors/point_cloud_lidar.py