Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:intermediate:new_actions [2018/12/30 15:11] – [Atomic-action-designator] vanessa | tutorials: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:// | + | In the following Tutorial it is assumed that the basic knowledge about [[http:// |
====== Atomic-action-designator ====== | ====== Atomic-action-designator ====== | ||
Line 37: | Line 37: | ||
(once (or (spec: | (once (or (spec: | ||
(equal ? | (equal ? | ||
- | | + | |
- | . | + | |
- | . | + | |
- | . | + | |
</ | </ | ||
- | Here are all the specs for a designator described. First the designator for :going needs a ? | + | Here are all the specs for a designator described. |
+ | First the designator for :going needs a ? | ||
The second designator :grapsing needs more variable like move-arm-in-sequence, | The second designator :grapsing needs more variable like move-arm-in-sequence, | ||
It is important to know the link of the object such that the coordinate frames in the world can be translated from gripper to object so that the robot can pick the object. | It is important to know the link of the object such that the coordinate frames in the world can be translated from gripper to object so that the robot can pick the object. | ||
+ | |||
This designator can now either be used for :grapsing or :pulling. | This designator can now either be used for :grapsing or :pulling. | ||
+ | ---- | ||
+ | |||
+ | When a new type of action is now implemented it is significant to know what specs you will need e.g. | ||
+ | |||
+ | For type : | ||
+ | |||
+ | <code lisp> | ||
+ | | ||
+ | ? | ||
+ | (or (spec: | ||
+ | (spec: | ||
+ | (spec: | ||
+ | (spec: | ||
+ | | ||
+ | </ | ||
====== Pick-action-plan ====== | ====== Pick-action-plan ====== | ||
+ | After writing the atomic-action-designators the action needs to be implemented as an plan. | ||
+ | What is required for picking up: | ||
+ | |||
+ | |||
+ | * First the gripper needs to be open to grab an object. | ||
+ | * Second the hand (gripper) needs to reach the object. | ||
+ | * Third the object needs to be hold in the gripper (grasping and gripping). | ||
+ | * The last thing to do is to lift the object with the gripper. For every single action here a action-designator needs to be called e.g. | ||
+ | |||
+ | <code lisp> | ||
+ | | ||
+ | | ||
+ | (type setting-gripper) | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The variables that are handed over here to the action-designator needs be called in the parameter-list. | ||
+ | |||
+ | <code lisp> | ||
+ | ;; | ||
+ | |||
+ | (in-package :pp-plans) | ||
+ | |||
+ | (cpl: | ||
+ | ?arm ? | ||
+ | ? | ||
+ | ? | ||
+ | ? | ||
+ | (cram-tf: | ||
+ | :r-g-b-list '(1 1 0) :id 300) | ||
+ | |||
+ | (cpl:par | ||
+ | (roslisp: | ||
+ | (exe: | ||
+ | | ||
+ | (type setting-gripper) | ||
+ | | ||
+ | | ||
+ | (roslisp: | ||
+ | (cpl: | ||
+ | ((common-fail: | ||
+ | | ||
+ | " | ||
+ | e) | ||
+ | ;; (return) | ||
+ | )) | ||
+ | (exe: | ||
+ | | ||
+ | (type reaching) | ||
+ | | ||
+ | | ||
+ | (cpl: | ||
+ | ((common-fail: | ||
+ | | ||
+ | " | ||
+ | e) | ||
+ | | ||
+ | )) | ||
+ | (exe: | ||
+ | | ||
+ | (type grasping) | ||
+ | | ||
+ | | ||
+ | | ||
+ | (roslisp: | ||
+ | (exe: | ||
+ | | ||
+ | (type gripping) | ||
+ | | ||
+ | | ||
+ | | ||
+ | (roslisp: | ||
+ | (cram-occasions-events: | ||
+ | | ||
+ | : | ||
+ | :arm ?arm | ||
+ | : | ||
+ | (roslisp: | ||
+ | (cpl: | ||
+ | ((common-fail: | ||
+ | | ||
+ | " | ||
+ | e) | ||
+ | | ||
+ | (exe: | ||
+ | | ||
+ | (type lifting) | ||
+ | | ||
+ | | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Here also failure-handling takes place. At least all low-level-failures should be caught here. | ||
====== Pick-action-designator ====== | ====== Pick-action-designator ====== | ||
+ | |||
+ | Now it is necessary to define a action designator of the new type for pick-up e.g. | ||
+ | |||
+ | <code lisp> | ||
+ | ;; | ||
+ | (def-fact-group pick-and-place-plans (desig: | ||
+ | (<- (desig: | ||
+ | ? | ||
+ | ? | ||
+ | ? | ||
+ | ? | ||
+ | </ | ||
+ | |||
+ | First extract all information from ? | ||
+ | | ||
+ | <code lisp> | ||
+ | (spec: | ||
+ | (spec: | ||
+ | (desig: | ||
+ | (spec: | ||
+ | (spec: | ||
+ | (-> (spec: | ||
+ | (true) | ||
+ | (man-int: | ||
+ | (lisp-fun man-int: | ||
+ | | ||
+ | </ | ||
+ | | ||
+ | Infer missing information like ?grasp type, gripping ? | ||
+ | |||
+ | < | ||
+ | |||
+ | (lisp-fun man-int: | ||
+ | (-> (man-int: | ||
+ | (equal ? | ||
+ | (equal ? | ||
+ | (-> (spec: | ||
+ | (true) | ||
+ | (and (lisp-fun man-int: | ||
+ | | ||
+ | (lisp-fun man-int: | ||
+ | (lisp-fun man-int: | ||
+ | (lisp-fun man-int: | ||
+ | ? | ||
+ | ? | ||
+ | (lisp-fun man-int: | ||
+ | ? | ||
+ | ? | ||
+ | (lisp-fun extract-pick-up-manipulation-poses ?arm ?left-poses ? | ||
+ | (? | ||
+ | ? | ||
+ | ? | ||
+ | |||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | | ||
====== Get-trajectory ====== | ====== Get-trajectory ====== | ||
+ | <code lisp> | ||
+ | ;; | ||
+ | (defgeneric get-object-grasping-poses (object-name object-type arm grasp object-transform) | ||
+ | (: | ||
+ | (:method (object-name object-type arm grasp object-transform) | ||
+ | (declare (type symbol object-name object-type arm grasp) | ||
+ | (type cl-transforms-stamped: | ||
+ | (when (prolog `(object-rotationally-symmetric , | ||
+ | (setf object-transform | ||
+ | (cram-tf: | ||
+ | | ||
+ | : | ||
+ | </ | ||
+ | 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 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | object-type object-name arm grasp | ||
+ | object-to-standard-gripper-transform)) | ||
+ | | ||
+ | | ||
+ | object-type object-name arm grasp | ||
+ | object-to-standard-gripper-transform)) | ||
+ | | ||
+ | | ||
+ | object-type object-name arm grasp | ||
+ | object-to-standard-gripper-transform)) | ||
+ | | ||
+ | | ||
+ | object-type object-name arm grasp | ||
+ | object-to-standard-gripper-transform)) | ||
+ | | ||
+ | | ||
+ | gripper-tool-frame | ||
+ | gripper-tool-frame | ||
+ | 0.0 | ||
+ | (cut: | ||
+ | '? | ||
+ | (car (prolog: | ||
+ | `(and (cram-robot-interfaces: | ||
+ | | ||
+ | ?robot ? | ||
+ | | ||
+ | </ | ||
+ | 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) | ||
+ | |||
+ | (flet ((object-to-standard-gripper-> | ||
+ | (when object-to-standard-gripper | ||
+ | (let ((base-to-standard-gripper-transform | ||
+ | | ||
+ | cram-tf: | ||
+ | object-transform | ||
+ | object-to-standard-gripper ; oTg' | ||
+ | : | ||
+ | | ||
+ | cram-tf: | ||
+ | base-to-standard-gripper-transform | ||
+ | standard-to-particular-gripper-transform ; g'Tg | ||
+ | : | ||
+ | |||
+ | (mapcar #' | ||
+ | (list object-to-standard-gripper-pregrasp-transform | ||
+ | object-to-standard-gripper-2nd-pregrasp-transform | ||
+ | object-to-standard-gripper-transform | ||
+ | object-to-standard-gripper-lift-transform | ||
+ | object-to-standard-gripper-2nd-lift-transform))))))) | ||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | 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/ | ||
+ | |||
+ | 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 | ||
+ | * In demo.lisp the demo is written and trainings-data. |