|
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 | | - |
7 | 5 | ;; MENU |
8 | 6 | (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 | | -; |
20 | 7 |
|
21 | 8 | (defun menu() |
22 | 9 | (execute '(nav1.tcb-init-navigation)) |
|
36 | 23 | (format t " ---------------------------------------------------- ~%") |
37 | 24 | (format t " 5 - Approach location ~%") |
38 | 25 | (format t " ---------------------------------------------------- ~%") |
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 ~%") |
| 26 | + ;(format t " 95 - Add new locations ~%") |
43 | 27 | (format t " 96 - Show locations ~%") |
44 | 28 | ;(format t " 97 - Save locations to file ~%") |
45 | 29 | ;(format t " 98 - Load locations from file ~%") |
46 | 30 | (format t "99 - quit menu ~%") |
47 | 31 | (format t " 0 - exit ~%") |
| 32 | + (setf nmbr (parse-integer (read-line nil))) |
| 33 | + (format t "your choice: ~d ~%" nmbr) |
48 | 34 |
|
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)) |
| 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)) |
138 | 54 | ;((equal nmbr 97) |
139 | 55 | ; (save-positions-from-kb-to-file)) |
140 | 56 | ;((equal nmbr 98) |
141 | 57 | ; (load-positions-from-file-to-kb)) |
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 | | - ))) |
| 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)))))) |
149 | 64 |
|
150 | 65 | (menu) |
0 commit comments