コード例 #1
0
 def __get_service_area(self, userdata):
     task = copy.deepcopy(userdata.task_spec_trans_in)
     name = copy.deepcopy(userdata.grasped_object_in)
     task_man = TaskSpecificationMan(None,None)
     for place in task.goalsituation.places:
         if task_man.translate_object_names(name) in place.objects:
             return place.name
コード例 #2
0
    def execute(self, userdata):
        task = const_hack(userdata.task_spec_trans_io)
        ts = TaskSpecificationMan('', [])
        name = ts.translate_object_names(userdata.grasped_objects_in)

        for place in task.initialsituation.places:
            print 'name in place.objects: %s in %s' % (name, place.objects)
            if name in place.objects:
                place.remove_object(name)
                print "Removed %s: %s" % (name, place.objects)
                break
        
        for place in task.goalsituation.places:
            print 'name in place.objects: %s in %s' % (name, place.objects)
            if name in place.objects:
                place.remove_object(name)
                print "Removed %s: %s" % (name, place.objects)
                break
        
        for place in task.initialsituation.places:
            if len(place.objects) == 0:
                task.initialsituation.remove_place(place) 
                print "Removed %s: %s" % (place.name, place.objects)      
        
        for place in task.goalsituation.places:
            if len(place.objects) == 0:
                task.goalsituation.remove_place(place)  
                print "Removed %s: %s" % (place.name, place.objects)
                
        userdata.task_spec_trans_io = task
        if len(task.goalsituation.places) == 0:
            return 'finished'
        else:                
            return 'Object remaining'