Use Dynamic Memory Management Policy with FastDDS-SH
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
Is there a solution please? I also had a similar problem
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?