def ros_style_midca():
    myMidca = base.MIDCA(None, verbose=2)
    for phase in ["Perceive", "Interpret", "Eval", "Intend", "Plan", "Act"]:
        myMidca.append_phase(phase)

    myMidca.append_module("Perceive", perceive.ROSObserver())
    myMidca.append_module("Interpret", guide.InstructionReceiver_sr())
    myMidca.append_module("Eval", evaluate.EvalPointingFromFeedback())
    myMidca.append_module("Intend", intend.SimpleIntend())
    myMidca.append_module(
        "Plan",
        planning.AsynchPyhopPlanner(methods_sr.declare_methods,
                                    operators_sr.declare_ops))
    myMidca.append_module("Act", act.AsynchronousAct())
    return myMidca
Exemple #2
0
        "Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan", "Act"
]:
    myMidca.append_phase(phase)

#add the modules which instantiate basic blocksworld operation
myMidca.append_module("Simulate",
                      simulator.ASCIIWorldViewer(display=DISPLAY_FUNC))
myMidca.append_module("Perceive", perceive.GraceObserver())
myMidca.append_module("Interpret", guide.MoosGoalInput())
myMidca.append_module("Eval", evaluate.SimpleEval())
myMidca.append_module("Intend", intend.SimpleIntend())
myMidca.append_module(
    "Plan",
    planning.JSHOPPlanner(grace_util.jshop2_state_from_world,
                          grace_util.jshop2_tasks_from_goals,
                          JSHOP_DOMAIN_FILE, JSHOP_STATE_FILE))
myMidca.append_module("Act", act.AsynchronousAct())

#tells the PhaseManager to copy and store MIDCA states so they can be accessed later.
myMidca.storeHistory = True

myMidca.init()
myMidca.run(usingInterface=False)
'''
The code below would print out MIDCA's goal set for the first 20 phases of the run above. Note that any memory values can be accessed in this way, assuming that the storeHistory value was set to True during the run. This code is left as an example, but commented out because it will throw an error if fewer than 20 cycles were simulated.

for i in range(20):
    print myMidca.history[i].mem.get(myMidca.midca.mem.CURRENT_GOALS)

'''