Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[roseus_smach] add before and after hook for state machine execution #724

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

knorth55
Copy link
Member

@knorth55 knorth55 commented Oct 18, 2022

before-hook-func and after-hook-func

this PR add before-hook-func and after-hook-func for state-machine execution.
in the loop, we can add befor hook and after hook for smach execution.

(catch :exec-state-machine-loop ...) for global exit from hook-func with throw.

I also add catch :exec-state-machine-loop for global exit from the loop.
with this PR, we can exit from the execution loop from the hook with (throw :exec-state-machine-loop).

this is the example of the hook usage.

(exec-state-machine *sm*
  :before-hook-func
  #'(lambda (userdata)
     (if *stopped*
       (progn
         (ros::ros-warn "Stopped...")
         (setf (cdr (assoc 'count userdata)) 0)
         (throw :exec-state-machine-loop t))))
  :after-hook-func
  #'(lambda (userdata)
     (send *irtviewer* :draw-objects))
  )

@tkmtnt7000 tkmtnt7000 self-assigned this Oct 19, 2022
@knorth55 knorth55 mentioned this pull request Oct 19, 2022
4 tasks
@knorth55 knorth55 changed the title add before and after hook for state machine execution [roseus_smach] add before and after hook for state machine execution Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants