Transmitting dynamic messages from a HRT component

We have a component that must run in realtime which sends out messages
that contain a vector. For reference, here is the relevant part of the
ROS message definition:

uint8[] metadata

To construct an instance of this message (of type "rt_ops_event") in a
realtime-safe manner such that adding elements to metadata is
realtime-safe, it appears as if the following will suffice:

rt_ops_event_<RTT::os::allocator

However, we are unsure if trying to send this message through an
OutputPort is deterministic. The Component Builder's Manual states
that if you do not give the port an example message of the maximum
size expected, then "data transfer will proceed, but the RTT makes no
guarantees about real-timeness of the transfer."

The way we are using this message, we do not know what the largest
possible message size is when the component is initialized -- all we
can do is give it some constant size and hope it is enough, a solution
I find "unclean."

For our purposes, we do not need the message to make it to the
receiving component in a deterministic manner, but the
OutputPort.write() call must be deterministic.

Is OutputPort.write() always deterministic, even if the data transfer
itself isn't, or do we need to give it an example message?

Thank you for any help,
Johnathan Van Why
Dynamic Robotics Laboratory
Oregon State University

Transmitting dynamic messages from a HRT component

Hi Jonathan,

Op vrijdag 4 januari 2013 schreef Johnathan Van Why (jrvanwhy [..] ...)
het volgende:

> We have a component that must run in realtime which sends out messages
> that contain a vector. For reference, here is the relevant part of the
> ROS message definition:
>
> uint8[] metadata
>
> To construct an instance of this message (of type "rt_ops_event") in a
> realtime-safe manner such that adding elements to metadata is
> realtime-safe, it appears as if the following will suffice:
>
> rt_ops_event_<RTT::os::allocator

That should have been RTT::os::rt_allocator...

>
> However, we are unsure if trying to send this message through an
> OutputPort is deterministic. The Component Builder's Manual states
> that if you do not give the port an example message of the maximum
> size expected, then "data transfer will proceed, but the RTT makes no
> guarantees about real-timeness of the transfer."

This should be better defined. If you use a realtime allocator, the
transfer will
Always be realitme. So the above sentence assumed your data was using
The standard allocator.

>
> The way we are using this message, we do not know what the largest
> possible message size is when the component is initialized -- all we
> can do is give it some constant size and hope it is enough, a solution
> I find "unclean."
>
> For our purposes, we do not need the message to make it to the
> receiving component in a deterministic manner, but the
> OutputPort.write() call must be deterministic.
>
> Is OutputPort.write() always deterministic, even if the data transfer
> itself isn't, or do we need to give it an example message?

Yes and no. The rtt code itself is deterministic, the determinism
of copying of your
Data will depend on your allocator used. The sample data only
Initializes rtt's internal data such that a next copy of a real sample
Will not cause a memory allocation if it does not exceed the sample
Size.

In short, you don't need setDataSample if your data has a real-time
allocator. But it will avoid calling your allocator if sizes are smaller,
saving you some cycles....(but the time will always be bounded
by your allocator)

Peter

>
> Thank you for any help,
> Johnathan Van Why
> Dynamic Robotics Laboratory
> Oregon State University
> --
> Orocos-Users mailing list
> Orocos-Users [..] ... <javascript:;>
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Transmitting dynamic messages from a HRT component

On Sat, Jan 5, 2013 at 12:49 PM, Peter Soetens <peter [..] ...> wrote:
> Hi Jonathan,
>
> Op vrijdag 4 januari 2013 schreef Johnathan Van Why (jrvanwhy [..] ...) het
> volgende:
>
>> We have a component that must run in realtime which sends out messages
>> that contain a vector. For reference, here is the relevant part of the
>> ROS message definition:
>>
>> uint8[] metadata
>>
>> To construct an instance of this message (of type "rt_ops_event") in a
>> realtime-safe manner such that adding elements to metadata is
>> realtime-safe, it appears as if the following will suffice:
>>
>> rt_ops_event_<RTT::os::allocator >
>
> That should have been RTT::os::rt_allocator...

Thanks -- I typo'd while writing my email, but I'm glad that that
statement is otherwise fine.

>>
>>
>> However, we are unsure if trying to send this message through an
>> OutputPort is deterministic. The Component Builder's Manual states
>> that if you do not give the port an example message of the maximum
>> size expected, then "data transfer will proceed, but the RTT makes no
>> guarantees about real-timeness of the transfer."
>
>
> This should be better defined. If you use a realtime allocator, the transfer
> will
> Always be realitme. So the above sentence assumed your data was using
> The standard allocator.

Thank you -- this makes things a lot easier for us.

>
>>
>>
>> The way we are using this message, we do not know what the largest
>> possible message size is when the component is initialized -- all we
>> can do is give it some constant size and hope it is enough, a solution
>> I find "unclean."
>>
>> For our purposes, we do not need the message to make it to the
>> receiving component in a deterministic manner, but the
>> OutputPort.write() call must be deterministic.
>>
>> Is OutputPort.write() always deterministic, even if the data transfer
>> itself isn't, or do we need to give it an example message?
>
>
> Yes and no. The rtt code itself is deterministic, the determinism of copying
> of your
> Data will depend on your allocator used. The sample data only
> Initializes rtt's internal data such that a next copy of a real sample
> Will not cause a memory allocation if it does not exceed the sample
> Size.
>
> In short, you don't need setDataSample if your data has a real-time
> allocator. But it will avoid calling your allocator if sizes are smaller,
> saving you some cycles....(but the time will always be bounded
> by your allocator)
>
> Peter
>
>>
>>
>> Thank you for any help,
>> Johnathan Van Why
>> Dynamic Robotics Laboratory
>> Oregon State University
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ...
>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users

Thank You,
Johnathan Van Why
Dynamic Robotics Laboratory
Oregon State University