Skip to content

Commit

Permalink
add before and after hook for state machine execution
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Oct 18, 2022
1 parent 4d45a0d commit 3ae96ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion roseus_smach/src/state-machine-utils.l
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
;; state-machine-utils.l

(defun exec-state-machine (sm &optional (mydata '(nil))
&key (spin t) (hz 1) (root-name "SM_ROOT") (srv-name "/server_name") iterate)
&key (spin t) (hz 1) (root-name "SM_ROOT") (srv-name "/server_name") iterate
(before-hook-func) (after-hook-func)
)
"Execute state machine
Args:
Expand Down Expand Up @@ -40,7 +42,9 @@ Returns:
(ros::ros-warn "aborting...")
(return))
(t (error "value of key :iterate must be t or function"))))))
(if before-hook-func (funcall before-hook-func))
(send sm :execute mydata :step -1)
(if after-hook-func (funcall after-hook-func))
(ros::sleep))
(send sm :active-state)))

Expand Down

0 comments on commit 3ae96ee

Please sign in to comment.