Hi,
I have the following two components communicating with each other:
- 'daq': speaks with daq-card (using Comedi) --> two orocos ports: output-port for encoders and input_port for force command.
- 'control' : calculates the desired force commands based on current position (using Eigen) --> two orocos ports: input_port for encoders and output_port for force commands.
I want the following sequence of events:
'daq' reads encoders from daq-card and sends this to 'control'
'control' reads encoder signals, calculates force commands and sends these to 'daq'
'daq' reads force commands and sends this to daq-card
Currently I am using "normal" ports and when I check the timing, it seems that the sequence of events is not always the desired one: e.g. updatehook 'control' is finished before updatehook 'daq' even started.
The Orocos Component builder's manual explains how to use an EventPort instead of a "normal" port to trigger the updatehook of a component based on receiving data at an input_port. But how can a loop be created as in my desired sequence of events? I.e. updatehook 'daq' is partially executed, after this updatehook 'control' is fully executed, and finally the remaing part of 'daq' is executed.
Thanks in advance,
Bert
Ps. The orocos search engine doesn't seem to react on any search term...
Timing of different components that communicate
On Wednesday 01 December 2010 01:40:30 bert [dot] willaert [..] ... wrote:
> Hi,
>
> I have the following two components communicating with each other:
> - 'daq': speaks with daq-card (using Comedi) --> two orocos ports:
> output-port for encoders and input_port for force command.
-
> 'control' : calculates the desired force commands based on current
> position (using Eigen) --> two orocos ports: input_port for encoders and
> output_port for force commands.
>
> I want the following sequence of events:
> 'daq' reads encoders from daq-card and sends this to 'control'
> 'control' reads encoder signals, calculates force commands and sends these
> to 'daq'
'daq' reads force commands and sends this to daq-card
>
> Currently I am using "normal" ports and when I check the timing, it seems
> that the sequence of events is not always the desired one: e.g. updatehook
> 'control' is finished before updatehook 'daq' even started.
>
> The Orocos Component builder's manual explains how to use an EventPort
> instead of a "normal" port to trigger the updatehook of a component based
> on receiving data at an input_port. But how can a loop be created as in my
> desired sequence of events? I.e. updatehook 'daq' is partially executed,
> after this updatehook 'control' is fully executed, and finally the remaing
> part of 'daq' is executed.
This is rather easy. The only thing you need to take into account is the
return value of your read(). For example, when daq's update hook reads the
force command and the read returns 'NewData' you know a new sample arrived
and can pass it on to comedi. If it returns 'OldData'. You just return from
updateHook.
In pseudo code:
You can make the controller component event driven and the daq component
periodic (or the other way around). The 'event driven' component must add his
port with 'addEventPort'. In your simple case, even both components could
register their input ports as event ports and you can decide during deployment
which one gets a periodic thread and which is reactive.
>
> Thanks in advance,
>
> Bert
>
> Ps. The orocos search engine doesn't seem to react on any search term...
We had again a crashed MySQL table. Our provider's machine must have some
issues.
Peter
Timing of different components that communicate
> Hi,
>
> I have the following two components communicating with each other:
> - 'daq': speaks with daq-card (using Comedi) --> two orocos ports:
> output-port for encoders and input_port for force command.
-
> 'control' : calculates the desired force commands based on current
> position (using Eigen) --> two orocos ports: input_port for encoders and
> output_port for force commands.
>
> I want the following sequence of events:
> 'daq' reads encoders from daq-card and sends this to 'control'
> 'control' reads encoder signals, calculates force commands and sends these
> to 'daq'
'daq' reads force commands and sends this to daq-card
>
> Currently I am using "normal" ports and when I check the timing, it seems
> that the sequence of events is not always the desired one: e.g. updatehook
> 'control' is finished before updatehook 'daq' even started.
>
> The Orocos Component builder's manual explains how to use an EventPort
> instead of a "normal" port to trigger the updatehook of a component based
> on receiving data at an input_port. But how can a loop be created as in my
> desired sequence of events? I.e. updatehook 'daq' is partially executed,
> after this updatehook 'control' is fully executed, and finally the remaing
> part of 'daq' is executed.
This is rather easy. The only thing you need to take into account is the
return value of your read(). For example, when daq's update hook reads the
force command and the read returns 'NewData' you know a new sample arrived
and can pass it on to comedi. If it returns 'OldData'. You just return from
updateHook.
In pseudo code:
You can make the controller component event driven and the daq component
periodic (or the other way around). The 'event driven' component must add his
port with 'addEventPort'. In your simple case, even both components could
register their input ports as event ports and you can decide during deployment
which one gets a periodic thread and which is reactive.
-----------------------------------------
Hmm, what approach is most easy yours or Tinne's? It seems to me that yours needs only very little adaptation, but I don't get the triggering working yet. So to make the 'controller' gets executed at the moment 'daq' sends new encoder signals, I did only the following two things:
1) I made the encoder input-port of 'control' an EventPort:
2) In the XML file I have now:
However, the updateHook of 'control' never gets executed... Should this work?
Note that I have 'daq' as a peer of 'control' and 'control' as a peer of 'daq' in the XML file.
Any advice? thanks!
Bert
>
> Thanks in advance,
>
> Bert
>
> Ps. The orocos search engine doesn't seem to react on any search term...
We had again a crashed MySQL table. Our provider's machine must have some
issues.
Peter
Re: Timing of different components that communicate
> - 'daq': speaks with daq-card (using Comedi) --> two orocos ports: > output-port for encoders and input_port for force command.
- > 'control' : calculates the desired force commands based on current > position (using Eigen) --> two orocos ports: input_port for encoders and > output_port for force commands.
> > I want the following sequence of events:
> 'daq' reads encoders from daq-card and sends this to 'control'
> 'control' reads encoder signals, calculates force commands and sends these > to 'daq'
'daq' reads force commands and sends this to daq-card
> > Currently I am using "normal" ports and when I check the timing, it seems > that the sequence of events is not always the desired one: e.g. updatehook > 'control' is finished before updatehook 'daq' even started.
> > The Orocos Component builder's manual explains how to use an EventPort > instead of a "normal" port to trigger the updatehook of a component based > on receiving data at an input_port. But how can a loop be created as in my > desired sequence of events? I.e. updatehook 'daq' is partially executed, > after this updatehook 'control' is fully executed, and finally the remaing > part of 'daq' is executed.
This is rather easy. The only thing you need to take into account is the return value of your read(). For example, when daq's update hook reads the force command and the read returns 'NewData' you know a new sample arrived and can pass it on to comedi. If it returns 'OldData'. You just return from updateHook.
In pseudo code:
You can make the controller component event driven and the daq component periodic (or the other way around). The 'event driven' component must add his port with 'addEventPort'. In your simple case, even both components could register their input ports as event ports and you can decide during deployment which one gets a periodic thread and which is reactive.
-----------------------------------------
Hmm, what approach is most easy yours or Tinne's? It seems to me that yours needs only very little adaptation, but I don't get the triggering working yet. So to make the 'controller' gets executed at the moment 'daq' sends new encoder signals, I did only the following two things: 1) I made the encoder input-port of 'control' an EventPort:
Any advice? thanks!
Bert
> > Thanks in advance, > > Bert > > Ps. The orocos search engine doesn't seem to react on any search term...
We had again a crashed MySQL table. Our provider's machine must have some issues.
Peter