def print_object_names(): global data_box data_box.delete(1.0, END) objs = The_Agent().controller().objects_currently_in_world() data_box.insert(END, "***Objects in the world*** \n") for obj in objs: data_box.insert(END, obj + "\n")
def resume_planning(do_planning_button): if Shared.currently_planning: do_planning_button["text"] = "Resume Random Planning" Shared.currently_planning = False elif not Shared.currently_learning and not Shared.currently_planning: Shared.currently_planning = True do_planning_button["text"] = "Pause Random Planning" The_Agent().plan()
def reset_vis(): canvas.delete(ALL) canvas.create_line(X(Shared.LEFT_WALL), Y(Shared.FAR_WALL), X(Shared.RIGHT_WALL), Y(Shared.FAR_WALL)) canvas.create_line(X(Shared.LEFT_WALL), Y(Shared.NEAR_WALL), X(Shared.RIGHT_WALL), Y(Shared.NEAR_WALL)) canvas.create_line(X(Shared.LEFT_WALL), Y(Shared.FAR_WALL), X(Shared.LEFT_WALL), Y(Shared.NEAR_WALL)) canvas.create_line(X(Shared.RIGHT_WALL), Y(Shared.FAR_WALL), X(Shared.RIGHT_WALL), Y(Shared.NEAR_WALL)) cur_state = The_Agent().controller().get_current_state().get_quantitative_state() Shared.currently_drawing.acquire() Shared.drawing_queue.put(cur_state) Shared.currently_drawing.release()
def resume_learning(resume_learning_button): if Shared.currently_learning and not Shared.pause_learning: #Currently learning and have not tried to pause. Assume the learning should be paused. resume_learning_button["text"] = "Resume Learning" Shared.pause_learning = True elif not Shared.currently_learning and not Shared.currently_planning: Shared.currently_learning = True #Currently not learning. Assume learning should resume. resume_learning_button["text"] = "Pause Learning" The_Agent().learn()
def manual_move_place(place): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: x, y = [int(num) for num in place.split(',')] The_Agent().controller().do_move_to_place((x, y))
def manual_move_target(target): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: The_Agent().controller().do_move_action_on_target(target)
def manual_hit_random(): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: The_Agent().controller().do_hit_action_on_random()
def manual_ungrasp(): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: The_Agent().controller().do_ungrasp_action()
def show_next_example(): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: The_Agent().show_next_example()
def test_constraints(text_widget): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: #Shared.currently_planning = True text = text_widget.get(1.0, END) #What should the parameters be? constraints = extract_effects(text) The_Agent().find_place(constraints)
def hand_at_plan(): goal = Fact("+hand_at", [(74, 65)]) The_Agent().plan_for_goals([goal])
def make_plan(text_widget): if not Shared.currently_planning and not Shared.currently_learning and not Shared.showing_example: #Shared.currently_planning = True text = text_widget.get(1.0, END) #What should the parameters be? goals = extract_effects(text) The_Agent().plan_for_goals(goals)
def knowledge_file(): if not Shared.currently_planning and not Shared.currently_learning: The_Agent().make_knowledge_file()
def sim_reset(): if not Shared.currently_planning and not Shared.currently_learning: The_Agent().controller().reset() reset_vis()
def print_state(): print("=======CURRENT STATE OF WORLD=======") qual_state = The_Agent().controller().get_current_state() for fact in qual_state.get_qualitative_facts() + qual_state.facts_for_place(((qual_state.hand_quant_x(), qual_state.hand_quant_y()), "Current")): print(fact) print("====================================")