ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

Preempting with SMACH

asked 2011-05-10 08:46:11 -0500

Moulineau gravatar image

updated 2011-05-28 05:19:22 -0500

kwc gravatar image

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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2011-05-25 03:56:30 -0500

Wim gravatar image

updated 2012-04-04 07:47:45 -0500

If I understand your example correctly, the states gotoA and gotoB each take a longer time. And while gotoA and gotoB are running, you want to check for some transition condition. I see two possible solutions here:

1) In the execute() methods of gotoA and gotoB, you continuously check for this transition condition, and return an outcome when the transition condition is satisfied.

2) Use the concurrence container to create a monitor state that runs in parallel with gotoA and gotoB. So gotoA will run in a concurrence container with a monitor state, and gotoB will run in a different concurrence container with a monitor state. All the monitor state does is check for the transition condition. When the transition is satisfied, the concurrence container can automatically preempts gotoA or gotoB.

edit flag offensive delete link more

Comments

Could you give a little clarification on this? The way I understand, gotoA and gotoB would have to run in parallel (as well as monitor) to be part of the concurrence container. If monitor state changes, how could the container only preempt one state and transition to the other? Thanks

phil0stine gravatar image phil0stine  ( 2012-03-31 08:53:33 -0500 )edit
-1

answered 2011-05-12 11:04:14 -0500

Willy Lambert gravatar image

I am also interested in the answer.. I have read the tutorials and there are always simple execute that doesn't take time to run. If a child state have a while(true) in his execute, may the mother machine transitions occurs ?

edit flag offensive delete link more

Comments

sorry to bump, but it seems to be a very concrete case, do we missed some documentation somewhere ?
Willy Lambert gravatar image Willy Lambert  ( 2011-05-17 08:53:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2011-05-10 08:46:11 -0500

Seen: 1,761 times

Last updated: Apr 04 '12