コード例 #1
0
    def execute_cb(self, server_goal):
        x = time.time()
        rospy.loginfo("/get_grasp_configurations_server has been called...")
        server_result = GraspCActionResult().result

        fail = False

        resp = grasping_functions.read_grasps_from_DB(server_goal.object_id)
        if resp == -1:
            resp = grasping_functions.generator(server_goal.object_id)
            if resp != -1:
                resp = grasping_functions.read_grasps_from_DB(
                    server_goal.object_id)
                server_result.grasp_configuration = resp.grasp_configuration
            else:
                fail = True
        else:
            server_result.grasp_configuration = resp.grasp_configuration

        if fail:
            self.get_grasp_configurations.set_aborted(server_result)
        else:
            self.get_grasp_configurations.set_succeeded(server_result)

        print "Time employed: " + str(time.time() - x)
        print "---------------------------------------"
コード例 #2
0
    def execute_cb(self, server_goal):
        x = time.time()
        rospy.loginfo("/get_grasp_configurations_server has been called...")
        server_result = GraspCActionResult().result

        fail = False

        resp = grasping_functions.read_grasps_from_DB(server_goal.object_id)
        if resp == -1:
            resp = grasping_functions.generator(server_goal.object_id)
            if resp != -1:
                resp = grasping_functions.read_grasps_from_DB(server_goal.object_id)
                server_result.grasp_configuration = resp.grasp_configuration
            else:
                fail = True
        else:
            server_result.grasp_configuration = resp.grasp_configuration

        if fail:
            self.get_grasp_configurations.set_aborted(server_result)
        else:
            self.get_grasp_configurations.set_succeeded(server_result)

        print "Time employed: " + str(time.time() - x)
        print "---------------------------------------"
コード例 #3
0
	def get_grasp_configurations(self, server_goal):
		x = time.time();
		rospy.loginfo("/get_grasp_configurations service has been called...");


		server_result = GetGraspConfigurationsResponse();

		resp = grasping_functions.read_grasps_from_DB(server_goal.object_id);
		if resp == -1:
			resp = grasping_functions.generator(server_goal.object_id);
			if resp != -1:
				resp = grasping_functions.read_grasps_from_DB(server_goal.object_id);
				server_result.grasp_configuration = resp.grasp_configuration;
		else:
			server_result.grasp_configuration = resp.grasp_configuration;


		print "Time employed: " + str(time.time() - x);
		print "---------------------------------------";
		return server_result;