0
$\begingroup$

Rosanswers logo

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 !!


Originally posted by amarbanerjee23 on ROS Answers with karma: 5 on 2017-09-07

Post score: 0


Original comments

Comment by knxa on 2017-09-10:
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?

Comment by amarbanerjee23 on 2017-09-12:
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.

Comment by gvdhoorn on 2017-09-12:
I think I believe I agree with @knxa: if the behaviour is different, why are you trying to reuse the state?

Comment by amarbanerjee23 on 2017-09-12:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by knxa with karma: 811 on 2017-09-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by amarbanerjee23 on 2017-09-13:
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 ?

Comment by knxa on 2017-09-13:
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.

Comment by amarbanerjee23 on 2017-09-13:
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 !!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.