Saturday, March 14, 2009

Orocos : the way to trigger nonperiod activity update funtion

For NonPeriod Activity, the updateHook just can work once after start. But how can I make it work when events come or command come?

Three ways to make updateHook work again for NonPeriod activity:
1, The simple way is add trigger in the updateHook function. But this way will waste the processor time. It likes a loop.
2, Using command method. If other task use this NonPeriod activity's command, then it will run again. The NonPeriod activity engine will first run command, and then run updateHook function.
3, Using event method. But event has two kinds. One is synchronous and the other one is asynchronous. Only the asynchronous one can be used to trigger updateHook. The reason is if the call back is in this NonPeriod activity, synchronous only make this call back run in caller's engine but not this NonPeriod activity's engine. Asynchronous will make the call back part work in the NonPeriod activity's engine.

No comments: