Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:beginner:process_modules [2014/10/20 12:12] – Edited header to fit to tutorial chain. Next tutorial link left blank however: this will change once the plan library tutorial is specified. mpomarlan | doc:beginner:process_modules [2015/05/11 17:01] (current) – removed gkazhoya | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Creating process modules ====== | ||
- | |||
- | **Description: | ||
- | |||
- | http:// | ||
- | |||
- | |||
- | for more information. | ||
- | |||
- | **Previous Tutorial:** [[doc: | ||
- | **Next Tutorial: | ||
- | |||
- | < | ||
- | (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 ' | ||
- | </ | ||
- | |||
- | |||
- | == Next == | ||
- | |||
- | |||