Skip to content

Commit

Permalink
Merge pull request #1327 from knorth55/fetch-euslisp-navigation
Browse files Browse the repository at this point in the history
Update Fetch navigation euslisp scripts
  • Loading branch information
k-okada authored Sep 24, 2021
2 parents e272982 + 04eb51d commit 297a6ac
Show file tree
Hide file tree
Showing 12 changed files with 408 additions and 68 deletions.
10 changes: 6 additions & 4 deletions jsk_fetch_robot/jsk_fetch_startup/euslisp/auto-dock.l
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
;; go-dock.l
;; Author: Yuki Furuta <[email protected]>
#!/usr/bin/env roseus

(ros::roseus "fetch_go_dock")
(require :fetch-interface "package://fetcheus/fetch-interface.l")
(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")

(ros::roseus "fetch_go_dock")
(fetch-init)
(send *ri* :clear-costmap)
(auto-dock)
(exit)
(sys::exit 0)
4 changes: 2 additions & 2 deletions jsk_fetch_robot/jsk_fetch_startup/euslisp/call-k-okada.l
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
;; go-dock.l
;; Author: Yuki Furuta <[email protected]>
#!/usr/bin/env roseus

(ros::roseus "call_k_okada")
(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")
Expand All @@ -16,3 +15,4 @@
(auto-dock))

(call-k-okada)
(sys::exit 0)
4 changes: 3 additions & 1 deletion jsk_fetch_robot/jsk_fetch_startup/euslisp/dock.l
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env roseus

(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")

(ros::roseus "fetch_dock")
(simple-dock)
(exit)
(sys::exit 0)
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
(ros::roseus "fetch_look_at_human")
(fetch-init)
(main *fetch* (send *fetch* :head-rgb))
(sys::exit 0)
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@
(auto-dock))

(go-to-kitchen)
(sys::exit 0)
34 changes: 19 additions & 15 deletions jsk_fetch_robot/jsk_fetch_startup/euslisp/go-to-kitchen.l
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
(ros::roseus "go_to_kitchen")
#!/usr/bin/env roseus

(require :fetch-interface "package://fetcheus/fetch-interface.l")
(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")

(defun go-to-kitchen ()
;; go to kitchen
(send *ri* :speak "go to kitchen.")
(if (go-to-spot "/eng2/7f/room73B2-sink-front1" (make-coords :pos #f(100 -1000 0)))
(progn ;; succeeded to go to kitchen
(unix:sleep 1)
(send *ri* :speak "arrived at kitchen." :wait t)
(unix:sleep 1)
(send *ri* :speak "return to dock." :wait t)
(auto-dock))
(progn ;; failed to go to kitchen
(send *ri* :speak "I could not go to kitchen, so return to dock." :wait t)
(auto-dock))))

(defun main (&key (tweet t) (n-dock-trial 3) (n-kitchen-trial 3) (control-switchbot :api))
(when (not (boundp '*sm*))
(go-to-kitchen-state-machine))
(let ((result-state
(exec-state-machine *sm* `((tweet . ,tweet)
(n-kitchen-trial . ,n-kitchen-trial)
(n-dock-trial . ,n-dock-trial)
(control-switchbot . ,control-switchbot)
(initial-light-on . nil)
(success-go-to-kitchen . nil)
(success-auto-dock . nil))
:hz 2.0)))
(send result-state :name)))

(go-to-kitchen)

(ros::roseus "go_to_kitchen")
(if (main) (unix::exit 0) (unix::exit 1))
9 changes: 9 additions & 0 deletions jsk_fetch_robot/jsk_fetch_startup/euslisp/light-off.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env roseus

(require :fetch-interface "package://fetcheus/fetch-interface.l")
(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")

(ros::roseus "light_off")
(fetch-init)
(room-light-off :control-switchbot :api)
(sys::exit 0)
9 changes: 9 additions & 0 deletions jsk_fetch_robot/jsk_fetch_startup/euslisp/light-on.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env roseus

(require :fetch-interface "package://fetcheus/fetch-interface.l")
(load "package://jsk_fetch_startup/euslisp/navigation-utils.l")

(ros::roseus "light_on")
(fetch-init)
(room-light-on :control-switchbot :api)
(sys::exit 0)
Loading

0 comments on commit 297a6ac

Please sign in to comment.