|
2 | 2 |
|
3 | 3 | (defun format-locations (s obj colonmod at-sign) (declare (ignore colonmod)) (declare (ignore at-sign)) (format s "~s" (get-value obj 'name))) |
4 | 4 |
|
| 5 | +;;;;;;;;;;;;;;;;;;;;; |
| 6 | + |
5 | 7 | ;; MENU |
6 | 8 | (defvar nmbr nil) |
| 9 | +; |
| 10 | +; capture the skill |
| 11 | +(defvar name_skill NIL) |
| 12 | +(defvar in_1_skill NIL) |
| 13 | +(defvar in_2_skill NIL) |
| 14 | +(defvar in_3_skill NIL) |
| 15 | +(defvar out_1_skill NIL) |
| 16 | +(defvar out_2_skill NIL) |
| 17 | +(defvar out_3_skill NIL) |
| 18 | +;(defvar id_skill -1) |
| 19 | +; |
7 | 20 |
|
8 | 21 | (defun menu() |
9 | 22 | (execute '(nav1.tcb-init-navigation)) |
|
23 | 36 | (format t " ---------------------------------------------------- ~%") |
24 | 37 | (format t " 5 - Approach location ~%") |
25 | 38 | (format t " ---------------------------------------------------- ~%") |
26 | | - ;(format t " 95 - Add new locations ~%") |
| 39 | + (format t " 6 - Move robot plain x y angle ~%") ;case 6 - ABR |
| 40 | + (format t " ---------------------------------------------------- ~%") |
| 41 | + ;(format t " 95 - Add new locations ~%") ;ABR |
| 42 | + (format t " 95 - Show skills ~%") |
27 | 43 | (format t " 96 - Show locations ~%") |
28 | 44 | ;(format t " 97 - Save locations to file ~%") |
29 | 45 | ;(format t " 98 - Load locations from file ~%") |
30 | 46 | (format t "99 - quit menu ~%") |
31 | 47 | (format t " 0 - exit ~%") |
32 | | - (setf nmbr (parse-integer (read-line nil))) |
33 | | - (format t "your choice: ~d ~%" nmbr) |
34 | 48 |
|
35 | | - (cond |
36 | | - ((equal nmbr 3) |
37 | | - (execute '(nav1.tcb-joystick-navigation))) |
38 | | - ((equal nmbr 4) |
39 | | - (execute '(nav1.tcb-stop-joystick-navigation))) |
40 | | - ((equal nmbr 5) |
41 | | - (format t "Approach location - known locations: ~%") |
42 | | - (format t "~%~{~/format-locations/~^, ~}~%~%" known-locations) |
43 | | - (format t "Enter location name: ~%") |
44 | | - (setf locations-var (string-upcase (read-line nil))) |
45 | | - (setf locations-var (intern locations-var)) |
46 | | - (format t "your choice: ~a ~%" locations-var) |
47 | | - (execute '(localizationModInst.tcb-activate-localization)) |
48 | | - (execute `(nav1.tcb-approach-location ,locations-var)) |
49 | | - (execute '(localizationModInst.tcb-deactivate-localization))) |
50 | | - ;((equal nmbr 95) |
51 | | - ;(add-locations)) |
52 | | - ((equal nmbr 96) |
53 | | - (show-locations)) |
| 49 | + |
| 50 | + ; ABR - Reading a skill |
| 51 | + (let ((obj_skill (tcl-kb-query :key '(is-a) :value '((is-a skill)) ) )) |
| 52 | + (setf name_skill (get-value obj_skill 'name)) ; read the name of the skill to execute |
| 53 | + (setf in_1_skill (get-value obj_skill 'in_1)) ; read the parameter IN1 of the skill to execute |
| 54 | + (setf in_2_skill (get-value obj_skill 'in_2)) ; read the parameter IN2 of the skill to execute |
| 55 | + (setf in_3_skill (get-value obj_skill 'in_3)) ; read the parameter IN3 of the skill to execute |
| 56 | + (setf out_1_skill (get-value obj_skill 'out_1)) ; read the parameter OUT1 of the skill to execute |
| 57 | + (setf out_2_skill (get-value obj_skill 'out_2)) ; read the parameter OUT2 of the skill to execute |
| 58 | + (setf out_3_skill (get-value obj_skill 'out_3)) ; read the parameter OUT3 of the skill to execute |
| 59 | + (format t "---> name : ~s ~%" name_skill) |
| 60 | + (cond |
| 61 | + ((string-equal name_skill "NIL") ; |
| 62 | + ) |
| 63 | + ((string-equal name_skill "ACTIVATELOCALIZATION") |
| 64 | + (execute '(localizationModInst.tcb-activate-localization)) |
| 65 | + (tcl-kb-update :key '(is-a) :value '((is-a skill_result)(name ACTIVATELOCALIZATION)) ) ;add id_skill |
| 66 | + ) |
| 67 | + ((string-equal name_skill "APPROACHLOCATION") |
| 68 | + (format t "------> DENTRO : ~s ~d ~%" name_skill in_1_skill) |
| 69 | + (setf locations-var "HOME") |
| 70 | + (cond |
| 71 | + ((equal in_1_skill 1.0) |
| 72 | + (setf locations-var "HOME")) |
| 73 | + ((equal in_1_skill 2.0) |
| 74 | + (setf locations-var "SOFA")) |
| 75 | + ((equal in_1_skill 3.0) |
| 76 | + (setf locations-var "TABLE")) |
| 77 | + ((equal in_1_skill 4.0) |
| 78 | + (setf locations-var "BENCH")) |
| 79 | + ) |
| 80 | + (setf locations-var (intern locations-var)) |
| 81 | + (execute `(nav1.tcb-approach-location ,locations-var)) |
| 82 | + (tcl-kb-update :key '(is-a) :value '((is-a skill_result)(name APPROACHLOCATION)) ) |
| 83 | + ) |
| 84 | + ((string-equal name_skill "DEACTIVATELOCALIZATION") |
| 85 | + (execute '(localizationModInst.tcb-deactivate-localization)) |
| 86 | + (tcl-kb-update :key '(is-a) :value '((is-a skill_result)(name DEACTIVATELOCALIZATION)) ) |
| 87 | + ) |
| 88 | + ) |
| 89 | + |
| 90 | + ;(format t "~%--------------------------------~%") |
| 91 | + ;(format t "SKILL ------------------~%") |
| 92 | + ;(format t "name : ~s ~%" (get-value obj_skill 'name)) |
| 93 | + ;(format t " in_1 : ~s ~%" (get-value obj_skill 'in_1)) |
| 94 | + ;(format t " in_2 : ~s ~%" (get-value obj_skill 'in_2)) |
| 95 | + ;(format t " in_3 : ~s ~%" (get-value obj_skill 'in_3)) |
| 96 | + ;(format t " out_1 : ~s ~%" (get-value obj_skill 'out_1)) |
| 97 | + ;(format t " out_2 : ~s ~%" (get-value obj_skill 'out_2)) |
| 98 | + ;(format t " out_3 : ~s ~%" (get-value obj_skill 'out_3)) |
| 99 | + ) |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | +; (setf nmbr (parse-integer (read-line nil))) |
| 107 | +; (format t "your choice: ~d ~%" nmbr) |
| 108 | + |
| 109 | +; (cond |
| 110 | +; ((equal nmbr 3) |
| 111 | +; (execute '(nav1.tcb-joystick-navigation))) |
| 112 | +; ((equal nmbr 4) |
| 113 | +; (execute '(nav1.tcb-stop-joystick-navigation))) |
| 114 | +; ((equal nmbr 5) |
| 115 | +; (format t "Approach location - known locations: ~%") |
| 116 | +; (format t "~%~{~/format-locations/~^, ~}~%~%" known-locations) |
| 117 | +; (format t "Enter location name: ~%") |
| 118 | +; (setf locations-var (string-upcase (read-line nil))) |
| 119 | +; (setf locations-var (intern locations-var)) |
| 120 | +; (format t "your choice: ~a ~%" locations-var) |
| 121 | +; (execute '(localizationModInst.tcb-activate-localization)) |
| 122 | +; (execute `(nav1.tcb-approach-location ,locations-var)) ;ABR - recuperar |
| 123 | +; (execute '(localizationModInst.tcb-deactivate-localization))) |
| 124 | +; ((equal nmbr 6) ; case 6 - ABR |
| 125 | +; (format t " x position ~%") |
| 126 | +; (setf xpos (parse-integer (read-line nil))) |
| 127 | +; (format t " y position ~%") |
| 128 | +; (setf ypos (parse-integer (read-line nil))) |
| 129 | +; (execute '(localizationModInst.tcb-activate-localization)) |
| 130 | +; (execute `(nav1.tcb-move-robot 'plain ,xpos ,ypos 100)) ;ABR - tocando con move_robot |
| 131 | +; (execute '(localizationModInst.tcb-deactivate-localization))) ;end-case 6 - ABR |
| 132 | + ;((equal nmbr 95) ;ABR - undefined function |
| 133 | + ;(add-locations)) ;ABR |
| 134 | +; ((equal nmbr 95) |
| 135 | +; (show-skills)) |
| 136 | +; ((equal nmbr 96) |
| 137 | +; (show-locations)) |
54 | 138 | ;((equal nmbr 97) |
55 | 139 | ; (save-positions-from-kb-to-file)) |
56 | 140 | ;((equal nmbr 98) |
57 | 141 | ; (load-positions-from-file-to-kb)) |
58 | | - ((equal nmbr 99) |
59 | | - (format t "type (menu) to come back to menu ~%") |
60 | | - (return)) |
61 | | - ((equal nmbr 0) |
62 | | - (format t "bye bye ~%") |
63 | | - (quit)))))) |
| 142 | +; ((equal nmbr 99) |
| 143 | +; (format t "type (menu) to come back to menu ~%") |
| 144 | +; (return)) |
| 145 | +; ((equal nmbr 0) |
| 146 | +; (format t "bye bye ~%") |
| 147 | +; (quit))) |
| 148 | + ))) |
64 | 149 |
|
65 | 150 | (menu) |
0 commit comments