eProsima / Micro-XRCE-DDS-Gen

Micro XRCE-DDS IDL code generator tool. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
10 stars 13 forks source link

Allow for user-defined array sizes #68

Closed Ryanf55 closed 5 months ago

Ryanf55 commented 1 year ago

Right now, MicroXRCEDDSGen hard codes a size of 100 for arrays.

typedef struct tf2_msgs_msg_TFMessage
{
    uint32_t transforms_size;
    geometry_msgs_msg_TransformStamped transforms[100];
} tf2_msgs_msg_TFMessage;

As a user, there is no way to adjust this at configure time. For an embedded system like ArduPilot, 100 transforms, or 100 joystick inputs, is far too many. We would like to configure these for our application. Perhaps through a define?

pablogs9 commented 1 year ago

Hello @Ryanf55, this proposal LGTM, could you open a PR with a code proposal so we can discuss there?

Ryanf55 commented 11 months ago

I don't actually have a great idea of how to do this without assuming the message structure/naming of ROS messages. Any recommendations are welcomed.

pablogs9 commented 11 months ago

I'm gonna take a look internally to check the possibilities. I will report back.

pablogs9 commented 11 months ago

This is the related PR removing this hardcoded "100" value: https://github.com/eProsima/IDL-Parser/pull/111

But this implies updating Micro-XRCE-DDS-Gen to latest IDL-Parser.

pablogs9 commented 11 months ago

@Ryanf55 could you check this PR: https://github.com/eProsima/Micro-XRCE-DDS-Gen/pull/74

I have updated IDL-Parser and added -default-container-prealloc-size CLI option, so now you should be able to set the default size of sequences to a defined value.

Could you give a try?

srmainwaring commented 9 months ago

@pablogs9, thanks for this change. I've used #74 to generate the bindings for the ArduPilot DDS library and it appears to work as expected on the two message types affected: sensor_msgs/Joy and tf2_msgs/TFMessage.