Skip to content

Runtime Commands

dtdannen edited this page Jul 14, 2015 · 25 revisions

Interactive Runtime Commands

When you run MIDCA with interactive mode enabled (by default) the following commands are available. Examples are from examples/simple_run_arson.py

skip (optional argument x)

Skips ahead x cycles, or one full cycle if x is not given, using

PhaseManager.one_cycle(verbose = 0, pause = 0)

which goes through every phase once. In this example, the phases are

["Simulate", "Perceive", "Interpret", "Eval", "Intend", "Plan", "Act"]

Example:

****** Starting Eval Phase ******
Not all goals achieved; Goal(C_, B_, predicate: on) is not true.
Next MIDCA command:  skip
cycle finished
Next MIDCA command:  
****** Starting Intend Phase ******
Selecting goal(s): Goal(C_, B_, predicate: on)

In this example, the 'Eval' phases finishes, then the user enters 'skip', and the phases Intend, Plan, Act, Simulate, Perceive, Interpret, and Eval are executed in that order. A full cycle was finished.

show

Displays the world using the display function which can be set when PhaseManager is instantiated. In our example, it is set in examples/predicateworld.py

myMidca = base.PhaseManager(world, display = asqiiDisplay)

Continuing with our example, we get the following output:

Next MIDCA command:  show
                        
    -------              
   |  B_  |              
    -------              
    -------        -------
   |  A_  |       |  C_  |
    -------        -------
------------------------------------------

log

Prompts user to enter a message which will be written to the log file. If the user doesn't enter a message, no log message is written.

****** Starting Plan Phase ******
No goals received by planner. Skipping planning.
Next MIDCA command:  log
Input the text to add to MIDCA's log file. Leave empty and press enter to cancel

This is a useful log message
Next MIDCA command: 

And then if we check the log file, we see our message:

$tail log
11:53.632525 - 3 cycles finished.

11:57.407064 - ****** Starting Plan Phase ******

11:57.407396 - Running module <MIDCA.modules.planning.PyHopPlanner
11:57.407523 - Memory access at key __world states
11:57.407660 - Memory access at key __current goals
11:57.407800 - No goals received by planner. Skipping planning.

13:48.705285 - This is a useful log message

drawgoalgraph

Generates a visual representation of the current goal graph. Requirement: Using this command requires you have graphviz installed. If you are on linux, this can probably be installed via

sudo apt-get install graphviz

or downloaded here: (http://www.graphviz.org/). This has not been tested on Windows or Mac yet, only Ubuntu. #TODO

Example:

Suppose that MIDCA had 3 block stacking goals and generated a goal to put out a fire.

****** Starting Intend Phase ******
Selecting goal(s): Goal(B_, D_, predicate: on) Goal(A_, B_, predicate: on) Goal(D_, C_, predicate: on)

and a few phases later...

****** Starting Interpret Phase ******
No anomaly detected.
MIDCA already has a block stacking goal. Skipping TF-Tree stacking goal generation
TF-Tree goal generated: Goal(A_, negate: True, predicate: onfire)
Please input a goal if desired. Otherwise, press enter to continue

****** Starting Eval Phase ******
Not all goals achieved; Goal(B_, D_, predicate: on) is not true.
Next MIDCA command:  drawgoalgraph
Input file name ending in .pdf or press enter to use default filename: goalgraph.pdf

Drawing of current goal graph written to goalgraph.pdf
Next MIDCA command:

In this example, goalgraph.pdf is:

Goal Graph Example

In this goal graph the goal putoutfire has more priority than the block stacking goals. For more details on the goal graph see: coming soon

printtrace

drawtrace

change

help

q

Quit MIDCA

memorydump