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

Transition smach to same final state

asked 2017-09-07 01:56:37 -0600

amarbanerjee23 gravatar image

updated 2017-09-07 02:09:15 -0600

Hi all, I want to execute a self transition in which the initial state is same as the final state STATE_A -----> STATE_A However, when the smach.execute() is called, it continuously executes the transition in an infinite loop. My main main condition is that I need to do a self transition.

Please suggest any suitable techniques to do so. Thanks and Cheers !!

edit retag flag offensive close merge delete

Comments

Not sure what you are trying to do. If you at the end enter STATE_A again with the same input data as the first time, wouldn't you expect the state machine execution to loop forever?

knxa gravatar image knxa  ( 2017-09-10 09:12:23 -0600 )edit

Hi @knxa. The problem I am facing need to have a self transition from initial state A to final state A. But behaviour of initial state A is different to final state A. I wish to use the concept of entry and exit actions to create behaviour for transitions and not states.

Hope I was able to explain.

amarbanerjee23 gravatar image amarbanerjee23  ( 2017-09-12 03:39:01 -0600 )edit

I think I believe I agree with @knxa: if the behaviour is different, why are you trying to reuse the state?

gvdhoorn gravatar image gvdhoorn  ( 2017-09-12 03:41:41 -0600 )edit

Hi @gvdhoorn, I see what you are saying, but I want to reuse the state but with a different action behaviour. E.g. A->B is a transition T1 having some actions, while A->A is another transition T2 with a different action. I want to associate the behaviour with the transition not the state.

amarbanerjee23 gravatar image amarbanerjee23  ( 2017-09-12 04:08:33 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-12 07:32:11 -0600

knxa gravatar image

updated 2017-09-12 07:32:56 -0600

A state represents a task being done. If the task represented by A should be performed again it makes ok sense to me to reenter A. And it makes sense that the behaviour of A might be dependent on input.

But a state is not aware of how the state was entered, whether the transition came from B or from itself or something else. You will have to provide this difference as userdata if you need it.

Consider if A really represents the same task both in the beginning and the end.

edit flag offensive delete link more

Comments

Hi, @knxa,I tried doing that but still, the statemachine seems to run in an infinite loop. However,when I try the self transition A->A in a Concurrence container,it runs only once as per requirement. Would that be a good option ? Else, could you please give an example for A->A transition in smach ?

amarbanerjee23 gravatar image amarbanerjee23  ( 2017-09-13 02:04:31 -0600 )edit

I am not yet too experience with SMACH myself so take my input with caution. Unfortunately I don't have time to construct an example for you. Good luck.

knxa gravatar image knxa  ( 2017-09-13 02:27:02 -0600 )edit

No problem ! Thanks for your inputs !! It seems that Concurrent containers do not get into an infinite loop for a self transition and userdata does not help in changing behaviour of a state at different conditions. Thanks and Cheers !!

amarbanerjee23 gravatar image amarbanerjee23  ( 2017-09-13 02:30:38 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-09-07 01:56:37 -0600

Seen: 536 times

Last updated: Sep 12 '17