|
| 1 | +(format t "INIT DONE ~%") |
| 2 | + |
| 3 | +(defun format-locations (s obj colonmod at-sign) (declare (ignore colonmod)) (declare (ignore at-sign)) (format s "~s" (get-value obj 'name))) |
| 4 | + |
| 5 | +;; MENU |
| 6 | +(defvar nmbr nil) |
| 7 | + |
| 8 | +(defun menu() |
| 9 | + (execute '(nav1.tcb-init-navigation)) |
| 10 | + (execute '(nav1.tcb-load-navigation-map "navigation-map")) |
| 11 | + |
| 12 | + (execute '(localizationModInst.tcb-load-localization-map "localization-map.yaml")) |
| 13 | + (execute '(localizationModInst.tcb-trigger-global-localization)) |
| 14 | + (execute '(localizationModInst.tcb-set-robot-pose 0 0 0)) |
| 15 | +(loop |
| 16 | + |
| 17 | + (let ((known-locations (tcl-kb-query-all :key '(is-a) :value '((is-a location))))) |
| 18 | + |
| 19 | + (format t "~%MENU~%====~%~%") |
| 20 | + (format t " ---------------------------------------------------- ~%") |
| 21 | + (format t " 3 - Start Joystick Navigation ~%") |
| 22 | + (format t " 4 - Stop Joystick Navigation ~%") |
| 23 | + (format t " ---------------------------------------------------- ~%") |
| 24 | + (format t " 5 - Approach location ~%") |
| 25 | + (format t " ---------------------------------------------------- ~%") |
| 26 | + ;(format t " 95 - Add new locations ~%") |
| 27 | + (format t " 96 - Show locations ~%") |
| 28 | + ;(format t " 97 - Save locations to file ~%") |
| 29 | + ;(format t " 98 - Load locations from file ~%") |
| 30 | + (format t "99 - quit menu ~%") |
| 31 | + (format t " 0 - exit ~%") |
| 32 | + (setf nmbr (parse-integer (read-line nil))) |
| 33 | + (format t "your choice: ~d ~%" nmbr) |
| 34 | + |
| 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)) |
| 54 | + ;((equal nmbr 97) |
| 55 | + ; (save-positions-from-kb-to-file)) |
| 56 | + ;((equal nmbr 98) |
| 57 | + ; (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)))))) |
| 64 | + |
| 65 | +(menu) |
0 commit comments