Skip to content

Commit 16d9043

Browse files
committed
minor update on BehaviorNavigationScenario (add menu)
1 parent c8684e0 commit 16d9043

3 files changed

Lines changed: 82 additions & 18 deletions

File tree

BehaviorNavigationScenario/model/BehaviorNavigationScenario.smartTcl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
:key '(is-a name)
2323
:value '(
2424
(is-a location)
25-
(name 1)
26-
(speech "ONE")
27-
(approach-type (exact))
28-
(approach-region-pose (800 0 0))
25+
(name pose1)
26+
(speech "pose-one")
27+
(approach-type (region))
28+
(approach-region-pose (-1000 2000 0))
2929
(approach-region-dist 150)
30-
(approach-exact-pose (1000 0 0))
31-
(approach-exact-dist 50)
30+
(approach-exact-pose (600 1700 0))
31+
(approach-exact-dist 100)
3232
(approach-exact-safetycl 0)
33-
(orientation-region (position 0 0))
34-
(orientation-exact (position 0 0))
33+
(orientation-region (position 500 2000))
34+
(orientation-exact (position 600 1900))
3535
(backward-dist 500)))
3636

3737
(tcl-kb-update
3838
:key '(is-a name)
3939
:value '(
4040
(is-a location)
41-
(name 2)
41+
(name pose2)
4242
(speech "TWO")
4343
(approach-region-pose (800 0 0))
4444
(approach-region-dist 150)
@@ -143,19 +143,19 @@
143143
(localizationModInst.tcb-set-robot-pose 0 0 0)
144144

145145
(localizationModInst.tcb-activate-localization)
146-
(nav1.tcb-move-robot 'approach-region 1)
147-
(nav1.tcb-move-robot 'approach-exact 1)
148-
(nav1.tcb-move-robot 'backward 1)
146+
(nav1.tcb-move-robot 'approach-region pose1)
147+
(nav1.tcb-move-robot 'approach-exact pose1)
148+
(nav1.tcb-move-robot 'backward pose1)
149149
(nav1.tcb-move-robot 'backward-abs 100)
150150
(nav1.tcb-move-robot 'plain 1000 0 100)
151-
(nav1.tcb-move-robot 'orientate-region 1)
152-
(nav1.tcb-move-robot 'orientate-exact 1)
151+
(nav1.tcb-move-robot 'orientate-region pose1)
152+
(nav1.tcb-move-robot 'orientate-exact pose1)
153153
(nav1.tcb-move-robot 'approach-region home)
154154
(nav1.tcb-move-robot 'orientate-exact home)
155155
(nav1.tcb-move-robot 'orientate-angle-absolute 45)
156156
(nav1.tcb-move-robot 'orientate-angle-relative 135)
157157
(nav1.tcb-move-robot 'orientate-angle-relative 180)
158-
(nav1.tcb-approach-location 1) ;region
158+
(nav1.tcb-approach-location pose1) ;region
159159
(localizationModInst.tcb-deactivate-localization)
160160

161161
(base.getBasePose => ?x ?y ?yaw)

BehaviorNavigationScenario/model/BehaviorNavigationScenario.taskRealization

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ TaskRealizationModel NavTasks {
33
AbstractCoordinationModuleInstance kbModInst coordModuleDef CommBasicObjects.KBModule
44
AbstractCoordinationModuleInstance localizationModInst coordModuleDef CommLocalizationObjects.LocalizationModule
55
AbstractCoordinationModuleInstance base coordModuleDef CommNavigationObjects.MobileBaseModule
6-
7-
8-
//this task realization is a dummy (see smartTCL file)
6+
7+
//this task realization is a dummy (see smartTCL file)
98
TaskRealization CommNavigationObjects.testTask { }
109
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)