Boost logo

Boost Users :

Subject: Re: [Boost-users] Meta State Machine PseudoExit transitions
From: Johan Gielens (johan.gielens_at_[hidden])
Date: 2011-06-30 04:11:38


Hi,

I tried to make it work, but sadly I didn't succeed. It almost looks
like the PseudoExit state doesn't forward the event to the TopState. I
currently commented out all other states in the SubState to make
debugging easier and set the last State (Transport) to the
initial_state. Of course I left Exit1 and Exit2 as they were.
As i keep triggering Sensor Events ( they also get handled later on in
the state machine ), it's almost like it fights its way through the
errors...
I have put the timeline with the code, debug prints and my comments below:

row< Transport , Sensor , Exit2 ,
&SubFront::ActionSensor , &SubFront::SDownstreamNoCheck >

Current state: 0
Event: Sensor
SubState Guard: Sensor Downstream Active and No Check?
SubState Action: Sensor
SubState no_transition: Invalid state transition! --> 2
Type: N10controller19TopStateFront6SensorE,
N5boost3msm4back13state_machineIN10controller19TopStateFront6SubStateAFrontENS_9parameter5void_ES8_S8_S8_EE

The Current state in the debug prints is for SubState. I don't know
which states these exactly are, but I guess Transport is state 0 and
Exit2 is state 2.
So, you see that the first sensor action triggers the transition and
moves from Transport to Exit2. Why is no_transition called when the
event already finished?

Current state: 2
Event: Sensor
SubState no_transition: Invalid state transition! --> 2
Type: N10controller19TopStateFront6SensorE,
N5boost3msm4back13state_machineIN10controller19TopStateFront6SubStateAFrontENS_9parameter5void_ES8_S8_S8_EE
TopState Guard: Exit2
TopState Action: Sensor

After sending another Sensor event the SubState still complains about
no_transition. Because I have defined guards for all transitions with
debug prints, the failing transition is most likely generated from
within the PseudoExit. As you can see it does execute the Exit2 guard
and completes the transition. This code in the TopState will handle
it:

row< Sub::exit_pt< SubFront::Exit2 > , Sensor , SituationB
 , &TopFront::ActionSensor , &TopFront::Exit2Guard >,

And Exit2 is defined (in SubState) as:
struct Exit2 : public msm::front::exit_pseudo_state<Sensor> {};

Current state: 2
Event: Sensor
TopState Guard: Situation B and beyond
TopState Action: Sensor

Here we are, in Situation B. So, one way or another ... it actually
works. Strange...
Any ideas??

Best regards,
Johan


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