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
doc:beginner:process_modules [2013/12/18 15:56] bbrieberdoc:beginner:process_modules [2015/05/11 17:01] (current) – removed gkazhoya
Line 1: Line 1:
-====== TODO: THIS TUTORIAL IS NOT DONE YET ====== 
  
-http://wiki.ros.org/cram_pl/InternalTutorials 
- 
-<code> 
-(defstruct turtle-shape 
-  "represents an object in continuous space matching a symbolic description" 
-  radius 
-  edges) 
- 
- 
-(cram-reasoning:def-fact-group shape-actions (action-desig) 
- 
-  ;; 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:def-process-module turtle-actuators (action-designator) 
-  (roslisp:ros-info (turtle-process-modules) "Turtle navigation invoked with action designator `~a'." action-designator) 
-  (destructuring-bind (cmd action-goal) (reference action-designator) 
-    (ecase cmd 
-      (shape 
-         (call-shape-action 
-          :edges (turtle-shape-edges action-goal) 
-          :radius (turtle-shape-radius action-goal)))))) 
- 
- 
-(defmacro with-turtle-process-module (&body body) 
-  `(cpm:with-process-modules-running 
-       (turtle-actuators) 
-     ,@body)) 
- 
- 
-          
-                    
-(def-fact-group turtle-actuators (matching-process-module 
-                                         available-process-module) 
- 
-  (<- (matching-process-module ?designator turtle-actuators) 
-    (or (desig-prop ?designator (type shape)))) 
- 
-</code> 
-<code> 
-(top-level (with-turtle-process-modules (with-designators (( my-desig (action '((type shape) (shape hexagon))))) (perform my-desig)))) 
-</code>