The SereactClient
is a Python package specifically designed to facilitate interaction with the Sereact Picking Server through gRPC communication. This class offers a clean and intuitive interface for sending requests to the server while effectively managing response statuses.
It will be relased as an open-source python package soon.
Constructor
__init__(self, url: str, sereact_api_key: str) -> None
Initializes a new instance of the SereactClient
class.
- Parameters:
url
(str): The URL of the Sereact Picking Serversereact_api_key
(str): The API key required for authorization in requests. This key is provided by Sereact GmbH upon request.
Methods
connect() -> bool
Establishes a connection to the Sereact server using the provided url
. Returns True
if the connection is successfully established.
- Returns:
bool
: The status of the connection.
get_connection_status() -> bool
Returns the current connection status. True
indicates that the connection is still established; otherwise, it returns False
.
- Returns:
bool
: The current connection status.
get_grasp(rgb: np.ndarray, depth: np.ndarray, camera_parameters: dict[str]) -> List[dict]
Sends an image to the Sereact Picking Server and receives grasping information in the form of a list of available objects.
-
Parameters:
rgb
: A numpy array holding the RGB image.depth
: A numpy array holding the depth image.camera_parameters
: Current camera parameters. It must follow this dictionary format:
{ "intrinsics": #Camera intrinsic { "fx": 0, "fy": 0, "cx": 0, "cy": 0, } "pose": # Camera 7D pose { "position": [0.0, 0.0, 0.0] # Camera postion in 3D "quaternion": [1.0, 0.0, 0.0, 0.0] # Camerea quaternion in (w,x,y,z) order } }
-
Returns:
List[dict]
: Return a list of the grasps information, each grasp dictionary has the following information:{ "grasp_point": # The grasp point in image coordinate { "u": 0, "v": 0, } "grasp_pose": # The grasping pose in 3D world { "position": [0.0, 0.0, 0.0] # grasping postion in 3D "quaternion": [1.0, 0.0, 0.0, 0.0] # grasping quaternion in (w,x,y,z) order } "grasp_info": { #Additional grasp information } }