[openrtm-users 01432] Re: Regarding Subscription type in dataport

Tony Kuo ikuo005 @ aucklanduni.ac.nz
2010年 10月 13日 (水) 13:17:27 JST


Hi Geoff:
Thank you for your explanation.
It clarifies a lot !

Just to double check that I understood correctly.

If I have two components ConsoleIn and ConsoleOut,
there will be one buffer on each side of the connection between these two
components when I use New publisher,
but there is only one buffer on the receiving end, when I use Flush
publisher since it will block and write to the buffer before it continues
again while New publisher forks a process out to handle the writing


By adjusting the InPort buffer length on ConsoleOut to 1
and setting buffer full policy to overwrite
I can make sure that no matter how much faster ConsoleIn is sending data to
the port on ConsoleOut than ConsoleOut can receive. ConsoleOut will always
get the latest value from ConsoleIn (but only the latest value).


For policy on controlling what to do when the buffer is empy,
does Readback policy mean that the previous data will be read, and Block
will block the process of receiving component until there is a new data in
the buffer, but what does do_nothing policy do?

and I understand these policy settings can only be set through a config
file? ('coz I can't see them in RT System editor)
You attached a picture  on data port connector profile in your answer to one
of the questions in the ML, but I couldn't find that setting in my RT system
editor.

PS I attached the screenshot you posted.

Thanks heaps
Tony



On 12 October 2010 13:17, Geoffrey Biggs <geoffrey.biggs @ aist.go.jp> wrote:

> Hi Tony,
>
> There are three types of publisher provided by default in OpenRTM-aist:
>
> - Flush
>
> As soon as you write data to the port, the data is written to the
> connected ports. The write occurs in the thread of whoever calls
> write(). This means that, if a write takes a while, it will delay your
> component's execution. Do not use this publisher for components that
> must meet their execution deadlines.
>
> - New
>
> Similar to the Flush publisher, but the write takes place in a separate
> process. This publisher supports push policies (ALL, FIFO, SKIP and
> NEW), because the task that performs the write may get its execution
> time after several calls to write() have occurred. The ALL policy means
> to push all available data in the buffer, one after another. The FIFO
> policy will send one item from the buffer. The SKIP policy will skip a
> certain number of items in the buffer, allowing (for example) every 5th
> value to be sent. The NEW policy will send the newest value in the
> buffer, ignoring any written previously.
>
> - Periodic
>
> This publisher runs a separate task performing the write at a configured
> frequency. It will write data from the buffer according to the push
> policy (see New, above) each time.
>
>
> In addition, you can also control the buffer on the receiving end. This
> is useful if the values will arrive faster than your component can
> handle them. In the configuration file for your component (e.g.
> mycomp.conf), add lines like the following:
>
> # InPort's name is "in". OutPort's name is "out".
> # The default length of the InPort’s buffer is 8.
> port.inport.in.buffer.length: 1
>
> # Policy controlling what to do when the buffer is empty:
> # readback (default), do_nothing, block
> port.inport.in.buffer.read.empty_policy: block
>
>
> You will need to add lines to the rtc.conf file to tell it that this
> configuration file is for your component:
>
> comp_category.comp_name.config_file: mycomp.conf
>
>
> For your situation, I recommend using either the Flush or New publisher
> (use New if your component cannot be allowed to block) and setting the
> buffer on the receiving end to 1. You could also use a pull connection,
> but this will delay the receiving component while the data is transferred.
>
> Don't forget that you can also write your own publishers and load them
> as plugins.
>
> Geoff
>
>
> On 10/10/10 11:55, Tony Kuo wrote:
> > Dear OpenRTM ML:
> >
> > I have always been using the default flush subscription type when i
> > connect my components in RTSystemEditor.
> > But I don't know how is it different to the "new" subscription type?
> >
> > I found a slide that explains that but is not clear.
> > slide 19 on
> > http://www.openrtm.org/OpenRTM-aist/download/resume/070523/070523-01.pdf
> >
> > What I actually want to do is,
> > I wanna make sure whenever I read data in from one of the data port in
> > my component, I get the newest data no matter how many data are already
> > in the connector buffer (i.e. discard all except the newest one)
> >
> > If you can point me in the right direction,
> > it's very much appreciated!
> >
> > Thanks
> > Tony
> >
>
>
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: <http://www.openrtm.org/pipermail/openrtm-users/attachments/20101013/0b1f3e0e/attachment-0001.html>
-------------- next part --------------
$B%F%-%9%H7A<00J30$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
$B%U%!%$%kL>(B: DataPortConnection.png
$B7?(B:         image/png
$B%5%$%:(B:     12443 $B%P%$%H(B
$B @ bL@(B:       $BL5$7(B
URL:        <http://www.openrtm.org/pipermail/openrtm-users/attachments/20101013/0b1f3e0e/attachment-0001.png>


openrtm-users メーリングリストの案内