Boost logo

Boost Users :

Subject: Re: [Boost-users] [MSM] a timer/timeout for the whole state machine (including submachines)
From: Albert Gil Moreno (albert.gil_at_[hidden])
Date: 2012-04-05 05:25:08


Thanks for your fast reply!

Yes, you could also use a region with 1 state and internal transitions but
> it's about the same.
>
> "As much as possible in transition table" is one idea I got from you!
;-)

>I realized that "fsm" is the submachine and AFAIK there is no way to
> access to the parent(est) fsm...
> Yes it's something which has been requested a few times, it will be done,
> but I didn't come to it yet. In the meantime you have 2 solutions:
> - exit the submachine using an exit pseudo state, it's UML conform and
> visible in your diagram.
> - keep a pointer to the parent-est machine. Not very beautiful but it'll
> work.
>
> I've already tryied the ugly pointer solution... and works.
I'm gonna try the first one, also to try an exit pseudo state... i've never
used yet!

> There is no timer in MSM for 2 reasons:
> - it's out of the scope of the library
>
> just this reason seems enought to me!
;-)

>And, although "fsm" is the submachine, why the no_transition function is
> not executed (this last seems a bug to me...).
>
> I don't think so. If the submachine doesn't handle the event, the upper
> one could, so it gets a chance to do it, etc. until the top-level fsm. If
> no fsm including the top-level fsm brings a no_transition, then it's a bug.
>
> Then... I think we've found a bug?
I'm attaching a version of your tutorial as a test case of this bug.

The bug can be reproduced by:
- Creating a functor action (FA) that process an event (E)
- Creating an state machine (SM) and a submachine (SSM)
- SM and SSM should call FA in some place of their transition table
- E should not be present in the SSM (it can or not be in SM).

If the FA is called by the SM, everything works as expected:
- no_transitions if E is not in SM
- the correct transtion if E is in SM (E is not in SSM)

But if the FA is called bu the SSM, nothing happens:
- no_transition is not called if E is not in SM
- transition is not executed is E is in SM
  - ok, I've just checked when E is in an orthogonal region of SM...

Please, let me known if it is a real bug and if a patch is easy or not (may
be I can help...?).
I think that if we fix this bug, then the ugly pointer solution can be
removed!
;-)

Thanks!

Albert





Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net