21 import cob_grasp_generation.msg
22 from cob_grasp_generation
import or_grasp_generation, grasp_query_utils
27 self.
orgg = or_grasp_generation.ORGraspGeneration()
32 print(
"ShowGraspsOrServer: action started...")
38 rospy.loginfo(
'Show grasp %i for object %s using gripper_type %s' % (goal.grasp_id, goal.object_name, goal.gripper_type))
40 if grasp_query_utils.check_database(goal.object_name, goal.gripper_type):
41 self.orgg.setup_environment(goal.object_name, goal.gripper_type, viewer=
True)
42 rospy.loginfo(
'Display Grasp. Object: %s | ID: %i' % (goal.object_name, goal.grasp_id))
43 self.orgg.show_grasp(goal.object_name, goal.gripper_type, goal.grasp_id, goal.sort_by_quality)
46 rospy.logerr(
'GraspTable for Object %s does not exist!' % (goal.object_name))
48 result = cob_grasp_generation.msg.ShowGraspsResult()
49 result.success = success
52 rospy.loginfo(
'Show: Succeeded')
53 self._as_show.set_succeeded(result)
55 rospy.logwarn(
'Show: Failed')
56 self._as_show.set_aborted(result)
59 if __name__ ==
'__main__':
60 rospy.init_node(
'show_grasps_or_server')