Grasp Annotator Service
The Grasp Annotator Service provides an interface to annotate grasp poses on an object.
Skill development
To access grasp annotator, a skill can depend on a Grasp Annotator Service in its implementation.
Declare dependency
In the skill's manifest, add to existing dependencies or create a new dependencies value.
For more detailed information on skill manifest, check out Interact with a service
Add a new required_equipment key value pair to existing dependencies map or create a new dependencies map value if there isn't one:
dependencies {
required_equipment {
key: "grasp_annotator_service"
value {
capability_names: "intrinsic_proto.grasping.service.grasp_annotator_service.v1.GraspAnnotatorService"
}
}
}
Utilize Grasp Annotator in skill execute
The grasp annotator service provides a gRPC interface that contains:
Annotate method, that returns grasps annotations for a specified object and gripper parameterization. It (supports annotations for both pinch and suction-type grippers.
The grasp_annotator_client provides an easy to use interface to the service. In the code snippet below, the skill input params contain the fields in grasp annotator proto which can be used directly to get a response from the service via the client:
from intrinsic.manipulation.service import grasp_annotator_service_pb2_grpc
from intrinsic.manipulation.grasping import grasp_annotator_client
@overrides(skill_interface.Skill)
def execute(
self,
request,
context,
):
"""An example in which a skill's execute method uses the grasp annotator service."""
skill_params = request.params
GRASP_ANNOTATOR_SERVICE_KEY = "grasp_annotator_service"
grasp_annotator_service_handle = context.resource_handles[GRASP_ANNOTATOR_SERVICE_KEY]
channel, client = grasp_annotator_client.GraspAnnotatorClient.connect(
address=grasp_annotator_service_handle.connection_info.grpc.address
)
annotator_request = grasp_annotator_service_pb2.GraspAnnotatorRequest(
mesh_data=skill_params.mesh_data,
gripper_specs=skill_params.gripper_specs,
num_samples=skill_params.num_samples,
)
grasp_annotations = client.annotate_grasps(annotator_request)
channel.close()
# Use grasp annotations ...