Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:intermediate:performing_plans [2016/07/21 15:07] – gkazhoya | tutorials:intermediate:performing_plans [2022/03/30 21:26] (current) – [Plan goals] schimpf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Performing | + | ====== Performing |
- | ==== Basic functionality ==== | + | ===== Basic functionality |
This is a short tutorial to showcase how to call plans through performing action designators. | This is a short tutorial to showcase how to call plans through performing action designators. | ||
- | Let's first load the plan library system | + | Let's first load the CRAM plan library system: |
<code lisp> | <code lisp> | ||
- | CL-USER> (ros-load: | + | CL-USER> (ros-load: |
- | ;; or ,r-l-s RET cram_plan_library | + | ;; or ,r-l-s RET cram_executive |
- | CL-USER> (in-package : | + | |
</ | </ | ||
Line 16: | Line 15: | ||
<code lisp> | <code lisp> | ||
- | PLAN-LIB> (cpl: | + | CL-USER> (cpl: |
- | (format t " | + | |
+ | | ||
</ | </ | ||
Line 23: | Line 23: | ||
<code lisp> | <code lisp> | ||
- | PLAN-LIB> (prolog: | + | CL-USER> (prolog: |
- | (prolog:< | + | |
- | (desig: | + | (desig: |
- | (desig: | + | (desig: |
</ | </ | ||
Line 34: | Line 34: | ||
<code lisp> | <code lisp> | ||
- | PLAN-LIB> (cpl: | + | CL-USER> (cpl: |
- | (plan-lib:perform (desig:an action (to eat) (yummy pizza)))) | + | |
hmmm... nomnomnom... PIZZA | hmmm... nomnomnom... PIZZA | ||
+ | NIL | ||
+ | #<A ACTION | ||
+ | (TO EAT) | ||
+ | (YUMMY PIZZA)> | ||
</ | </ | ||
- | ==== Plan goals ==== | + | ===== Plan goals ===== |
Now, let's assume that our action has an explicit effect we would like to follow: | Now, let's assume that our action has an explicit effect we would like to follow: | ||
<code lisp> | <code lisp> | ||
- | PLAN-LIB> (cpl: | + | CL-USER> (cpl: |
- | (plan-lib:perform (desig:an action (to eat) (yummy pizza) (goal (object-eaten pizza))))) | + | |
WARNING: | WARNING: | ||
| | ||
Line 62: | Line 65: | ||
<code lisp> | <code lisp> | ||
- | PLAN-LIB> (defparameter *pizza-eaten-p* nil) | + | CL-USER> (defparameter *pizza-eaten-p* nil) |
*PIZZA-EATEN-P* | *PIZZA-EATEN-P* | ||
- | PLAN-LIB> (cpl: | + | CL-USER> (cpl: |
- | (format t " | + | |
- | (setf *pizza-eaten-p* t)) | + | |
- | STYLE-WARNING: redefining | + | |
- | PLAN-LIB> (prolog: | + | ; in: CRAM-LANGUAGE-IMPLEMENTATION: |
- | (prolog:< | + | ; (TYPE (OR STRING NULL) ?YUMMY) |
- | (prolog: | + | ; |
+ | ; caught WARNING: | ||
+ | ; | ||
+ | ; | ||
+ | ; compilation unit finished | ||
+ | ; | ||
+ | ; ? | ||
+ | ; | ||
+ | WARNING: redefining | ||
+ | EAT | ||
+ | CL-USER> (prolog: | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
Line 79: | Line 95: | ||
<code lisp> | <code lisp> | ||
PLAN-LIB> | PLAN-LIB> | ||
- | (plan-lib:perform (desig:an action (to eat) (yummy pizza) (goal (object-eaten pizza))))) | + | (exe:perform (desig:an action (to eat) (yummy pizza) (goal (object-eaten pizza))))) |
hmmm... nomnomnom... PIZZA | hmmm... nomnomnom... PIZZA | ||
+ | NIL | ||
</ | </ | ||
+ | ===== Restrictions ===== | ||
- | + | Please keep in mind that if there are multiple solutions to a particular action designator, i.e. it resolves to different plans, the first one that is defined will be executed. Ordering is not yet implemented and should probably be taken care of explicitly in the plans anyway. | |
+ | Summary: **make sure an action designator you use for plans can only be resolved to one unique CRAM plan.** |