Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:intermediate:performing_plans [2016/07/21 15:37] gkazhoyatutorials:intermediate:performing_plans [2022/03/30 21:26] (current) – [Plan goals] schimpf
Line 1: Line 1:
-====== Performing Activities ======+====== Performing Actions ======
  
 ===== Basic functionality ===== ===== Basic functionality =====
Line 8: Line 8:
  
 <code lisp> <code lisp>
-CL-USER> (ros-load:load-system "cram_plan_library" :cram-plan-library+CL-USER> (ros-load:load-system "cram_executive" :cram-executive
-;; or ,r-l-s RET cram_plan_library RET RET+;; or ,r-l-s RET cram_executive RET RET
 </code> </code>
  
Line 15: Line 15:
  
 <code lisp> <code lisp>
-CL-USER> (cpl:def-cram-function eat (stuff+CL-USER> (cpl:def-cram-function eat (&key ((:yummy ?yummy)) &allow-other-keys) 
-           (format t "hmmm... nomnomnom... ~a~%" stuff))+           (declare (type (or string null) ?yummy)
 +           (format t "hmmm... nomnomnom... ~a~%" ?yummy))
 </code> </code>
  
Line 22: Line 23:
  
 <code lisp> <code lisp>
-CL-USER> (prolog:def-fact-group eating-plans (desig:action-desig+CL-USER> (prolog:def-fact-group eating-plans (desig:action-grounding
-           (prolog:<- (desig:action-desig ?action-designator (eat ?object)) +             (prolog:<- (desig:action-grounding ?action-designator (eat ?action-designator)) 
-             (desig:desig-prop ?action-designator (:to :eat)) +                        (desig:desig-prop ?action-designator (:to :eat)) 
-             (desig:desig-prop ?action-designator (:yummy ?object))))+                        (desig:desig-prop ?action-designator (:yummy ?object))))
 </code> </code>
  
Line 34: Line 35:
 <code lisp> <code lisp>
 CL-USER> (cpl:top-level CL-USER> (cpl:top-level
-           (plan-lib:perform (desig:an action (to eat) (yummy pizza))))+           (exe:perform (desig:an action (to eat) (yummy pizza))))
 hmmm... nomnomnom... PIZZA hmmm... nomnomnom... PIZZA
 +NIL
 +#<A ACTION
 +    (TO EAT)
 +    (YUMMY PIZZA)>
 </code> </code>
  
Line 44: Line 49:
 <code lisp> <code lisp>
 CL-USER> (cpl:top-level CL-USER> (cpl:top-level
-           (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)))))
 WARNING: WARNING:
    Trying to prove goal (OBJECT-EATEN    Trying to prove goal (OBJECT-EATEN
Line 62: Line 67:
 CL-USER> (defparameter *pizza-eaten-p* nil) CL-USER> (defparameter *pizza-eaten-p* nil)
 *PIZZA-EATEN-P* *PIZZA-EATEN-P*
-CL-USER> (cpl:def-cram-function eat (stuff+CL-USER> (cpl:def-cram-function eat (&key ((:yummy ?yummy)) &allow-other-keys) 
-           (format t "hmmm... nomnomnom... ~a~%" stuff)+           (declare (type (or string null) ?yummy)
 +           (format t "hmmm... nomnomnom... ~a~%" ?yummy)
            (setf *pizza-eaten-p* t))            (setf *pizza-eaten-p* t))
-STYLE-WARNING: redefining COMMON-LISP-USER::EAT in DEFUN+; in: CRAM-LANGUAGE-IMPLEMENTATION:DEF-CRAM-FUNCTION EAT 
 +;     (TYPE (OR STRING NULL) ?YUMMY) 
 +;  
 +; caught WARNING: 
 +;   undefined variable: COMMON-LISP-USER::?YUMMY 
 +;  
 +; compilation unit finished 
 +;   Undefined variable: 
 +;     ?YUMMY 
 +;   caught 1 WARNING condition 
 +WARNING: redefining COMMON-LISP-USER::EAT in DEFUN
 EAT EAT
 CL-USER> (prolog:def-fact-group eating-occasions () CL-USER> (prolog:def-fact-group eating-occasions ()
-           (prolog:<- (cram-plan-occasions-events::object-eaten ?object)+           (prolog:<- (:object-eaten ?object)
              (prolog:symbol-value *pizza-eaten-p* ?eaten)              (prolog:symbol-value *pizza-eaten-p* ?eaten)
              (prolog:lisp-pred identity ?eaten)))              (prolog:lisp-pred identity ?eaten)))
Line 79: Line 95:
 <code lisp> <code lisp>
 PLAN-LIB> (cpl:top-level PLAN-LIB> (cpl:top-level
-            (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 NIL
Line 87: Line 103:
  
 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. 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.**
-Also, if the same action designator can be executed by both a process module or a high-level plan, the precedence will always be given to the process module as it should get the most specific designators. +
- +
-Summary: **make sure an action designator you use for plans can only be resolved to one unique CRAM plan and that the process modules always get as input one level more detailed action designator than the plan. Even better is to not have similar action designators for PMs and those for plans.**+