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:new_actions [2019/01/02 16:20] – [Get-trajectory] vanessatutorials:intermediate:new_actions [2019/01/02 17:46] (current) – [Pick-action-designator] vanessa
Line 2: Line 2:
  
 When implementing new type of actions, such as placing, pouring or cutting there are 4 important steps to do. When implementing new type of actions, such as placing, pouring or cutting there are 4 important steps to do.
-In the following Tutorial it is assumed that the basic knowledge about [[http://cram-system.org/doc/package/cram_designators|cram-designator]], [[http://cram-system.org/tutorials/beginner/high_level_plans|high_level_plans]] and [[http://cram-system.org/tutorials/beginner/cram_prolog|cram_prolog_reasoning.]]+In the following Tutorial it is assumed that the basic knowledge about [[http://cram-system.org/doc/package/cram_designators|cram-designator]], [[http://cram-system.org/tutorials/beginner/high_level_plans|high_level_plans]] and [[http://cram-system.org/tutorials/beginner/cram_prolog|cram_prolog_reasoning.]] are given.
 ====== Atomic-action-designator ====== ====== Atomic-action-designator ======
  
Line 162: Line 162:
  </code>  </code>
  
 +Here also failure-handling takes place. At least all low-level-failures should be caught here.
  
 ====== Pick-action-designator ====== ====== Pick-action-designator ======
Line 178: Line 178:
                                                           ?left-grasp-poses ?right-grasp-poses                                                           ?left-grasp-poses ?right-grasp-poses
                                                           ?left-lift-poses ?right-lift-poses))                                                           ?left-lift-poses ?right-lift-poses))
-    ;; extract info from ?action-designator+</code> 
 + 
 +First extract all information from ?action-designator
 +     
 +<code lisp>
     (spec:property ?action-designator (:type :picking-up))     (spec:property ?action-designator (:type :picking-up))
     (spec:property ?action-designator (:object ?object-designator))     (spec:property ?action-designator (:object ?object-designator))
Line 188: Line 192:
         (man-int:robot-free-hand ?_ ?arm))         (man-int:robot-free-hand ?_ ?arm))
     (lisp-fun man-int:get-object-transform ?current-object-desig ?object-transform)     (lisp-fun man-int:get-object-transform ?current-object-desig ?object-transform)
-    ;; infer missing information like ?grasp type, gripping ?maximum-effort, manipulation poses+     
 +    </code> 
 +     
 +Infer missing information like ?grasp type, gripping ?maximum-effort, manipulation poses. Then calculate the object facing, because the system needs to know how the object, that will be picked up, is facing so that the rotation is correctly and the transformation from gripper to object will be properly. 
 +  
 +   <code lisp> 
 + 
     (lisp-fun man-int:calculate-object-faces ?object-transform (?facing-robot-face ?bottom-face))     (lisp-fun man-int:calculate-object-faces ?object-transform (?facing-robot-face ?bottom-face))
     (-> (man-int:object-rotationally-symmetric ?object-type)     (-> (man-int:object-rotationally-symmetric ?object-type)
Line 215: Line 225:
  
  
-First all of the information from the ?action-designator will be extract. After that  all information that are missing from the ?action-designator will be inferred. <code lisp>     (lisp-fun man-int:calculate-object-faces ?object-transform (?facing-robot-face ?bottom-face)) +    
-    (-> (man-int:object-rotationally-symmetric ?object-type) +
-        (equal ?rotationally-symmetric t) +
-        (equal ?rotationally-symmetric nil)) +
-    (-> (spec:property ?action-designator (:grasp ?grasp)) +
-        (true) +
-        (and (lisp-fun man-int:get-object-type-grasps ?object-type ?arm ?object-transform ?grasps) +
-             (member ?grasp ?grasps))) </code>    +
-              +
-The system needs to know how the object, that will be picked up, is facing so that the rotation is correctly and the transformation from gripper to object will be properly.+
 ====== Get-trajectory ====== ====== Get-trajectory ======
  
Line 235: Line 236:
              (type cl-transforms-stamped:transform-stamped object-transform))              (type cl-transforms-stamped:transform-stamped object-transform))
  
-    ;; First correct the object transform such that rotationally-symmetric objects 
-    ;; would not be grasped in an awkward way with weird orientations 
     (when (prolog `(object-rotationally-symmetric ,object-type))     (when (prolog `(object-rotationally-symmetric ,object-type))
       (setf object-transform       (setf object-transform
Line 242: Line 241:
              object-transform              object-transform
              :rotation (cl-transforms:make-identity-rotation))))              :rotation (cl-transforms:make-identity-rotation))))
 +</code>
 +First correct the object transform such that rotationally-symmetric objects would not be grasped in an awkward way with weird orientations. 
  
 +<code lisp>
     (let* ((gripper-tool-frame     (let* ((gripper-tool-frame
              (ecase arm              (ecase arm
Line 276: Line 278:
                            (cram-robot-interfaces:standard-to-particular-gripper-transform                            (cram-robot-interfaces:standard-to-particular-gripper-transform
                             ?robot ?transform))))))))                             ?robot ?transform))))))))
 +                            
 + </code>
 +Next step is to transform all the poses for the action.
 +  * standard gripper transform oTg 
 +  * standard gripper pregrasp transform oTg
 +  * standard gripper second pregrasp transform oTg
 +  * standard gripper lift transform oTg
 +  * standard gripper second lift transform oTg 
 +  * particular gripper transform gTg
 +<code lisp>                           
       (when (and object-to-standard-gripper-transform standard-to-particular-gripper-transform)       (when (and object-to-standard-gripper-transform standard-to-particular-gripper-transform)
  
Line 302: Line 314:
  
 </code> </code>
 +
 +The last step is to calculate the base-to-standard-gripper-transform so that a transformation from object-to-standard-gripper to base-to-particular-gripper can be done. 
 ====== Write a Demo====== ====== Write a Demo======
 +
 +Depending on what the scenario will be a different demo has to take place. In cram/cram_pr2/cram_pr2_pick_place_demo/ the Demo for pick and place is given. 
 +
 +All that is needed:
 +
 +  * Launch file with all important nodes.
 +  * Resources includes all .stl and .dae files from the spawned object in the scenario.
 +  * Then a costmap needs to be defined.
 +  * In projection-demo.lisp all the function that will be called in the demo are implemented e.g. place-object        spawn-objects-on-sink-counter
 +  * In demo.lisp the demo is written and trainings-data.