Preempting with SMACH
Good day everybody
I am trying to implement a cyclic and premptive behaviour on a state machine for my robot with SMACH. I'm wondering a lot about "how I should do to stay in the smach philosophy" and not re-implement existing things. I would like to implement the following state machine:
- HARVEST, outcome END -> none, outcome DANGER -> ESCAPE
HARVEST is containing :
- GOTO A , outcome SUCCEED -> GOTO B
- GOTO B , outcome SUCCEED -> GOTO A
- ESCAPE, outcome SUCCEED -> GOTO A
and GOTO A, GOTO B and ESCAPE are state that are most of the time waiting for actions to suceed (not immediate transitions).
My question is
- I would like that, each cycle, HARVEST transitions are verified. If one of them is true, then states within HARVEST are preempted.
I have a hard time understanding if my GOTO A.execute() function shall be blocking or returning an outcome linked to the same state... And where I can put my checkTransitions() code for HARVEST
Thanks for your help