Boost logo

Boost Users :

Subject: Re: [Boost-users] How do you handle state-independent events efficiently in MSM?
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2011-08-31 13:35:43


>> we will move to plan B. Define a second region in your fsm, with only one dummy state, then add for every event you want to process independently of your "regular" states a transition in the fsm from this dummy state to itself (or give this state an internal transition table).

>> As every region gets a chance to process any event, you will get the same effect and the reduced compilation time.

   

>Thanks, this is exactly what I was looking for! I implemented this and it works perfectly, and it cut down my transition table significantly!

   

  Good. It turns out, I simply oversaw the case of internal transitions for the main fsm. It's not an implementation bug, but a design one, which is much worse because if implies bigger changes :(

>The next question applies to another smaller subset of events I need to deal with. These can also happen regardless of what state the machine is

>in, but transition the machine to a one my "regular" states. I can use a similar approach with these, but obviously I need an additional method to

>put the machine back to the dummy state in addition to the "regular" state the incoming event transitions the machine to. How would I implement

>this, or something that accomplishes something similar?

  I'm not sure I understand this, could you elaborate? If one region transitions from one state to another, it has no influence on other regions.

  To the other part, there is no simple way to say "transition from any state to State X". The only way is to move all states except the target to a submachine, then transition from the submachine to state X.

  If you transition back and want to remember where you were, you use a history.

  Of course, this is not perfect because you cannot make a state belong to several submachines.

  This is something I need to put on my list, it would be nice to have a transition from whatever to state X.

  HTH,

  Christophe



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