Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Dynamic Memory Management Policy with FastDDS-SH #177

Open
marcus89 opened this issue Apr 12, 2022 · 2 comments
Open

Use Dynamic Memory Management Policy with FastDDS-SH #177

marcus89 opened this issue Apr 12, 2022 · 2 comments

Comments

@marcus89
Copy link

Hi everyone,

I want to use change the History Memory Policy to DYNAMIC in the Integration Service.

1 - Below, my working configuration:
ROS2 publisher on domain 0 --> Integration Service --> ROS2 subscriber on domain 1

The topic published by the ROS2 node is :

  • topicType: sensor_msgs/msg/Image
  • topicName: image
    The quality of service is correctly set (BEST_EFFORT and VOLATILE).
    This previous configuration works perfectly.

2 - Now, I want to use FastDDS as system in Integration service. Below, my configuration :
ROS2 publisher on domain 0 --> Integration Service --> FastDDS subscriber on domain 1

When using this configuration, I get the following error :
[DYN_TYPES Error] Error inserting data. The container is full. -> Function insert_sequence_data

This error makes me think that the DYNAMIC Memory Policy is not applied by Integration Service when creating publisher/subscriber.

Can someone confirm this limitation?

Best Regards,
Marius

@xixioba
Copy link

xixioba commented May 22, 2022

Is there a solution please? I also had a similar problem

@liufang-robot
Copy link

liufang-robot commented Jun 8, 2022

I had a similar problem.
I tried to understand what happend.

I think Integration Service uses the DynamicType to handle all the data bridge.
For sequene data. here it is:

Firstly, It creates the builder.
In Integration Service FASHDDS-SH source code Conversion.cpp here

DynamicTypeBuilder_ptr result = factory->create_sequence_builder(builder, c_type.bounds());

For sequence data in image msg, the c_type.bounds() is 0.

Then in create_sequence_builder
it's in FASTDDS source code DynamicTypeBuilderFactory.cpp here

DynamicTypeBuilder* DynamicTypeBuilderFactory::create_sequence_builder(
        const DynamicType_ptr type,
        uint32_t bound)
{
    if (type != nullptr)
    {
        if (bound == BOUND_UNLIMITED)
        {
            bound = MAX_ELEMENTS_COUNT;
        }

Here BOUND_UNLIMITED macro is 0, MAX_ELEMENTS_COUNT macro is 100.
For DynamicType , FASTDDS will set the bound to MAX_ELEMENTS_COUNT if the input bound is BOUND_UNLIMITED.

And finally at runtime.
in FASTDDS source code DynamicData.cpp here

ReturnCode_t DynamicData::insert_sequence_data(
        MemberId& outId)
{
    outId = MEMBER_ID_INVALID;
    if (get_kind() == TK_SEQUENCE)
    {
        if (type_->get_bounds() == BOUND_UNLIMITED || get_item_count() < type_->get_bounds())
        {
        ...
        }
        else
        {
            logError(DYN_TYPES, "Error inserting data. The container is full.");
            return ReturnCode_t::RETCODE_BAD_PARAMETER;
        }
    }

Here type_->get_bounds() is MAX_ELEMENTS_COUNT, and if your item sequence size is bigger than it(for image the pixel data is definitely bigger than 100) , you will get an error "Error inserting data. The container is full."

I'm not sure my understanding is correct..
And is there an elegant way to handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants