Hi,
is there a possibility, that an event triggered state machine can react to all buffered events and not only the first one?
For example:
* The state machine is loaded in an activity with period 0.
* The activity will be woken up by an event port:
transition input(data) ...
* The connection policy between input and output port is set to a buffered connection with 10 elements.
* Another activity will sent multiple data per updateHook(). (multiple call of output.write)
* The state machine only reacts to the first received event, but I want to react to all sent events with the transition statement.
The period of the receiving activity with the state machine has to be 0.
I want to have something like this:
Transition while (input(data))
{
...
}
But so far that's a syntax error in the state machine.
Thanks for the help.
Sandra
buffered event ports in event triggered state machine
On Fri, May 9, 2014 at 1:34 PM, Sandra Beyer <sandra [dot] beyer [..] ...> wrote:
> Hi,
>
> is there a possibility, that an event triggered state machine can react to
> all buffered events and not only the first one?
>
> For example:
>
> · The state machine is loaded in an activity with period 0.
>
> · The activity will be woken up by an event port:
>
> transition input(data) …
>
> · The connection policy between input and output port is set to a
> buffered connection with 10 elements.
>
> · Another activity will sent multiple data per updateHook().
> (multiple call of output.write)
>
> · The state machine only reacts to the first received event, but I
> want to react to all sent events with the transition statement.
>
>
>
> The period of the receiving activity with the state machine has to be 0.
>
> I want to have something like this:
>
>
>
> Transition while (input(data))
>
> {
>
> …
>
> }
>
> But so far that’s a syntax error in the state machine.
It is. What you can do is read the first sample in the transition, and
if something is there, trigger() your component again :
transition input(data) {
/*... your original code uses 'data' .. */
trigger()
}
or use a while loop within the transition statement:
transition input(data) {
do {
/*... your original code uses 'data'.. */
} while (input.read(data) == NewData )
}
Orocos-RTT itself can't know if it needs to wake-up your component or
not to process the other data samples, so you have to make it
explicit.
Peter