[openrtm-users 01430] Regarding Subscription type in dataport

3 個の投稿 / 0 new
最終投稿
root
オフライン
Last seen: 5時間 47分 前
登録日: 2009-06-23 14:31
[openrtm-users 01430] Regarding Subscription type in dataport

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!ThanksTony

未定義
root
オフライン
Last seen: 5時間 47分 前
登録日: 2009-06-23 14:31
[openrtm-users 01431] Regarding Subscription type in dataport

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
>

root
オフライン
Last seen: 5時間 47分 前
登録日: 2009-06-23 14:31
[openrtm-users 01432] Regarding Subscription type in dataport

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 1and setting buffer full policy to overwriteI 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 <> 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
>

コメントを投稿するにはログインまたはユーザー登録を行ってください

ダウンロード

最新バージョン : 2.0.1-RELESE

統計

Webサイト統計
ユーザ数:2209
プロジェクト統計
RTコンポーネント307
RTミドルウエア35
ツール22
文書・仕様書2

Choreonoid

モーションエディタ/シミュレータ

OpenHRP3

動力学シミュレータ

OpenRTP

統合開発プラットフォーム

産総研RTC集

産総研が提供するRTC集

TORK

東京オープンソースロボティクス協会

DAQ-Middleware

ネットワーク分散環境でデータ収集用ソフトウェアを容易に構築するためのソフトウェア・フレームワーク