Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:beginner:process_modules [2013/12/18 15:56] – bbrieber | doc:beginner:process_modules [2015/05/11 17:01] (current) – removed gkazhoya | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== TODO: THIS TUTORIAL IS NOT DONE YET ====== | ||
| - | http:// | ||
| - | |||
| - | < | ||
| - | (defstruct turtle-shape | ||
| - | " | ||
| - | radius | ||
| - | edges) | ||
| - | |||
| - | |||
| - | (cram-reasoning: | ||
| - | |||
| - | ;; for each kind of shape, call make-turtle-shape with the right number of edges | ||
| - | |||
| - | ;; triangle | ||
| - | (<- (action-desig ?desig (shape ?act)) | ||
| - | (desig-prop ?desig (type shape)) | ||
| - | (desig-prop ?desig (shape triangle)) | ||
| - | (lisp-fun make-turtle-shape :radius 1 :edges 3 ?act)) | ||
| - | |||
| - | ;; square | ||
| - | (<- (action-desig ?desig (shape ?act)) | ||
| - | (desig-prop ?desig (type shape)) | ||
| - | (desig-prop ?desig (shape square)) | ||
| - | (lisp-fun make-turtle-shape :radius 1 :edges 4 ?act)) | ||
| - | |||
| - | ;; pentagon | ||
| - | (<- (action-desig ?desig (shape ?act)) | ||
| - | (desig-prop ?desig (type shape)) | ||
| - | (desig-prop ?desig (shape pentagon)) | ||
| - | (lisp-fun make-turtle-shape :radius 1 :edges 5 ?act)) | ||
| - | |||
| - | ;; hexagon | ||
| - | (<- (action-desig ?desig (shape ?act)) | ||
| - | (desig-prop ?desig (type shape)) | ||
| - | (desig-prop ?desig (shape hexagon)) | ||
| - | (lisp-fun make-turtle-shape :radius 1 :edges 6 ?act))) | ||
| - | |||
| - | (cram-process-modules: | ||
| - | (roslisp: | ||
| - | (destructuring-bind (cmd action-goal) (reference action-designator) | ||
| - | (ecase cmd | ||
| - | (shape | ||
| - | | ||
| - | :edges (turtle-shape-edges action-goal) | ||
| - | :radius (turtle-shape-radius action-goal)))))) | ||
| - | |||
| - | |||
| - | (defmacro with-turtle-process-module (&body body) | ||
| - | `(cpm: | ||
| - | | ||
| - | , | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | (def-fact-group turtle-actuators (matching-process-module | ||
| - | | ||
| - | |||
| - | (<- (matching-process-module ?designator turtle-actuators) | ||
| - | (or (desig-prop ?designator (type shape)))) | ||
| - | |||
| - | </ | ||
| - | < | ||
| - | (top-level (with-turtle-process-modules (with-designators (( my-desig (action ' | ||
| - | </ | ||

