commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: [scxml] condition checking
Date Sat, 21 Aug 2010 17:39:27 GMT
On Fri, Aug 20, 2010 at 3:06 PM, Christopher Dragert
<chris.dragert@mail.mcgill.ca> wrote:
> My SCXML is crashing when I try to run it and my debugging efforts have gone for naught.
 The observable behaviour is as follows -- from the state stationary, the state machine checks
the guard on a transitions several times, and then stops functioning.  The cond is a method
call using JEXL that returns a boolean (I've tested this and found that the method does return
on a call leading to the crash, so the problem is not here).
>
> If the move transition is followed, then on eventual return to the stationary state,
the state machine will become unresponsive after a few checks of the guard.
>
> With a listener I've determined that there is no state change, so if the machine is running,
the cond should be evaluated.  My hunch is that the state machine is silently failing --
how can i determine if this is the case?
<snip/>

Not sure what crash means since I take it you are not observing any
stack traces or ErrorReporter callbacks. It also seems that the state
machine makes progress in some cases (as the "move" transition you
mention above).

Eventless transitions are only evaluated when an event is processed by
Commons SCXML (be it external or internal). The cond method getting
called number of times is a result of the processing of the external
event followed by one or more internal events. Then the state machine
may just be at rest between processing events (and therefore
"silent").


>  Are there any obvious mistakes that I'm making in my SCXML file?
>
<snap/>

The indentation makes it slightly harder to read, but apart from the
fact that some non-final states seem to be declared as final, I don't
see much else (it would be good to remove all final="true" instances).
Ofcourse, there are a number of eventless transitions (see above).

Best if you could describe the expected behavior you are looking on
(for a given scenario of current state, event fired etc.) -- what you
are observing is clearer in your note.

-Rahul



> Any help would be appreciated,
>
> Chris Dragert
>
> ------
> SCXML file:
>
> <?xml version="1.0" encoding="ASCII"?>
> <scxml xmlns="http://www.w3.org/2005/07/scxml"
>       version="1.0"
>       initialstate="stationary">
>
>  <datamodel>
>     <data id="threatener" />
>  <data id="move" expr="move" />
>    </datamodel>
>    <state id="tracking" final="true">
>        <initial>
>   <transition target="safe" />
>  </initial>
>
>  <transition event="i_see_player">
>      <log expr="this.addPlayer(_eventdata)" />
>        </transition>
>
>  <transition event="i_dont_see_player">
>      <log expr="this.removePlayer(_eventdata)" />
>        </transition>
>
>  <state id="safe" final="true">
>   <initial>
>    <transition target="history" />
>   </initial>
>
>   <history type="deep" id="history">
>     <transition target="stationary"/>
>   </history>
>   <state id="stationary" final="true">
>    <transition cond="this.tooClose(this.getTheyApproachBuffer())" target="threatened"
/>
>    <transition event="move" target="moving" />
>   </state>
>
>   <state id="moving" final="true">
>    <transition cond="this.tooClose(this.getWeApproachBuffer())" target="threatened">
>     <raise event="destination_unreachable" />
>    </transition>
>    <transition event="destination_reached" target="stationary" />
>    <transition event="destination_unreachable" target="stationary" />
>   </state>
>  </state>
>
>  <state id="threatened">
>   <onentry>
>    <log expr="this.fleeTarget(threatener)" />
>    <log expr="this.createEvent('move', destination)" />
>   </onentry>
>
>   <transition event="destination_reached" target="history" />
>   <transition event="destination_unreachable" target="history" />
>  </state>
>
>  </state>
>
> </scxml>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message