Orocos-Dev Digest, Vol 76, Issue 33

>   4. Re: [Bug 864] New: OCL Timercomponent with multiple timers
>      fires sometimes with wrong timerIds (S Roderick)
> Date: Thu, 26 May 2011 07:50:48 -0400
> From: S Roderick
> Subject: Re: [Orocos-Dev] [Bug 864] New: OCL Timercomponent with
>        multiple timers fires sometimes with wrong timerIds
> Message-ID: <300981F3-B70B-4559-9E8A-D3ACB38C20EE [..] ...>
> Content-Type: text/plain; CHARSET=US-ASCII

>> I'm using the OCL::TimerComponent, connected to a Controller component, which
>> triggers (eventPort) a custom method (watchdog). I had no problem using the
>> Timer component with only one timer (Timercomponent gets configured and started
>> properly, and the actual timer is started with Timer.startTimer (id, period)).
>> When I start a second timer in the same component (with a different timerId of
>> course), that timer triggers my component _sometimes_ more then once in a
>> single period and at the same time, the other one didn't trigger at all?! See
>> for example the deployer output below, where timer 0 and timer 1 both run at
>> 0.5 seconds. Timer 0 does not trigger the method at e.g. 3.974seconds, while
>> timer 1 triggers it twice:
> <snip>
> The TimerComponent has had this problem for a while (search the ML). We use it like this in state machines:


I suppose you are using 2.x? According to
<http://bugs.orocos.org/show_bug.cgi?id=703#c12> I thought this might
have been solved in 2.x.

See also

> &#10;&gt; ...&#10;&gt;                handle&#10;&gt;                {&#10;&gt;                        // wait for N seconds&#10;&gt;                        do Timer.wait(ID_WAIT, 2.0)&#10;&gt;                }&#10;&gt;                exit&#10;&gt;                {&#10;&gt;                        // in case still running&#10;&gt;                        try Timer.killTimer(ID_WAIT)&#10;&gt;                }&#10;&gt;                transition Timer.timeout(timerID)&#10;&gt;                        if timerID == ID_WAIT then select OTHER_STATE&#10;&gt;                transition nonTimerRelated() select ANOTHER_STATE&#10;&gt;        }&#10;&gt;
> Where we explicitly wait for the timer ID of interest. Otherwise you run into your problem :-(

We do similar magic, and additionnaly increase timerID every time
(make sure you don't go in overrun though) we get in the same state,
st. like

state blabla
try comp.start()
/* Workaround for orocos 1.x Statemachine bug:
increase Timer id.
* See
set timerID = timerID + 1
// Wait for Steady State (takes +- 4 secs)
set isTimerID_OK=Timer.arm(timerID, 4.0)
// do trigger()

transition if (isTimerID_OK == false) then
set fatalErrorMessage="Unable to create a
valid timerID in the excitationState"
} select fatalErrorState

transition Timer.timeout(tID) if tID == timerID then
select acquisitionState

Note: this is 1.x...


Orocos-Dev mailing list
Orocos-Dev [..] ...