Ejemplo n.º 1
0
with open("mongo_adress_list.json") as adress_file:
    adress_list = json.load(adress_file)

for adress in adress_list:
    try:
        web_asker = WebAsker(adress)
    except Exception, e:
        print "Cannot reach {}.".format(adress)
        print "Trying next adress..."
    else:
        break

if web_asker is None:
    print "Cannot reach any adress."
else:
    web_asker.clear_all()

    t = 0
    last_t = 0
    window = 1
    period = 0.05

    pause_question = web_asker.ask("Pause ?", ["Pause !"], priority=10)
    feedback_question = web_asker.ask("Rate behavior : ", [])

    while True:
        if pause_question.answered():
            feedback_question.remove()
            pause_question.remove()

            web_asker.ask("Restart ?", ["Restart !"], priority=10).get_answer()
Ejemplo n.º 2
0
with open("mongo_adress_list.json") as adress_file:
    adress_list = json.load(adress_file)

for adress in adress_list:
    try:
        web_asker = WebAsker(adress)
    except Exception, e:
        print "Cannot reach {}.".format(adress)
        print "Trying next adress..."
    else:
        break

if web_asker is None:
    print "Cannot reach any adress."
else:
    web_asker.clear_all()

    while True:
        question = web_asker.ask("Pick an action :",
            ["Wait", "Hold", "Pick", "Give", "Go_home"])
        action = question.get_answer().lower()

        if action == "wait":
            action_tuple = action

        elif action == "hold":
            question = web_asker.ask("Pick an object :",
                ["Handle", "Side_left", "Side_right", "Side_front", "Side_back"])
            obj = question.get_answer().lower()

            question = web_asker.ask("Pick a pose :", ["0", "1"])