22 import cob_grasp_generation.msg
23 from cob_grasp_generation
import or_grasp_generation, grasp_query_utils
28 self.
orgg = or_grasp_generation.ORGraspGeneration()
31 self._as_generate.start()
33 print(
"GenerateGraspsServer: action started...")
39 rospy.loginfo(
'Generating grasps for object %s using gripper_type %s' % (goal.object_name, goal.gripper_type))
41 if grasp_query_utils.check_database(goal.object_name, goal.gripper_type):
42 rospy.logwarn(
'Grasps for object %s exist in the database.', goal.object_name)
45 self.orgg.setup_environment(goal.object_name, goal.gripper_type, goal.viewer)
46 rospy.loginfo(
'GraspTable for object %s does not exist. Now planning Grasps for the object',goal.object_name)
47 num_grasps = self.orgg.generate_grasps(goal.object_name, goal.gripper_type, goal.replan)
51 result = cob_grasp_generation.msg.GenerateGraspsResult()
52 result.success = success
53 result.num_grasps = num_grasps
56 rospy.loginfo(
'Generate: Succeeded')
57 self._as_generate.set_succeeded(result)
59 rospy.logwarn(
'Generate: Failed')
60 self._as_generate.set_aborted(result)
63 if __name__ ==
'__main__':
64 rospy.init_node(
'generate_grasps_server')
def generate_cb(self, goal)