Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The /normal command does not reset constraint states #70

Open
tmarble opened this issue Jun 28, 2017 · 2 comments
Open

The /normal command does not reset constraint states #70

tmarble opened this issue Jun 28, 2017 · 2 comments
Assignees

Comments

@tmarble
Copy link
Collaborator

tmarble commented Jun 28, 2017

A network reset (as dispatched) will reset constraint states, but not issuing the /normal command.

@tmarble
Copy link
Collaborator Author

tmarble commented Jun 29, 2017

Steps to reproduce:

  1. Go to the PLANVIZ directory (assuming that the PAMELA directory is a sibling)
  2. Generate HTN and TPN using the current version of PAMELA:
    $ ../pamela/bin/pamela -i ../pamela/test/pamela/regression/isr-htn.pamela -f json -o isr-htn.main -t "(isr-htn-demo.htn.main \"A\" \"B\" \"C\" \"D\")" htn
  3. Start PLANVIZ
    $ ./bin/planviz -i isr-htn.main.htn.json=isr-htn.main.tpn.json
  4. Enter the PLANVIZ command: /show isr-htn.main.tpn
    The TPN should now be displayed.
  5. In a separate terminal start the mission simulation:
    java -jar mission-sim-0.1.5-SNAPSHOT-standalone.jar
  6. In a separate terminal start the dispatcher with the TPN:
    java -jar tpn-dispatch-0.1.5-SNAPSHOT-standalone.jar isr-htn.main.tpn.json
    The mission will now execute and change the state of the activities, nodes and constraints.
  7. When the mission is finished enter the PLANVIZ command: /normal
    All the activity and node states are returned to normal, but the constraint's state is not reset.
  8. Note that re-running the dispatch (step 6) causes everything (including constraints) to be reset

@tmarble
Copy link
Collaborator Author

tmarble commented Jun 29, 2017

Steps to investigate using the dual REPL:

  1. For background in using the dual REPL please see the example: https://github.com/tmarble/tenzing3
    • CIDER users: uncomment cider-boot in build.boot
    • Cursive users: visit client.cljs, change the false in (def cursive? false) to true
  2. Start (as needed) the mission sim (see step 5 above)
  3. Start the dual REPL. Here is a CIDER example which shows the server is running on port :8080 but the live reload application is running on :3000
    a. C-c M-J cider-jack-in-clojurescript
    b. The first time promted for Visit ‘http://localhost:3000’ in a browser? (y or n) say n in order to wait for the first ClojureScript compilation to finish.
    c. In the meantime visit server.clj and run M-x cider-eval-buffer
    d. In the CLJ REPL *cider-repl planviz* change the namespace and start the server:
boot.user> (in-ns 'planviz.server)
#namespace[planviz.server]
planviz.server> (visualize {:verbose 2 :log-level :warn
:input ["isr-htn.main.htn.json" "isr-htn.main.tpn.json"]})
17-Jun-29 09:06:44.193 cerise WARN [planviz.server:288] - 
PLANVIZ server ready
nil
planviz.server> 
  1. Now visit client.cljs, make a small edit, undo the edit, save the file: this will cause the browser at :3000 to reload.
    f. In the CLJS REPL *cider-repl CLJS planviz* enter (println 123). You should see only nil in the REPL, but see 123 in the browser JavaScript console.
    g. Visit actions.cljs and run M-x cider-eval-buffer
    h. In the CLJS REPL run (status-msg "hello"). You should see hello appear in the application status line as well as in the JavaScript console.
  2. Show the TPN by running (show-plan-id :isr-htn.main.tpn)
  3. Dispatch the mission (Step 6 above)
  4. Get the current state of the first constraint (:tc-8)
    • NOTE: here we remove the reference to the global :plans/ui-opts state and display functions simply as "fn"
planviz.actions> (remove-fn (dissoc (st/plans-get-edge :isr-htn.main.tpn:tc-8) :plans/ui-opts))
{:edge/type :temporal-constraint,
 :edge/value [20 30],
 :edge/state :failed,
 :edge/from
 {:plan/plid :isr-htn.main.tpn,
  :node/id :node-10,
  :node/x 25,
  :node/y 300},
 :edge/id :tc-8,
 :plan/plid :isr-htn.main.tpn,
 :edge/hidden false,
 :edge/weight 0,
 :edge/to
 {:plan/plid :isr-htn.main.tpn,
  :node/id :node-15, 
  :node/x 123, 
  :node/y 300}}
  1. Verify the state of the constraint:
planviz.actions> (:edge/state (st/plans-get-edge :isr-htn.main.tpn:tc-8))
:failed
planviz.actions> 
  1. You can manually reset the state of the constraint to :normal (notice the display update automatically):
planviz.actions>(st/plans-merge-edge {:plan/plid :isr-htn.main.tpn, :edge/id :tc-8, :edge/state :normal})
nil
planviz.actions> 
  1. Now set the constraint state back to :failed
  2. Now try the /normal command by executing it directly as (color-normal). NOTE that only the activity state is reset. See actions.cljs:1659
  3. Now try the function (all-normal)
  4. Note that the bindings between PLANVIZ command strings and functions is at actions.cljs:1852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants