-
Notifications
You must be signed in to change notification settings - Fork 7
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
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.
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_ |
------- -------
------------------------------------------
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
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:
In this goal graph the goal !onfire(A_) has more priority than the block stacking goals. For more details on the goal graph see: coming soon
This will output a text representation of the entire trace up until the last phase executed by MIDCA.
This will create a pdf file showing a more visual depiction (linear graph) of the trace of execution. When prompted for the file name for the pdf file, if the user doesn't specify, then the filename will default to trace.pdf and will be in the current directory (the directory in which MIDCA was started).
This will allow you change the state of the world. You can either give a file name to be loaded, or you can enter atoms one at a time. Here is an example with blocksworld (examples/cogsci_demo.py):
****** Starting Simulate Phase ******
Simulator: no actions selected yet by MIDCA.
/ \
/ \
/ D_ \
-------
| B_ |
-------
------- -------
| A_ | | C_ |
------- -------
------------------------------------------
Next MIDCA command: change
Enter 'clear' to clear the world state, 'file' to input a state file name, or nothing to finish. Otherwise, enter
changes to the world state. Use ! to negate atoms or remove objects, e.g. !on(A,B). Note that syntax is shared
with state files in midca/worldsim/states, and each command must be on it's own line.
Next change: on(D_,C_)
Change applied
Next change: !on(D_,B_)
Change applied
Next change:
Next MIDCA command: show
------- / \
| B_ | / \
------- / D_ \
------- -------
| A_ | | C_ |
------- -------
------------------------------------------
Displays the possible commands that can be given to MIDCA during runtime (the commands detailed here).
Quit MIDCA
This will allow you to see variables in MIDCA's memory. This is useful when you want to see the value of some variable. You can either see all the variables and their values, or you can enter a single variable name and just see that value. If MIDCA has been running a long time, the output may take up more than the screen, therefore just looking for the variable you'd like can save space.
Turn off / on meta output. It is useful to turn this off to reduce the amount of text seen while running MIDCA. The first time you run this command it will turn the meta output OFF and then you can turn it on later by running the command again.
Go to MIDCA Home page