Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tutorials:demo:fetch_and_place_solutions [2019/09/04 19:17] – [Exercise 2] cleaned up gkazhoya | tutorials:demo:fetch_and_place_solutions [2019/09/04 19:39] – [Exercise 1] gkazhoya | ||
---|---|---|---|
Line 40: | Line 40: | ||
(print " | (print " | ||
(cpl:fail ' | (cpl:fail ' | ||
+ | | ||
+ | |||
+ | (defun move-bottle (bottle-spawn-pose) | ||
+ | (spawn-object bottle-spawn-pose) | ||
+ | (with-simulated-robot | ||
+ | (let ((? | ||
+ | (cpl:par | ||
+ | ;; Moving the robot near the table. | ||
+ | (perform (an action | ||
+ | (type going) | ||
+ | | ||
+ | (pose ? | ||
+ | (perform (a motion | ||
+ | (type moving-torso) | ||
+ | (joint-angle 0.3))) | ||
+ | (park-arms))) | ||
+ | (let* ((? | ||
+ | | ||
+ | | ||
+ | ;; Moving the robot near the counter. | ||
+ | (let ((?nav-goal *base-pose-near-counter*)) | ||
+ | (perform (an action | ||
+ | (type going) | ||
+ | | ||
+ | (pose ? | ||
+ | ;; Setting the object down on the counter | ||
+ | (let ((? | ||
+ | (perform (an action | ||
+ | (type placing) | ||
+ | (arm ? | ||
+ | | ||
+ | | ||
+ | (pose ? | ||
+ | (park-arm ? | ||
</ | </ | ||
Line 50: | Line 84: | ||
| | ||
| | ||
+ | | ||
;; Position of the object relative to the robot | ;; Position of the object relative to the robot | ||
- | | + | |
(x (get-x-of-pose obj-in-robot-frame)) | (x (get-x-of-pose obj-in-robot-frame)) | ||
(y (get-y-of-pose obj-in-robot-frame))) | (y (get-y-of-pose obj-in-robot-frame))) | ||
Line 101: | Line 136: | ||
| | ||
(type ? | (type ? | ||
- | + | ||
;; If the action fails, try the following: | ;; If the action fails, try the following: | ||
;; try different look directions until there is none left. | ;; try different look directions until there is none left. | ||
Line 128: | Line 163: | ||
(setf ? | (setf ? | ||
(setf possible-torso-link-positions (rest possible-torso-link-positions)) | (setf possible-torso-link-positions (rest possible-torso-link-positions)) | ||
+ | (setf possible-look-directions `(, | ||
+ | , | ||
+ | , | ||
+ | (setf ? | ||
(perform (a motion | (perform (a motion | ||
(type moving-torso) | (type moving-torso) | ||
Line 136: | Line 175: | ||
- | (defun move-bottle (bottle-spawn-pose) | ||
- | (spawn-object bottle-spawn-pose) | ||
- | (with-simulated-robot | ||
- | (let ((? | ||
- | (cpl:par | ||
- | ;; Moving the robot near the table. | ||
- | (perform (an action | ||
- | (type going) | ||
- | | ||
- | (pose ? | ||
- | (perform (a motion | ||
- | (type moving-torso) | ||
- | (joint-angle 0.3))) | ||
- | (park-arms))) | ||
- | (let* ((? | ||
- | | ||
- | | ||
- | ;; Moving the robot near the counter. | ||
- | (let ((?nav-goal *base-pose-near-counter*)) | ||
- | (perform (an action | ||
- | (type going) | ||
- | | ||
- | (pose ? | ||
- | ;; Setting the object down on the counter | ||
- | (let ((? | ||
- | (perform (an action | ||
- | (type placing) | ||
- | (arm ? | ||
- | | ||
- | | ||
- | (pose ? | ||
- | (park-arm ? | ||
</ | </ |