Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost msm
From: Sven Steckmann (spm_boost_at_[hidden])
Date: 2012-03-05 02:25:21


Hi,

I am not quite sure, if I have understood your question correctly. But
you want to do some stuff in Go_backtoStatemachine() dependent on your
active state?
My solution for this is to generate another event (EventExecute) which
does not trigger a state transition but an action. The statemachine
itself handles only transitions if events happen for you, it is not a
task-switching scheduler like an operating system is.

Regards, Sven

On 03/05/2012 02:22 AM, keithzz wrote:
> newbi question pleasee bare with me as Im struggling with this.
>
> I want to use boost msm state machine but i am having a hard time imagining
> how it works. Let say we only have 2 states (s1, s2) and to go from s1 to s2
> you need event e1 to be fired and to bo back you need another one e2. e1 and
> e2 can only be fired from within s1 and s2 respectively.
>
> Now in main() I start by starting the statemachine (start()) then ill have a
> while loop that every 1 min will go back to the state machine but have to
> pick up from where it left.i.e.
>
> main()
> {
> MSM.start(); //start state machine
>
> while (a_condition)
> {
> ProcessInputsfromIO();
> Go_backtoStatemachine(); //how can i do this?
> delay(1min)
> }
> MSM.stop();
> }
> So basically when a state finishes executing, the statemachine will exit,
> then ill have a delay of 1 minutes, then the while loop will need to take me
> back to the state I was before I exit, or I think that's how we should
> implement a state machine.
>
> Is what I am asking for out of the ordinary? If yes then how do people
> implement a non-blocking state machine? if no, then how can I implement
> Go_backtoStatemachine()?
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/Boost-msm-tp4444830p4444830.html
> Sent from the Boost - Users mailing list archive at Nabble.com.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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